Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5274702ab | ||
|
|
40645a80a1 | ||
|
|
e3d33a1af9 | ||
|
|
0ed95d81dd | ||
|
|
397085e335 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"ExpandedNodes": [
|
|
||||||
"",
|
|
||||||
"\\OpenSaveCloudClient"
|
|
||||||
],
|
|
||||||
"SelectedNode": "\\OpenSaveCloudClient\\OpenSaveCloudClient.csproj",
|
|
||||||
"PreviewInSolutionExplorer": false
|
|
||||||
}
|
|
||||||
Binary file not shown.
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
7
LICENSE
Normal file
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2022 Aurélie Delhaie
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
14
OpenSaveCloudCli/OpenSaveCloudCli.csproj
Normal file
14
OpenSaveCloudCli/OpenSaveCloudCli.csproj
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OpenSaveCloudCore\OpenSaveCloudCore.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
36
OpenSaveCloudCli/Program.cs
Normal file
36
OpenSaveCloudCli/Program.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using OpenSaveCloudCore.Core;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace OpenSaveCloudCli
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
static int Main(string[] args)
|
||||||
|
{
|
||||||
|
if (args.Contains("-v") || args.Contains("--version"))
|
||||||
|
{
|
||||||
|
Version();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Version()
|
||||||
|
{
|
||||||
|
Assembly a = Assembly.GetExecutingAssembly();
|
||||||
|
Version? v = a.GetName().Version;
|
||||||
|
string clientInfo = "C# [Core .NET {0}/{1}]";
|
||||||
|
Version dotNetVersion = Environment.Version;
|
||||||
|
string? clrArch = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
|
||||||
|
clientInfo = string.Format(clientInfo, dotNetVersion, clrArch);
|
||||||
|
|
||||||
|
Console.WriteLine("Open Save Cloud - Terminal Client (Cross Platform)");
|
||||||
|
if (v != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("v{0}", v.ToString());
|
||||||
|
}
|
||||||
|
Console.WriteLine("Running on .Net {0}", clientInfo);
|
||||||
|
|
||||||
|
// TODO get server version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
VisualStudioVersion = 17.2.32505.173
|
VisualStudioVersion = 17.2.32505.173
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSaveCloudClient", "OpenSaveCloudClient\OpenSaveCloudClient.csproj", "{5BD9E525-B234-4AE2-9780-86E959592258}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSaveCloudClient", "OpenSaveCloudClient\OpenSaveCloudClient.csproj", "{5BD9E525-B234-4AE2-9780-86E959592258}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16} = {496FCF95-DA39-4699-BDF9-8824FFE58F16}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSaveCloudCore", "OpenSaveCloudCore\OpenSaveCloudCore.csproj", "{496FCF95-DA39-4699-BDF9-8824FFE58F16}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSaveCloudCli", "OpenSaveCloudCli\OpenSaveCloudCli.csproj", "{3D3DD97A-9140-458D-BB94-3505F362A305}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -21,6 +28,22 @@ Global
|
|||||||
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|x64.ActiveCfg = Release|x64
|
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|x64.ActiveCfg = Release|x64
|
||||||
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|x64.Build.0 = Release|x64
|
{5BD9E525-B234-4AE2-9780-86E959592258}.Release|x64.Build.0 = Release|x64
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{496FCF95-DA39-4699-BDF9-8824FFE58F16}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{3D3DD97A-9140-458D-BB94-3505F362A305}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -20,7 +20,7 @@ namespace OpenSaveCloudClient
|
|||||||
public AboutBox()
|
public AboutBox()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AboutBox_Load(object sender, EventArgs e)
|
private void AboutBox_Load(object sender, EventArgs e)
|
||||||
|
|||||||
8
OpenSaveCloudClient/AddGameForm.Designer.cs
generated
8
OpenSaveCloudClient/AddGameForm.Designer.cs
generated
@@ -28,7 +28,6 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddGameForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddGameForm));
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
@@ -42,7 +41,6 @@
|
|||||||
this.NoCoverLabel = new System.Windows.Forms.Label();
|
this.NoCoverLabel = new System.Windows.Forms.Label();
|
||||||
this.CoverPicture = new System.Windows.Forms.PictureBox();
|
this.CoverPicture = new System.Windows.Forms.PictureBox();
|
||||||
this.AddButton = new System.Windows.Forms.Button();
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.PathErrorLabel = new System.Windows.Forms.Label();
|
this.PathErrorLabel = new System.Windows.Forms.Label();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
@@ -201,11 +199,6 @@
|
|||||||
this.AddButton.UseVisualStyleBackColor = true;
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
this.AddButton.Click += new System.EventHandler(this.button1_Click);
|
this.AddButton.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
// timer1
|
|
||||||
//
|
|
||||||
this.timer1.Interval = 350;
|
|
||||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
|
||||||
//
|
|
||||||
// PathErrorLabel
|
// PathErrorLabel
|
||||||
//
|
//
|
||||||
this.PathErrorLabel.AutoSize = true;
|
this.PathErrorLabel.AutoSize = true;
|
||||||
@@ -259,7 +252,6 @@
|
|||||||
private Label label2;
|
private Label label2;
|
||||||
private Label NoCoverLabel;
|
private Label NoCoverLabel;
|
||||||
private PictureBox CoverPicture;
|
private PictureBox CoverPicture;
|
||||||
private System.Windows.Forms.Timer timer1;
|
|
||||||
private Label NameWarningLabel;
|
private Label NameWarningLabel;
|
||||||
private Label PathErrorLabel;
|
private Label PathErrorLabel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using IGDB;
|
using OpenSaveCloudCore.Core;
|
||||||
using IGDB.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using OpenSaveCloudClient.Core;
|
|
||||||
using OpenSaveCloudClient.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -16,72 +14,21 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
public partial class AddGameForm : Form
|
public partial class AddGameForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly IGDBClient? _client;
|
|
||||||
private GameSave result;
|
private GameSave result;
|
||||||
private SaveManager saveManager;
|
private SaveManager saveManager;
|
||||||
|
|
||||||
public GameSave Result { get { return result; } }
|
public GameSave Result { get { return result; } }
|
||||||
|
|
||||||
public AddGameForm(IGDBClient? iGDBClient)
|
public AddGameForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_client = iGDBClient;
|
saveManager = SaveManager.Instance;
|
||||||
saveManager = SaveManager.GetInstance();
|
NoCoverLabel.Text = "IGDB is not configured";
|
||||||
if (_client == null)
|
|
||||||
{
|
|
||||||
NoCoverLabel.Text = "IGDB is not configured";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NoCoverLabel.Visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void timer1_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
timer1.Stop();
|
|
||||||
if (_client != null)
|
|
||||||
{
|
|
||||||
NoCoverLabel.Visible = false;
|
|
||||||
CoverPicture.Visible = true;
|
|
||||||
if (!string.IsNullOrWhiteSpace(NameBox.Text))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string query = string.Format("fields *; search \"{0}\";", NameBox.Text.Replace("\"", ""));
|
|
||||||
Game[] games = await _client.QueryAsync<Game>(IGDBClient.Endpoints.Games, query: query);
|
|
||||||
games = games.Where(g => g.Cover != null && g.Cover.Value != null).ToArray();
|
|
||||||
if (games.Length > 0)
|
|
||||||
{
|
|
||||||
Game game = games.First();
|
|
||||||
CoverPicture.LoadAsync(game.Cover.Value.Url);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CoverPicture.Visible = false;
|
|
||||||
NoCoverLabel.Text = "No cover found";
|
|
||||||
NoCoverLabel.Visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
CoverPicture.Visible = false;
|
|
||||||
NoCoverLabel.Text = ex.Message;
|
|
||||||
NoCoverLabel.Visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NameBox_TextChanged(object sender, EventArgs e)
|
private void NameBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NameWarningLabel.Visible = saveManager.Saves.Exists(g => g.Name == NameBox.Text);
|
NameWarningLabel.Visible = saveManager.Saves.Exists(g => g.Name == NameBox.Text);
|
||||||
if (_client != null)
|
|
||||||
{
|
|
||||||
timer1.Stop();
|
|
||||||
timer1.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pathButton_Click(object sender, EventArgs e)
|
private void pathButton_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -57,9 +57,6 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -21,8 +21,8 @@ namespace OpenSaveCloudClient
|
|||||||
public AddUser()
|
public AddUser()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddUser_Load(object sender, EventArgs e)
|
private void AddUser_Load(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -28,8 +28,8 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
result = new List<GameSave>();
|
result = new List<GameSave>();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
saveManager = SaveManager.GetInstance();
|
saveManager = SaveManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownloadGameForm_Load(object sender, EventArgs e)
|
private void DownloadGameForm_Load(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using IGDB;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
|
||||||
|
|
||||||
namespace OpenSaveCloudClient
|
namespace OpenSaveCloudClient
|
||||||
{
|
{
|
||||||
public partial class GameLibrary : Form
|
public partial class GameLibrary : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Configuration _configuration;
|
private readonly UserConfiguration _configuration;
|
||||||
//private readonly IGDBClient? _client;
|
|
||||||
private readonly SaveManager saveManager;
|
private readonly SaveManager saveManager;
|
||||||
private readonly TaskManager taskManager;
|
private readonly TaskManager taskManager;
|
||||||
private readonly ServerConnector serverConnector;
|
private readonly ServerConnector serverConnector;
|
||||||
@@ -19,21 +17,15 @@ namespace OpenSaveCloudClient
|
|||||||
public GameLibrary()
|
public GameLibrary()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
saveManager = SaveManager.GetInstance();
|
saveManager = SaveManager.Instance;
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.Instance;
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
_configuration = Configuration.GetInstance();
|
_configuration = UserConfiguration.Instance;
|
||||||
logManager = LogManager.GetInstance();
|
logManager = LogManager.Instance;
|
||||||
|
|
||||||
listViewContextMenu = new ContextMenuStrip();
|
listViewContextMenu = new ContextMenuStrip();
|
||||||
listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click;
|
listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click;
|
||||||
listViewContextMenu.Items.Add("Remove from local library").Click += contextMenuRemoveFromLocalLibrary_Click;
|
listViewContextMenu.Items.Add("Remove from local library").Click += contextMenuRemoveFromLocalLibrary_Click;
|
||||||
/*if (_configuration.GetBoolean("igdb.enabled", false))
|
|
||||||
{
|
|
||||||
string clientId = _configuration.GetString("igdb.client_id", "");
|
|
||||||
string clientSecret = _configuration.GetString("igdb.client_secret", "");
|
|
||||||
_client = new IGDBClient(clientId, clientSecret);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameLibrary_Load(object sender, EventArgs e)
|
private void GameLibrary_Load(object sender, EventArgs e)
|
||||||
@@ -172,7 +164,7 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AddGameForm form = new(/*_client*/ null);
|
AddGameForm form = new();
|
||||||
if (form.ShowDialog() == DialogResult.OK) {
|
if (form.ShowDialog() == DialogResult.OK) {
|
||||||
GameSave newGame = form.Result;
|
GameSave newGame = form.Result;
|
||||||
ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); });
|
ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); });
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient
|
|||||||
public LoginForm()
|
public LoginForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoginButton_Click(object sender, EventArgs e)
|
private void LoginButton_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient
|
namespace OpenSaveCloudClient
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient
|
|||||||
public LogsForm()
|
public LogsForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
logManager = LogManager.GetInstance();
|
logManager = LogManager.Instance;
|
||||||
logManager.NewMessage += logManager_NewError;
|
logManager.NewMessage += logManager_NewError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,35 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
|
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<PackageIcon>logo.png</PackageIcon>
|
<PackageIcon>logo.png</PackageIcon>
|
||||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
|
<SignAssembly>True</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>D:\keyPair.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<AnalysisLevel>6.0-all</AnalysisLevel>
|
||||||
|
<Version>1.0.3</Version>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -18,8 +38,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="IGDB" Version="2.3.1" />
|
<ProjectReference Include="..\OpenSaveCloudCore\OpenSaveCloudCore.csproj" />
|
||||||
<PackageReference Include="PasswordGenerator" Version="2.1.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -28,6 +47,11 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -42,6 +66,10 @@
|
|||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath>\</PackagePath>
|
<PackagePath>\</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
26
OpenSaveCloudClient/Properties/Settings.Designer.cs
generated
Normal file
26
OpenSaveCloudClient/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace OpenSaveCloudClient.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
OpenSaveCloudClient/Properties/Settings.settings
Normal file
6
OpenSaveCloudClient/Properties/Settings.settings
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
</SettingsFile>
|
||||||
@@ -7,19 +7,19 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient
|
namespace OpenSaveCloudClient
|
||||||
{
|
{
|
||||||
public partial class SettingsForm : Form
|
public partial class SettingsForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Configuration _configuration;
|
private readonly UserConfiguration _configuration;
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_configuration = Configuration.GetInstance();
|
_configuration = UserConfiguration.Instance;
|
||||||
InitAndFillFields();
|
InitAndFillFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient
|
|||||||
public TasksForm()
|
public TasksForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddLVItem(string key, string name, string status, bool undefined, int value, int max)
|
private void AddLVItem(string key, string name, string status, bool undefined, int value, int max)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -20,7 +20,7 @@ namespace OpenSaveCloudClient
|
|||||||
public UserForm()
|
public UserForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserForm_Load(object sender, EventArgs e)
|
private void UserForm_Load(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -20,7 +20,7 @@ namespace OpenSaveCloudClient
|
|||||||
public UserManagementForm()
|
public UserManagementForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserSettingsButton_Click(object sender, EventArgs e)
|
private void UserSettingsButton_Click(object sender, EventArgs e)
|
||||||
|
|||||||
1
OpenSaveCloudClient/WaitingForm.Designer.cs
generated
1
OpenSaveCloudClient/WaitingForm.Designer.cs
generated
@@ -82,6 +82,5 @@
|
|||||||
|
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private PictureBox LoadingIndicator;
|
private PictureBox LoadingIndicator;
|
||||||
private System.Windows.Forms.Timer timer1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient
|
|||||||
public WaitingForm()
|
public WaitingForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.Instance;
|
||||||
taskManager.TaskChanged += OnTaskChanged;
|
taskManager.TaskChanged += OnTaskChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
internal class HashTool
|
internal class HashTool
|
||||||
{
|
{
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
public class LogManager
|
public class LogManager
|
||||||
{
|
{
|
||||||
@@ -20,10 +20,16 @@ namespace OpenSaveCloudClient.Core
|
|||||||
messages = new List<Log>();
|
messages = new List<Log>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LogManager GetInstance()
|
public static LogManager Instance
|
||||||
{
|
{
|
||||||
if (instance == null) { instance = new LogManager(); }
|
get
|
||||||
return instance;
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new LogManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddError(Exception ex)
|
public void AddError(Exception ex)
|
||||||
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
public class PasswordTool
|
public class PasswordTool
|
||||||
{
|
{
|
||||||
@@ -4,9 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
public class SaveManager
|
public class SaveManager
|
||||||
{
|
{
|
||||||
@@ -22,13 +22,16 @@ namespace OpenSaveCloudClient.Core
|
|||||||
ThreadPool.QueueUserWorkItem(delegate { CleanArchiveFolder(); });
|
ThreadPool.QueueUserWorkItem(delegate { CleanArchiveFolder(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaveManager GetInstance()
|
public static SaveManager Instance
|
||||||
{
|
{
|
||||||
if (instance == null)
|
get
|
||||||
{
|
{
|
||||||
instance = new SaveManager();
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new SaveManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameSave Create(string name, string path, string coverHash)
|
public GameSave Create(string name, string path, string coverHash)
|
||||||
@@ -4,12 +4,12 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudCore.Models.Remote;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class is a connector to the remote Open Save Cloud server, it contains all the function that are mapped to the server endpoint
|
/// This class is a connector to the remote Open Save Cloud server, it contains all the function that are mapped to the server endpoint
|
||||||
@@ -29,7 +29,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
|
|
||||||
private readonly LogManager logManager;
|
private readonly LogManager logManager;
|
||||||
private readonly TaskManager taskManager;
|
private readonly TaskManager taskManager;
|
||||||
private readonly Configuration configuration;
|
private readonly UserConfiguration configuration;
|
||||||
private readonly SaveManager saveManager;
|
private readonly SaveManager saveManager;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,19 +42,21 @@ namespace OpenSaveCloudClient.Core
|
|||||||
|
|
||||||
private ServerConnector()
|
private ServerConnector()
|
||||||
{
|
{
|
||||||
configuration = Configuration.GetInstance();
|
configuration = UserConfiguration.Instance;
|
||||||
logManager = LogManager.GetInstance();
|
logManager = LogManager.Instance;
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.Instance;
|
||||||
saveManager = SaveManager.GetInstance();
|
saveManager = SaveManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ServerConnector GetInstance()
|
public static ServerConnector Instance
|
||||||
{
|
{
|
||||||
if (instance == null)
|
get {
|
||||||
{
|
if (instance == null)
|
||||||
instance = new ServerConnector();
|
{
|
||||||
|
instance = new ServerConnector();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -441,6 +443,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken);
|
client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken);
|
||||||
client.DefaultRequestHeaders.Add("X-Game-Save-Hash", newHash);
|
client.DefaultRequestHeaders.Add("X-Game-Save-Hash", newHash);
|
||||||
client.DefaultRequestHeaders.Add("X-Hash", hash);
|
client.DefaultRequestHeaders.Add("X-Hash", hash);
|
||||||
|
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||||
HttpResponseMessage response = client.PostAsync(string.Format("{0}:{1}/api/v1/game/upload", host, port), multipartFormContent).Result;
|
HttpResponseMessage response = client.PostAsync(string.Format("{0}:{1}/api/v1/game/upload", host, port), multipartFormContent).Result;
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -480,6 +483,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
||||||
client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken);
|
client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken);
|
||||||
|
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||||
HttpResponseMessage response = client.GetAsync(string.Format("{0}:{1}/api/v1/game/download", host, port)).Result;
|
HttpResponseMessage response = client.GetAsync(string.Format("{0}:{1}/api/v1/game/download", host, port)).Result;
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudCore.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudCore.Core
|
||||||
{
|
{
|
||||||
public class TaskManager
|
public class TaskManager
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
|
|
||||||
private TaskManager()
|
private TaskManager()
|
||||||
{
|
{
|
||||||
logManager = LogManager.GetInstance();
|
logManager = LogManager.Instance;
|
||||||
_tasks = new Dictionary<string, AsyncTaskInformation>();
|
_tasks = new Dictionary<string, AsyncTaskInformation>();
|
||||||
mut = new Mutex();
|
mut = new Mutex();
|
||||||
timer = new System.Timers.Timer
|
timer = new System.Timers.Timer
|
||||||
@@ -32,13 +32,16 @@ namespace OpenSaveCloudClient.Core
|
|||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaskManager GetInstance()
|
public static TaskManager Instance
|
||||||
{
|
{
|
||||||
if (instance == null)
|
get
|
||||||
{
|
{
|
||||||
instance = new TaskManager();
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new TaskManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StartTask(string label, bool undefined, int progressMax)
|
public string StartTask(string label, bool undefined, int progressMax)
|
||||||
@@ -125,7 +128,11 @@ namespace OpenSaveCloudClient.Core
|
|||||||
mut.WaitOne();
|
mut.WaitOne();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_tasks.Clear();
|
var ended = _tasks.Where(t => t.Value.Status != AsyncTaskStatus.Running).ToArray();
|
||||||
|
foreach (var task in ended)
|
||||||
|
{
|
||||||
|
_tasks.Remove(task.Key);
|
||||||
|
}
|
||||||
OnTaskCleared(new TaskClearedEventArgs());
|
OnTaskCleared(new TaskClearedEventArgs());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models
|
namespace OpenSaveCloudCore.Models
|
||||||
{
|
{
|
||||||
public class AsyncTaskInformation
|
public class AsyncTaskInformation
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models
|
namespace OpenSaveCloudCore.Models
|
||||||
{
|
{
|
||||||
public enum AsyncTaskStatus
|
public enum AsyncTaskStatus
|
||||||
{
|
{
|
||||||
@@ -5,26 +5,29 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models
|
namespace OpenSaveCloudCore.Models
|
||||||
{
|
{
|
||||||
public class Configuration
|
public class UserConfiguration
|
||||||
{
|
{
|
||||||
private static Configuration? instance;
|
private static UserConfiguration? instance;
|
||||||
private Dictionary<string, string> _values;
|
private Dictionary<string, string> _values;
|
||||||
|
|
||||||
private Configuration()
|
private UserConfiguration()
|
||||||
{
|
{
|
||||||
_values = new Dictionary<string, string>();
|
_values = new Dictionary<string, string>();
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Configuration GetInstance()
|
public static UserConfiguration Instance
|
||||||
{
|
{
|
||||||
if (instance == null)
|
get
|
||||||
{
|
{
|
||||||
instance = new Configuration();
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new UserConfiguration();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
@@ -6,9 +6,10 @@ using System.Text.Json.Serialization;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using OpenSaveCloudClient.Core;
|
using OpenSaveCloudCore.Core;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models
|
namespace OpenSaveCloudCore.Models
|
||||||
{
|
{
|
||||||
public class GameSave
|
public class GameSave
|
||||||
{
|
{
|
||||||
@@ -96,7 +97,7 @@ namespace OpenSaveCloudClient.Models
|
|||||||
byte[]? hashBytes = HashTool.HashDirectory(FolderPath);
|
byte[]? hashBytes = HashTool.HashDirectory(FolderPath);
|
||||||
if (hashBytes == null)
|
if (hashBytes == null)
|
||||||
{
|
{
|
||||||
throw new Exception(String.Format("failed to get hash of directory '{0}'", FolderPath));
|
throw new Exception(message: string.Format(CultureInfo.CurrentCulture, "failed to get hash of directory '{0}'", FolderPath));
|
||||||
}
|
}
|
||||||
currentHash = BitConverter.ToString(hashBytes).Replace("-", "");
|
currentHash = BitConverter.ToString(hashBytes).Replace("-", "");
|
||||||
if (currentHash != hash)
|
if (currentHash != hash)
|
||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models
|
namespace OpenSaveCloudCore.Models
|
||||||
{
|
{
|
||||||
public enum LogSeverity
|
public enum LogSeverity
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class AccessToken
|
public class AccessToken
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class Credential
|
public class Credential
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class Game
|
public class Game
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class GameUploadToken
|
public class GameUploadToken
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class HttpError
|
public class HttpError
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class LockError
|
public class LockError
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class NewGameInfo
|
public class NewGameInfo
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class NewPassword
|
public class NewPassword
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class Registration
|
public class Registration
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class ServerInformation
|
public class ServerInformation
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class TokenValidation
|
public class TokenValidation
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class UpdateUsername
|
public class UpdateUsername
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class UploadGameInfo
|
public class UploadGameInfo
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Models.Remote
|
namespace OpenSaveCloudCore.Models.Remote
|
||||||
{
|
{
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
14
OpenSaveCloudCore/OpenSaveCloudCore.csproj
Normal file
14
OpenSaveCloudCore/OpenSaveCloudCore.csproj
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="PasswordGenerator" Version="2.1.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user