Download file
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
58
OpenSaveCloudClient/AddGameForm.Designer.cs
generated
58
OpenSaveCloudClient/AddGameForm.Designer.cs
generated
@@ -32,6 +32,7 @@
|
|||||||
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();
|
||||||
|
this.NameWarningLabel = new System.Windows.Forms.Label();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.pathButton = new System.Windows.Forms.Button();
|
this.pathButton = new System.Windows.Forms.Button();
|
||||||
@@ -40,8 +41,9 @@
|
|||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
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.button1 = new System.Windows.Forms.Button();
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.PathErrorLabel = new System.Windows.Forms.Label();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.CoverPicture)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.CoverPicture)).BeginInit();
|
||||||
@@ -63,6 +65,7 @@
|
|||||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.groupBox1.Controls.Add(this.NameWarningLabel);
|
||||||
this.groupBox1.Controls.Add(this.label3);
|
this.groupBox1.Controls.Add(this.label3);
|
||||||
this.groupBox1.Controls.Add(this.label2);
|
this.groupBox1.Controls.Add(this.label2);
|
||||||
this.groupBox1.Controls.Add(this.pathButton);
|
this.groupBox1.Controls.Add(this.pathButton);
|
||||||
@@ -75,10 +78,21 @@
|
|||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Game information";
|
this.groupBox1.Text = "Game information";
|
||||||
//
|
//
|
||||||
|
// NameWarningLabel
|
||||||
|
//
|
||||||
|
this.NameWarningLabel.AutoSize = true;
|
||||||
|
this.NameWarningLabel.ForeColor = System.Drawing.Color.Coral;
|
||||||
|
this.NameWarningLabel.Location = new System.Drawing.Point(15, 113);
|
||||||
|
this.NameWarningLabel.Name = "NameWarningLabel";
|
||||||
|
this.NameWarningLabel.Size = new System.Drawing.Size(421, 25);
|
||||||
|
this.NameWarningLabel.TabIndex = 5;
|
||||||
|
this.NameWarningLabel.Text = "There is already a game with this name in the library";
|
||||||
|
this.NameWarningLabel.Visible = false;
|
||||||
|
//
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(15, 132);
|
this.label3.Location = new System.Drawing.Point(15, 161);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(169, 25);
|
this.label3.Size = new System.Drawing.Size(169, 25);
|
||||||
this.label3.TabIndex = 4;
|
this.label3.TabIndex = 4;
|
||||||
@@ -96,7 +110,7 @@
|
|||||||
// pathButton
|
// pathButton
|
||||||
//
|
//
|
||||||
this.pathButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.pathButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.pathButton.Location = new System.Drawing.Point(571, 157);
|
this.pathButton.Location = new System.Drawing.Point(571, 186);
|
||||||
this.pathButton.Name = "pathButton";
|
this.pathButton.Name = "pathButton";
|
||||||
this.pathButton.Size = new System.Drawing.Size(47, 34);
|
this.pathButton.Size = new System.Drawing.Size(47, 34);
|
||||||
this.pathButton.TabIndex = 2;
|
this.pathButton.TabIndex = 2;
|
||||||
@@ -108,7 +122,7 @@
|
|||||||
//
|
//
|
||||||
this.LocationBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.LocationBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.LocationBox.Location = new System.Drawing.Point(15, 160);
|
this.LocationBox.Location = new System.Drawing.Point(15, 189);
|
||||||
this.LocationBox.Name = "LocationBox";
|
this.LocationBox.Name = "LocationBox";
|
||||||
this.LocationBox.ReadOnly = true;
|
this.LocationBox.ReadOnly = true;
|
||||||
this.LocationBox.Size = new System.Drawing.Size(550, 31);
|
this.LocationBox.Size = new System.Drawing.Size(550, 31);
|
||||||
@@ -162,29 +176,41 @@
|
|||||||
this.CoverPicture.TabStop = false;
|
this.CoverPicture.TabStop = false;
|
||||||
this.CoverPicture.Visible = false;
|
this.CoverPicture.Visible = false;
|
||||||
//
|
//
|
||||||
// button1
|
// AddButton
|
||||||
//
|
//
|
||||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.button1.Location = new System.Drawing.Point(943, 508);
|
this.AddButton.Location = new System.Drawing.Point(943, 508);
|
||||||
this.button1.Name = "button1";
|
this.AddButton.Name = "AddButton";
|
||||||
this.button1.Size = new System.Drawing.Size(112, 34);
|
this.AddButton.Size = new System.Drawing.Size(112, 34);
|
||||||
this.button1.TabIndex = 3;
|
this.AddButton.TabIndex = 3;
|
||||||
this.button1.Text = "Add";
|
this.AddButton.Text = "Add";
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
this.AddButton.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
// timer1
|
// timer1
|
||||||
//
|
//
|
||||||
this.timer1.Interval = 350;
|
this.timer1.Interval = 350;
|
||||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||||
//
|
//
|
||||||
|
// PathErrorLabel
|
||||||
|
//
|
||||||
|
this.PathErrorLabel.AutoSize = true;
|
||||||
|
this.PathErrorLabel.ForeColor = System.Drawing.Color.IndianRed;
|
||||||
|
this.PathErrorLabel.Location = new System.Drawing.Point(483, 513);
|
||||||
|
this.PathErrorLabel.Name = "PathErrorLabel";
|
||||||
|
this.PathErrorLabel.Size = new System.Drawing.Size(454, 25);
|
||||||
|
this.PathErrorLabel.TabIndex = 4;
|
||||||
|
this.PathErrorLabel.Text = "There is already a game following this path in the library";
|
||||||
|
this.PathErrorLabel.Visible = false;
|
||||||
|
//
|
||||||
// AddGameForm
|
// AddGameForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = System.Drawing.SystemColors.Window;
|
this.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.ClientSize = new System.Drawing.Size(1067, 554);
|
this.ClientSize = new System.Drawing.Size(1067, 554);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.PathErrorLabel);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
this.Controls.Add(this.groupBox2);
|
this.Controls.Add(this.groupBox2);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
@@ -209,7 +235,7 @@
|
|||||||
private Label label1;
|
private Label label1;
|
||||||
private GroupBox groupBox1;
|
private GroupBox groupBox1;
|
||||||
private GroupBox groupBox2;
|
private GroupBox groupBox2;
|
||||||
private Button button1;
|
private Button AddButton;
|
||||||
private TextBox LocationBox;
|
private TextBox LocationBox;
|
||||||
private TextBox NameBox;
|
private TextBox NameBox;
|
||||||
private Button pathButton;
|
private Button pathButton;
|
||||||
@@ -218,5 +244,7 @@
|
|||||||
private Label NoCoverLabel;
|
private Label NoCoverLabel;
|
||||||
private PictureBox CoverPicture;
|
private PictureBox CoverPicture;
|
||||||
private System.Windows.Forms.Timer timer1;
|
private System.Windows.Forms.Timer timer1;
|
||||||
|
private Label NameWarningLabel;
|
||||||
|
private Label PathErrorLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using IGDB;
|
using IGDB;
|
||||||
using IGDB.Models;
|
using IGDB.Models;
|
||||||
|
using OpenSaveCloudClient.Core;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudClient.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -18,6 +19,7 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private readonly IGDBClient? _client;
|
private readonly IGDBClient? _client;
|
||||||
private GameSave result;
|
private GameSave result;
|
||||||
|
private SaveManager saveManager;
|
||||||
|
|
||||||
public GameSave Result { get { return result; } }
|
public GameSave Result { get { return result; } }
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_client = iGDBClient;
|
_client = iGDBClient;
|
||||||
|
saveManager = SaveManager.GetInstance();
|
||||||
if (_client == null)
|
if (_client == null)
|
||||||
{
|
{
|
||||||
NoCoverLabel.Text = "IGDB is not configured";
|
NoCoverLabel.Text = "IGDB is not configured";
|
||||||
@@ -73,6 +76,7 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
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);
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
timer1.Stop();
|
timer1.Stop();
|
||||||
@@ -91,6 +95,16 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
NameBox.Text = path.Split(Path.DirectorySeparatorChar).Last();
|
NameBox.Text = path.Split(Path.DirectorySeparatorChar).Last();
|
||||||
}
|
}
|
||||||
|
bool exist = saveManager.Saves.Exists(g => g.FolderPath == path);
|
||||||
|
if (exist)
|
||||||
|
{
|
||||||
|
AddButton.Enabled = false;
|
||||||
|
PathErrorLabel.Visible = true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
AddButton.Enabled = true;
|
||||||
|
PathErrorLabel.Visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +127,16 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
NameBox.Text = LocationBox.Text.Split(Path.DirectorySeparatorChar).Last();
|
NameBox.Text = LocationBox.Text.Split(Path.DirectorySeparatorChar).Last();
|
||||||
}
|
}
|
||||||
|
if (NameWarningLabel.Enabled)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show(
|
||||||
|
"There is already a game with this name in the library. Would you like to add it anyway?",
|
||||||
|
"This name already exist",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question) == DialogResult.No) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
result = new GameSave(NameBox.Text, "", LocationBox.Text, null, 0);
|
result = new GameSave(NameBox.Text, "", LocationBox.Text, null, 0);
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
@@ -125,7 +149,7 @@ namespace OpenSaveCloudClient
|
|||||||
private void LockControls(bool value)
|
private void LockControls(bool value)
|
||||||
{
|
{
|
||||||
value = !value;
|
value = !value;
|
||||||
button1.Enabled = value;
|
AddButton.Enabled = value;
|
||||||
NameBox.Enabled = value;
|
NameBox.Enabled = value;
|
||||||
LocationBox.Enabled = value;
|
LocationBox.Enabled = value;
|
||||||
pathButton.Enabled = value;
|
pathButton.Enabled = value;
|
||||||
|
|||||||
@@ -58,6 +58,22 @@ namespace OpenSaveCloudClient.Core
|
|||||||
OnNewMessage(args);
|
OnNewMessage(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddWarning(string message)
|
||||||
|
{
|
||||||
|
Log log = new()
|
||||||
|
{
|
||||||
|
Message = message,
|
||||||
|
Severity = LogSeverity.Warning,
|
||||||
|
};
|
||||||
|
messages.Add(log);
|
||||||
|
NewMessageEventArgs args = new()
|
||||||
|
{
|
||||||
|
Message = message,
|
||||||
|
Severity = LogSeverity.Warning,
|
||||||
|
};
|
||||||
|
OnNewMessage(args);
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
messages.Clear();
|
messages.Clear();
|
||||||
|
|||||||
@@ -38,6 +38,21 @@ namespace OpenSaveCloudClient.Core
|
|||||||
return gameSave;
|
return gameSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public GameSave? GetByUuid(string uuid)
|
||||||
|
{
|
||||||
|
return saves.FirstOrDefault(g => g.Uuid == uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Set(GameSave gameSave)
|
||||||
|
{
|
||||||
|
GameSave? g = saves.FirstOrDefault(g => g.Uuid == gameSave.Uuid);
|
||||||
|
if (g != null)
|
||||||
|
{
|
||||||
|
saves.Remove(g);
|
||||||
|
}
|
||||||
|
saves.Add(gameSave);
|
||||||
|
}*/
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
{
|
{
|
||||||
string appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "osc");
|
string appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "osc");
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Text.Json;
|
|||||||
using OpenSaveCloudClient.Models.Remote;
|
using OpenSaveCloudClient.Models.Remote;
|
||||||
using OpenSaveCloudClient.Models;
|
using OpenSaveCloudClient.Models;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.IO.Compression;
|
||||||
|
|
||||||
namespace OpenSaveCloudClient.Core
|
namespace OpenSaveCloudClient.Core
|
||||||
{
|
{
|
||||||
@@ -189,55 +190,46 @@ namespace OpenSaveCloudClient.Core
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Synchronize()
|
public async void Synchronize()
|
||||||
{
|
{
|
||||||
string appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "osc");
|
string appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "osc");
|
||||||
string cachePath = Path.Combine(appdata, "cache");
|
string cachePath = Path.Combine(appdata, "cache");
|
||||||
logManager.AddInformation("Starting synchronization");
|
logManager.AddInformation("Starting synchronization");
|
||||||
List<GameSave> games = saveManager.Saves;
|
List<GameSave> games = saveManager.Saves;
|
||||||
string uuidTask = taskManager.StartTask("Synchronizing games", true, games.Count);
|
string uuidTask = taskManager.StartTask("Synchronizing games", true, games.Count);
|
||||||
|
List<GameSave> toUpload = new();
|
||||||
|
List<GameSave> toDownload = new();
|
||||||
foreach (GameSave game in games)
|
foreach (GameSave game in games)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
game.Archive();
|
||||||
Game? g = GetGameInfoByID(game.Id);
|
Game? g = GetGameInfoByID(game.Id);
|
||||||
if (g != null)
|
if (g != null)
|
||||||
{
|
{
|
||||||
if (g.Available)
|
if (g.Available)
|
||||||
{
|
{
|
||||||
if (g.Hash != game.Hash)
|
if (g.Revision > game.Revision)
|
||||||
{
|
{
|
||||||
if (g.Revision != game.Revision)
|
toDownload.Add(game);
|
||||||
{
|
}
|
||||||
logManager.AddInformation(String.Format("'{0}' was updated from another computer", game.Name));
|
else if (g.Revision < game.Revision)
|
||||||
} else
|
{
|
||||||
{
|
logManager.AddWarning(String.Format("Revision are the same, maybe uploaded by another computer ({0})", game.Name));
|
||||||
logManager.AddInformation(String.Format("'{0} need to be updated'", game.Name));
|
logManager.AddInformation("To resolve this conflict, force download or force upload from the game detail screen");
|
||||||
GameUploadToken? gut = LockGameToUpload(game.Id);
|
}
|
||||||
if (gut != null)
|
|
||||||
{
|
|
||||||
string archivePath = Path.Combine(cachePath, game.Uuid + ".bin");
|
|
||||||
UploadSave(gut.UploadToken, archivePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logManager.AddInformation(String.Format("'{0}' is up to date", game.Name));
|
toUpload.Add(game);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
logManager.AddInformation(String.Format("First upload of '{0}'", game.Name));
|
logManager.AddInformation(String.Format("First upload of '{0}'", game.Name));
|
||||||
GameUploadToken? gut = LockGameToUpload(game.Id);
|
toUpload.Add(game);
|
||||||
if (gut != null)
|
|
||||||
{
|
|
||||||
string archivePath = Path.Combine(cachePath, game.Uuid + ".bin");
|
|
||||||
UploadSave(gut.UploadToken, archivePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
logManager.AddError(new Exception("Failed to get game information, the save will not be synchronized"));
|
logManager.AddWarning(String.Format("'{0}' is not found on this server, force upload it from the game detail screen", game.Name));
|
||||||
}
|
}
|
||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -245,6 +237,29 @@ namespace OpenSaveCloudClient.Core
|
|||||||
}
|
}
|
||||||
taskManager.UpdateTaskProgress(uuidTask, 1);
|
taskManager.UpdateTaskProgress(uuidTask, 1);
|
||||||
}
|
}
|
||||||
|
foreach (GameSave game in toUpload)
|
||||||
|
{
|
||||||
|
GameUploadToken? gut = LockGameToUpload(game.Id);
|
||||||
|
if (gut != null)
|
||||||
|
{
|
||||||
|
string archivePath = Path.Combine(cachePath, game.Uuid + ".bin");
|
||||||
|
UploadSave(gut.UploadToken, archivePath);
|
||||||
|
UpdateCache(game.Id, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (GameSave game in toDownload)
|
||||||
|
{
|
||||||
|
GameUploadToken? gut = LockGameToUpload(game.Id);
|
||||||
|
if (gut != null)
|
||||||
|
{
|
||||||
|
string archivePath = Path.Combine(cachePath, game.Uuid + ".bin");
|
||||||
|
if (await DownloadSaveAsync(gut.UploadToken, archivePath, game.FolderPath))
|
||||||
|
{
|
||||||
|
UpdateCache(game.Id, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveManager.Save();
|
||||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +271,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
HttpClient client = new HttpClient();
|
HttpClient client = new HttpClient();
|
||||||
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
||||||
HttpResponseMessage response = client.GetAsync(string.Format("{0}:{1}/api/v1/game/{2}", host, port, gameId)).Result;
|
HttpResponseMessage response = client.GetAsync(string.Format("{0}:{1}/api/v1/game/info/{2}", host, port, gameId)).Result;
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
string responseText = response.Content.ReadAsStringAsync().Result;
|
string responseText = response.Content.ReadAsStringAsync().Result;
|
||||||
@@ -281,16 +296,17 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
logManager.AddInformation("Uploading save");
|
logManager.AddInformation("Uploading save");
|
||||||
string uuidTask = taskManager.StartTask("Uploading", true, 1);
|
string uuidTask = taskManager.StartTask("Uploading", true, 1);
|
||||||
|
FileStream stream = File.OpenRead(filePath);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MultipartFormDataContent multipartFormContent = new();
|
MultipartFormDataContent multipartFormContent = new();
|
||||||
var fileStreamContent = new StreamContent(File.OpenRead(filePath));
|
var fileStreamContent = new StreamContent(stream);
|
||||||
fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
||||||
multipartFormContent.Add(fileStreamContent, name: "file", fileName: "file.bin");
|
multipartFormContent.Add(fileStreamContent, name: "file", fileName: "file.bin");
|
||||||
|
|
||||||
HttpClient client = new HttpClient();
|
HttpClient client = new HttpClient();
|
||||||
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);
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -307,6 +323,65 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
logManager.AddError(ex);
|
logManager.AddError(ex);
|
||||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||||
|
} finally
|
||||||
|
{
|
||||||
|
stream.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DownloadSaveAsync(string uploadToken, string filePath, string unzipPath)
|
||||||
|
{
|
||||||
|
logManager.AddInformation("Downloading save");
|
||||||
|
string uuidTask = taskManager.StartTask("Downloading", true, 1);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
||||||
|
client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken);
|
||||||
|
HttpResponseMessage response = client.GetAsync(string.Format("{0}:{1}/api/v1/game/download", host, port)).Result;
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
using (var fs = new FileStream(filePath, FileMode.Create))
|
||||||
|
{
|
||||||
|
await response.Content.CopyToAsync(fs);
|
||||||
|
}
|
||||||
|
if (Directory.Exists(unzipPath))
|
||||||
|
{
|
||||||
|
Directory.Delete(unzipPath, true);
|
||||||
|
}
|
||||||
|
ZipFile.ExtractToDirectory(filePath, unzipPath);
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logManager.AddError(new Exception(String.Format("Received HTTP Status {0} from the server", response.StatusCode.ToString())));
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logManager.AddError(ex);
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateCache(int gameId, GameSave gameSave)
|
||||||
|
{
|
||||||
|
string uuidTask = taskManager.StartTask("Updating cache", true, 1);
|
||||||
|
Game? game = GetGameInfoByID(gameId);
|
||||||
|
if (game != null)
|
||||||
|
{
|
||||||
|
gameSave.Revision = game.Revision;
|
||||||
|
gameSave.LocalOnly = false;
|
||||||
|
gameSave.Synced = true;
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logManager.AddError(new Exception("Failed to get game information"));
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +450,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
private void GetServerInformation()
|
private void GetServerInformation()
|
||||||
{
|
{
|
||||||
logManager.AddInformation("Getting server information");
|
logManager.AddInformation("Getting server information");
|
||||||
|
string uuidTask = taskManager.StartTask("Getting server information", true, 1);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpClient client = new();
|
HttpClient client = new();
|
||||||
@@ -387,6 +463,8 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
logManager.AddInformation("Server is connected");
|
logManager.AddInformation("Server is connected");
|
||||||
bind = true;
|
bind = true;
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,6 +472,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
logManager.AddError(ex);
|
logManager.AddError(ex);
|
||||||
}
|
}
|
||||||
|
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveToConfig()
|
private void SaveToConfig()
|
||||||
|
|||||||
4
OpenSaveCloudClient/GameLibraryForm.Designer.cs
generated
4
OpenSaveCloudClient/GameLibraryForm.Designer.cs
generated
@@ -100,6 +100,7 @@
|
|||||||
// AddButton
|
// AddButton
|
||||||
//
|
//
|
||||||
this.AddButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.AddButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.AddButton.Enabled = false;
|
||||||
this.AddButton.Image = ((System.Drawing.Image)(resources.GetObject("AddButton.Image")));
|
this.AddButton.Image = ((System.Drawing.Image)(resources.GetObject("AddButton.Image")));
|
||||||
this.AddButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
this.AddButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
this.AddButton.Name = "AddButton";
|
this.AddButton.Name = "AddButton";
|
||||||
@@ -110,6 +111,7 @@
|
|||||||
// SyncButton
|
// SyncButton
|
||||||
//
|
//
|
||||||
this.SyncButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.SyncButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.SyncButton.Enabled = false;
|
||||||
this.SyncButton.Image = ((System.Drawing.Image)(resources.GetObject("SyncButton.Image")));
|
this.SyncButton.Image = ((System.Drawing.Image)(resources.GetObject("SyncButton.Image")));
|
||||||
this.SyncButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
this.SyncButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
this.SyncButton.Name = "SyncButton";
|
this.SyncButton.Name = "SyncButton";
|
||||||
@@ -140,6 +142,7 @@
|
|||||||
// LogoutButton
|
// LogoutButton
|
||||||
//
|
//
|
||||||
this.LogoutButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.LogoutButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.LogoutButton.Enabled = false;
|
||||||
this.LogoutButton.Image = ((System.Drawing.Image)(resources.GetObject("LogoutButton.Image")));
|
this.LogoutButton.Image = ((System.Drawing.Image)(resources.GetObject("LogoutButton.Image")));
|
||||||
this.LogoutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
this.LogoutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
this.LogoutButton.Name = "LogoutButton";
|
this.LogoutButton.Name = "LogoutButton";
|
||||||
@@ -160,6 +163,7 @@
|
|||||||
// AboutButton
|
// AboutButton
|
||||||
//
|
//
|
||||||
this.AboutButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.AboutButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.AboutButton.Enabled = false;
|
||||||
this.AboutButton.Image = ((System.Drawing.Image)(resources.GetObject("AboutButton.Image")));
|
this.AboutButton.Image = ((System.Drawing.Image)(resources.GetObject("AboutButton.Image")));
|
||||||
this.AboutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
this.AboutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
this.AboutButton.Name = "AboutButton";
|
this.AboutButton.Name = "AboutButton";
|
||||||
|
|||||||
@@ -21,20 +21,22 @@ namespace OpenSaveCloudClient
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
saveManager = SaveManager.GetInstance();
|
saveManager = SaveManager.GetInstance();
|
||||||
taskManager = TaskManager.GetInstance();
|
taskManager = TaskManager.GetInstance();
|
||||||
taskManager.TaskChanged += taskManager_TaskChanged;
|
|
||||||
serverConnector = ServerConnector.GetInstance();
|
serverConnector = ServerConnector.GetInstance();
|
||||||
_configuration = Configuration.GetInstance();
|
_configuration = Configuration.GetInstance();
|
||||||
logManager = LogManager.GetInstance();
|
logManager = LogManager.GetInstance();
|
||||||
if (_configuration.GetBoolean("igdb.enabled", false))
|
/*if (_configuration.GetBoolean("igdb.enabled", false))
|
||||||
{
|
{
|
||||||
string clientId = _configuration.GetString("igdb.client_id", "");
|
string clientId = _configuration.GetString("igdb.client_id", "");
|
||||||
string clientSecret = _configuration.GetString("igdb.client_secret", "");
|
string clientSecret = _configuration.GetString("igdb.client_secret", "");
|
||||||
_client = new IGDBClient(clientId, clientSecret);
|
_client = new IGDBClient(clientId, clientSecret);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameLibrary_Load(object sender, EventArgs e)
|
private void GameLibrary_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
taskManager.TaskChanged += taskManager_TaskChanged;
|
||||||
|
logManager.Cleared += LogManager_LogCleared;
|
||||||
|
logManager.NewMessage += LogManager_NewMessage;
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
serverConnector.Reconnect();
|
serverConnector.Reconnect();
|
||||||
@@ -44,8 +46,22 @@ namespace OpenSaveCloudClient
|
|||||||
ShowLoginForm();
|
ShowLoginForm();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
AddButton.Enabled = true;
|
||||||
|
LogoutButton.Enabled = true;
|
||||||
|
AboutButton.Enabled = true;
|
||||||
|
if (_configuration.GetBoolean("synchronization.at_login", true))
|
||||||
|
{
|
||||||
|
SyncButton_Click(sender, e);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
SyncButton.Enabled = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}).Start();
|
}).Start();
|
||||||
|
|
||||||
RefreshList();
|
RefreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +81,17 @@ namespace OpenSaveCloudClient
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
AddButton.Enabled = true;
|
||||||
|
LogoutButton.Enabled = true;
|
||||||
|
AboutButton.Enabled = true;
|
||||||
|
if (_configuration.GetBoolean("synchronization.at_login", true))
|
||||||
|
{
|
||||||
|
SyncButton_Click(sender, e);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SyncButton.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +120,10 @@ namespace OpenSaveCloudClient
|
|||||||
SetTaskEnded(taskUuid);
|
SetTaskEnded(taskUuid);
|
||||||
this.Invoke((MethodInvoker)delegate {
|
this.Invoke((MethodInvoker)delegate {
|
||||||
RefreshList();
|
RefreshList();
|
||||||
|
if (_configuration.GetBoolean("synchronization.at_game_creation", true))
|
||||||
|
{
|
||||||
|
SyncButton_Click(null, null);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -170,12 +201,26 @@ namespace OpenSaveCloudClient
|
|||||||
text = String.Format("Ended: {0}", e.TaskInformation.Label);
|
text = String.Format("Ended: {0}", e.TaskInformation.Label);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toolStripStatusLabel1.Text = text;
|
if (taskManager.TasksInformation.Count > 1)
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
toolStripStatusLabel1.Text = String.Format("{0} (and {1} more)", text, taskManager.TasksInformation.Count);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
toolStripStatusLabel1.Text = text;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogoutButton_Click(object sender, EventArgs e)
|
private void LogoutButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
serverConnector.Logout();
|
serverConnector.Logout();
|
||||||
|
AddButton.Enabled = false;
|
||||||
|
LogoutButton.Enabled = false;
|
||||||
|
AboutButton.Enabled = false;
|
||||||
ShowLoginForm();
|
ShowLoginForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +236,40 @@ namespace OpenSaveCloudClient
|
|||||||
form.Show();
|
form.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LogManager_NewMessage(object? sender, NewMessageEventArgs e)
|
||||||
|
{
|
||||||
|
int errors = logManager.Messages.Count(m => m.Severity == LogSeverity.Error);
|
||||||
|
int warnings = logManager.Messages.Count(m => m.Severity == LogSeverity.Warning);
|
||||||
|
string label = "";
|
||||||
|
if (errors > 0)
|
||||||
|
{
|
||||||
|
label = String.Format("({0} errors)", errors);
|
||||||
|
}
|
||||||
|
if (warnings > 0)
|
||||||
|
{
|
||||||
|
if (errors > 0)
|
||||||
|
{
|
||||||
|
label += " ";
|
||||||
|
}
|
||||||
|
label = String.Format("({0} warnings)", warnings);
|
||||||
|
}
|
||||||
|
if (errors > 0 || warnings > 0)
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
ErrorLogButton.Text = label;
|
||||||
|
ErrorLogButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogManager_LogCleared(object? sender, ClearEventArgs e)
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
ErrorLogButton.Text = "Show logs";
|
||||||
|
ErrorLogButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void toolStripDropDownButton1_Click(object sender, EventArgs e)
|
private void toolStripDropDownButton1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TasksForm form = new();
|
TasksForm form = new();
|
||||||
@@ -199,7 +278,13 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void SyncButton_Click(object sender, EventArgs e)
|
private void SyncButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
new Thread(() => serverConnector.Synchronize()).Start();
|
SyncButton.Enabled = false;
|
||||||
|
new Thread(() => {
|
||||||
|
serverConnector.Synchronize();
|
||||||
|
this.Invoke((MethodInvoker)delegate {
|
||||||
|
SyncButton.Enabled = true;
|
||||||
|
});
|
||||||
|
}).Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,19 +64,16 @@
|
|||||||
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAALLSURBVGhD7ZgLTQRBEERPAhKQgAQkIAEJOEACEpCABCQg
|
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIBSURBVGhD7ZgLTQUxEEVXAhKQgAQkIAUHSEACEpCABCQg
|
||||||
AQlIgH7kmgyz1fPfuwuhkgqBnemp/u4sh3/8EVwZb42Pxlfjm/Hd+GH8PP7k9xfjk/HOyJ6zwkU/G11o
|
AQkwJ9mSpplOp7v9LXk3uXnJ27bz2flttxv+Oe7230vgUfgi/BB+Cr93/uy//PcufBWydgmgCAqhHIrW
|
||||||
L3H23nhyIJwoK1GjJDO7Yw/hKbF9Y8xBtqcz9WAcLZUecsa10YF4eodnQ1nCABvzgxRpVNZCHKZZIdHz
|
kr33wuFAKMKDh8/yTTjEEGK6peIpObsbUJ4Y1gS3JOHYPPkfhF9CTWAPIguZTcBBvULGIjJPG8GrHOn5
|
||||||
Blf7nIhnvSMV7+T3ZigDOTkUcSr1ERCJs7mdmngngWhCKfIcSJQ5aBTuSI942FRKiFObIRFI63QWafaW
|
lBhxOJxGxXyJ9JVDoClpB84gZbYK1OQZcW+xqk9gsXbITBLOLjAeaAesQFdVWin2U7pyYWbZLJG8NMEr
|
||||||
iCcaRCUyMBP1EpaIB1GzNRsYwDLxRF8ZYEZffOQxpF5UlNPFiwdR9BmTe6BXPIOl+EZWxhhze0R/RDyV
|
0jauxCdhFiuHT6AZRis0rhLNxsZDbVNK1nlyxbuO2PbKNvOgJIzNcSmzQi6OVas08w0Q5h1PDpoG8FDb
|
||||||
wB4JDKrJs0f0R8X7cxnQqHxWznswKx7KMiLS6SJIQ69Er3iQXzmgLCNlWBkcxYh4wAdTvnaJAwji+6AF
|
FJh+cCBYW8dMn0JzDvLSYc3TRLMDXsmANIE4SNuDsim0ENG86Skk2bGiZADP483PQm0djEONcNLWQBQO
|
||||||
o+KBqgyysoFKVWlkeWRqHxoz4oHqTXpiA+UAmxXytEZOzIoH0XDB9i+oEaocUDUJcydWiAeUqdq/gbpC
|
yDkkZRbe2wWqlWctXvesYw1nepTX3u4fLl9GSVJt00o0by4uP0oAT+OZRXIkW0IDVg4j10fNymHkvhRe
|
||||||
MMJSIEqtc7oTq8QDbOb7ZQ+oG6h6idWcwOlV4gH2chtyvDePK0PNiYi94gF7cjvyk1ItlN1+RK8TI+KB
|
sRq5vB9As9IOmcnqK/mVPuzN0pkD2e7tzD2JDsXKk8Ps+yFkxzPVIcy6ZkH5YtPyYrQRTZUPIJxG5AQy
|
||||||
qgyCvcHIVaLViVHx2Ff25HSMFueNnKPmxKh4oBqYqgiDqvqgVEaOyIkZ8ZHNqC+/oTyGLVfq/MAZ8UBN
|
svN+C/SqTnidWn84YWtAYrU0hBH5dLIewRlDgserG1QvkHQ0HLyZTrQoG766WIPhQ0KlBS6j6A312LZf
|
||||||
H1jUggj1Ri6mLYE7MSs+0sHfeFZElAWEnQIIjN4jtX78gfIeyvm7GGRPnd0UfUc0UmGxiSaAuEg8lKOz
|
a0cxhaBwZhAAAAAASUVORK5CYII=
|
||||||
hOjSBimn5mg0oFQ2cLinov/QOf3yNgqEYyMqWSjfuq3gADWLU3I4zdWTEdZSEjXbSzKNgVomnKwj3cxq
|
|
||||||
IstdHqEQJ3lWE+3E1rT4FKUGW03OWireQSRL9TpLbM/2VRMoh5WO8Kbv7aMl4NDW/siJaPaeRbgC5UXt
|
|
||||||
Igp6hhAKaV5mPWORMrkI0f+Yw+HwBfyyJB+LA9gZAAAAAElFTkSuQmCC
|
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
@@ -170,7 +167,7 @@
|
|||||||
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
||||||
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
||||||
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA7OMCAAJNU0Z0AUkBTAMBAQAB
|
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA7OMCAAJNU0Z0AUkBTAMBAQAB
|
||||||
eAEAAXgBAAEIAQEBdgEBBP8BGQEACP8BQgFNATYHAAE2AwABKAMAASABBAIAAXYBAQIAAQEBAAEYBQAB
|
iAEAAYgBAAEIAQEBdgEBBP8BGQEACP8BQgFNATYHAAE2AwABKAMAASABBAIAAXYBAQIAAQEBAAEYBQAB
|
||||||
QAEUARIRAANSA1EBUgFRBVICUQNSAlEDUgJRAVIEUQFSBVEBUg1RAVAIUQFQAlEBUAFRAVADUQFQAVEE
|
QAEUARIRAANSA1EBUgFRBVICUQNSAlEDUgJRAVIEUQFSBVEBUg1RAVAIUQFQAlEBUAFRAVADUQFQAVEE
|
||||||
UAFRAVABUQJQAVECUAFRAVABUQ5QAU8BUAFPAlADTwZQAU8BUAFPAVADTwNQAU8CUAZPAVABTwFQBU8B
|
UAFRAVABUQJQAVECUAFRAVABUQ5QAU8BUAFPAlADTwZQAU8BUAFPAVADTwNQAU8CUAZPAVABTwFQBU8B
|
||||||
UAZPAU4ETwFOBE8BTgVPAU4DTwJOBE8CTgJPAU4BTwFOAU8HTgFPCE4BTwdOAU0GTgJNBE4BTQNOAk0B
|
UAZPAU4ETwFOBE8BTgVPAU4DTwJOBE8CTgJPAU4BTwFOAU8HTgFPCE4BTwdOAU0GTgJNBE4BTQNOAk0B
|
||||||
|
|||||||
@@ -33,20 +33,11 @@ namespace OpenSaveCloudClient
|
|||||||
{
|
{
|
||||||
this.Invoke((MethodInvoker)delegate
|
this.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
UpdateList();
|
ListViewItem lvi = listView1.Items.Add(e.Message);
|
||||||
|
lvi.SubItems.Add(e.Severity.ToString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateList()
|
|
||||||
{
|
|
||||||
listView1.Items.Clear();
|
|
||||||
foreach (Log l in logManager.Messages)
|
|
||||||
{
|
|
||||||
ListViewItem lvi = listView1.Items.Add(l.Message);
|
|
||||||
lvi.SubItems.Add(l.Severity.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LogForm_FormClosed(object sender, FormClosedEventArgs e)
|
private void LogForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
logManager.NewMessage -= logManager_NewError;
|
logManager.NewMessage -= logManager_NewError;
|
||||||
@@ -54,7 +45,11 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void LogsForm_Load(object sender, EventArgs e)
|
private void LogsForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateList();
|
foreach (Log l in logManager.Messages)
|
||||||
|
{
|
||||||
|
ListViewItem lvi = listView1.Items.Add(l.Message);
|
||||||
|
lvi.SubItems.Add(l.Severity.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient.Models
|
|||||||
private readonly string description;
|
private readonly string description;
|
||||||
private string hash;
|
private string hash;
|
||||||
private readonly string? coverPath;
|
private readonly string? coverPath;
|
||||||
private readonly int revision;
|
private int revision;
|
||||||
private bool synced;
|
private bool synced;
|
||||||
private bool localOnly;
|
private bool localOnly;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ namespace OpenSaveCloudClient.Models
|
|||||||
public string FolderPath { get { return folderPath; } }
|
public string FolderPath { get { return folderPath; } }
|
||||||
public string Hash { get { return hash; } }
|
public string Hash { get { return hash; } }
|
||||||
public string? CoverPath { get { return coverPath; } }
|
public string? CoverPath { get { return coverPath; } }
|
||||||
public int Revision { get { return revision; } }
|
public int Revision { get { return revision; } set { revision = value; } }
|
||||||
public bool Synced { get { return synced; } set { synced = value; } }
|
public bool Synced { get { return synced; } set { synced = value; } }
|
||||||
public bool LocalOnly { get { return localOnly; } set { localOnly = value; } }
|
public bool LocalOnly { get { return localOnly; } set { localOnly = value; } }
|
||||||
|
|
||||||
@@ -76,10 +76,14 @@ namespace OpenSaveCloudClient.Models
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(cachePath);
|
Directory.CreateDirectory(cachePath);
|
||||||
}
|
}
|
||||||
ZipFile.CreateFromDirectory(folderPath, archivePath, CompressionLevel.SmallestSize, true);
|
if (File.Exists(archivePath))
|
||||||
|
{
|
||||||
|
File.Delete(archivePath);
|
||||||
|
}
|
||||||
|
ZipFile.CreateFromDirectory(folderPath, archivePath, CompressionLevel.SmallestSize, false);
|
||||||
using (var md5 = MD5.Create())
|
using (var md5 = MD5.Create())
|
||||||
{
|
{
|
||||||
using (var stream = File.OpenRead(archivePath))
|
using (FileStream stream = File.OpenRead(archivePath))
|
||||||
{
|
{
|
||||||
var h = md5.ComputeHash(stream);
|
var h = md5.ComputeHash(stream);
|
||||||
hash = BitConverter.ToString(h).Replace("-", "").ToLowerInvariant();
|
hash = BitConverter.ToString(h).Replace("-", "").ToLowerInvariant();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace OpenSaveCloudClient.Models.Remote
|
|||||||
[JsonPropertyName("name")]
|
[JsonPropertyName("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("revision")]
|
[JsonPropertyName("rev")]
|
||||||
public int Revision { get; set; }
|
public int Revision { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("hash")]
|
[JsonPropertyName("hash")]
|
||||||
|
|||||||
55
OpenSaveCloudClient/SettingsForm.Designer.cs
generated
55
OpenSaveCloudClient/SettingsForm.Designer.cs
generated
@@ -40,7 +40,11 @@
|
|||||||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.AtCreationCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
|
this.AtLoginCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
this.groupBox2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@@ -108,6 +112,7 @@
|
|||||||
// IgdbCheckBox
|
// IgdbCheckBox
|
||||||
//
|
//
|
||||||
this.IgdbCheckBox.AutoSize = true;
|
this.IgdbCheckBox.AutoSize = true;
|
||||||
|
this.IgdbCheckBox.Enabled = false;
|
||||||
this.IgdbCheckBox.Location = new System.Drawing.Point(6, 293);
|
this.IgdbCheckBox.Location = new System.Drawing.Point(6, 293);
|
||||||
this.IgdbCheckBox.Name = "IgdbCheckBox";
|
this.IgdbCheckBox.Name = "IgdbCheckBox";
|
||||||
this.IgdbCheckBox.Size = new System.Drawing.Size(135, 29);
|
this.IgdbCheckBox.Size = new System.Drawing.Size(135, 29);
|
||||||
@@ -146,7 +151,7 @@
|
|||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
this.button1.Location = new System.Drawing.Point(383, 582);
|
this.button1.Location = new System.Drawing.Point(383, 767);
|
||||||
this.button1.Name = "button1";
|
this.button1.Name = "button1";
|
||||||
this.button1.Size = new System.Drawing.Size(112, 34);
|
this.button1.Size = new System.Drawing.Size(112, 34);
|
||||||
this.button1.TabIndex = 2;
|
this.button1.TabIndex = 2;
|
||||||
@@ -154,27 +159,64 @@
|
|||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
// Settings
|
// groupBox2
|
||||||
|
//
|
||||||
|
this.groupBox2.Controls.Add(this.AtCreationCheckBox);
|
||||||
|
this.groupBox2.Controls.Add(this.AtLoginCheckBox);
|
||||||
|
this.groupBox2.Location = new System.Drawing.Point(12, 564);
|
||||||
|
this.groupBox2.Name = "groupBox2";
|
||||||
|
this.groupBox2.Size = new System.Drawing.Size(483, 122);
|
||||||
|
this.groupBox2.TabIndex = 3;
|
||||||
|
this.groupBox2.TabStop = false;
|
||||||
|
this.groupBox2.Text = "Auto synchronization";
|
||||||
|
//
|
||||||
|
// AtCreationCheckBox
|
||||||
|
//
|
||||||
|
this.AtCreationCheckBox.AutoSize = true;
|
||||||
|
this.AtCreationCheckBox.Checked = true;
|
||||||
|
this.AtCreationCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.AtCreationCheckBox.Location = new System.Drawing.Point(6, 80);
|
||||||
|
this.AtCreationCheckBox.Name = "AtCreationCheckBox";
|
||||||
|
this.AtCreationCheckBox.Size = new System.Drawing.Size(254, 29);
|
||||||
|
this.AtCreationCheckBox.TabIndex = 1;
|
||||||
|
this.AtCreationCheckBox.Text = "After creating a game entry";
|
||||||
|
this.AtCreationCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// AtLoginCheckBox
|
||||||
|
//
|
||||||
|
this.AtLoginCheckBox.AutoSize = true;
|
||||||
|
this.AtLoginCheckBox.Checked = true;
|
||||||
|
this.AtLoginCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.AtLoginCheckBox.Location = new System.Drawing.Point(6, 45);
|
||||||
|
this.AtLoginCheckBox.Name = "AtLoginCheckBox";
|
||||||
|
this.AtLoginCheckBox.Size = new System.Drawing.Size(122, 29);
|
||||||
|
this.AtLoginCheckBox.TabIndex = 0;
|
||||||
|
this.AtLoginCheckBox.Text = "After login";
|
||||||
|
this.AtLoginCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// SettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = System.Drawing.SystemColors.Window;
|
this.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.ClientSize = new System.Drawing.Size(507, 628);
|
this.ClientSize = new System.Drawing.Size(507, 813);
|
||||||
|
this.Controls.Add(this.groupBox2);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.button1);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MaximumSize = new System.Drawing.Size(529, 684);
|
|
||||||
this.MinimumSize = new System.Drawing.Size(529, 684);
|
this.MinimumSize = new System.Drawing.Size(529, 684);
|
||||||
this.Name = "Settings";
|
this.Name = "SettingsForm";
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Settings";
|
this.Text = "Settings";
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
this.groupBox2.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -193,5 +235,8 @@
|
|||||||
private Label label3;
|
private Label label3;
|
||||||
private LinkLabel linkLabel1;
|
private LinkLabel linkLabel1;
|
||||||
private Button button1;
|
private Button button1;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private CheckBox AtCreationCheckBox;
|
||||||
|
private CheckBox AtLoginCheckBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,9 +25,11 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void InitAndFillFields()
|
private void InitAndFillFields()
|
||||||
{
|
{
|
||||||
IgdbCheckBox.Checked = _configuration.GetBoolean("igdb.enabled", false);
|
IgdbCheckBox.Checked = false; //_configuration.GetBoolean("igdb.enabled", false);
|
||||||
IgdbClientID.Text = _configuration.GetString("igdb.client_id", "");
|
IgdbClientID.Text = _configuration.GetString("igdb.client_id", "");
|
||||||
IgdbClientSecret.Text = _configuration.GetString("igdb.client_secret", "");
|
IgdbClientSecret.Text = _configuration.GetString("igdb.client_secret", "");
|
||||||
|
AtLoginCheckBox.Checked = _configuration.GetBoolean("synchronization.at_login", true);
|
||||||
|
AtCreationCheckBox.Checked = _configuration.GetBoolean("synchronization.at_game_creation", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IgdbCheckBox_CheckedChanged(object sender, EventArgs e)
|
private void IgdbCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||||
@@ -41,6 +43,8 @@ namespace OpenSaveCloudClient
|
|||||||
_configuration.SetValue("igdb.enabled", IgdbCheckBox.Checked);
|
_configuration.SetValue("igdb.enabled", IgdbCheckBox.Checked);
|
||||||
_configuration.SetValue("igdb.client_id", IgdbClientID.Text);
|
_configuration.SetValue("igdb.client_id", IgdbClientID.Text);
|
||||||
_configuration.SetValue("igdb.client_secret", IgdbClientSecret.Text);
|
_configuration.SetValue("igdb.client_secret", IgdbClientSecret.Text);
|
||||||
|
_configuration.SetValue("synchronization.at_login", AtLoginCheckBox.Checked);
|
||||||
|
_configuration.SetValue("synchronization.at_game_creation", AtCreationCheckBox.Checked);
|
||||||
_configuration.Flush();
|
_configuration.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
OpenSaveCloudClient/TasksForm.Designer.cs
generated
10
OpenSaveCloudClient/TasksForm.Designer.cs
generated
@@ -33,7 +33,6 @@
|
|||||||
this.Task = new System.Windows.Forms.ColumnHeader();
|
this.Task = new System.Windows.Forms.ColumnHeader();
|
||||||
this.Status = new System.Windows.Forms.ColumnHeader();
|
this.Status = new System.Windows.Forms.ColumnHeader();
|
||||||
this.Progress = new System.Windows.Forms.ColumnHeader();
|
this.Progress = new System.Windows.Forms.ColumnHeader();
|
||||||
this.uuid = new System.Windows.Forms.ColumnHeader();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// listView1
|
// listView1
|
||||||
@@ -41,8 +40,7 @@
|
|||||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
this.Task,
|
this.Task,
|
||||||
this.Status,
|
this.Status,
|
||||||
this.Progress,
|
this.Progress});
|
||||||
this.uuid});
|
|
||||||
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.listView1.Location = new System.Drawing.Point(0, 0);
|
this.listView1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.listView1.MultiSelect = false;
|
this.listView1.MultiSelect = false;
|
||||||
@@ -67,11 +65,6 @@
|
|||||||
this.Progress.Text = "Progress";
|
this.Progress.Text = "Progress";
|
||||||
this.Progress.Width = 200;
|
this.Progress.Width = 200;
|
||||||
//
|
//
|
||||||
// uuid
|
|
||||||
//
|
|
||||||
this.uuid.Text = "UUID";
|
|
||||||
this.uuid.Width = 0;
|
|
||||||
//
|
|
||||||
// TasksForm
|
// TasksForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
@@ -93,7 +86,6 @@
|
|||||||
private ListView listView1;
|
private ListView listView1;
|
||||||
private ColumnHeader Task;
|
private ColumnHeader Task;
|
||||||
private ColumnHeader Progress;
|
private ColumnHeader Progress;
|
||||||
private ColumnHeader uuid;
|
|
||||||
private ColumnHeader Status;
|
private ColumnHeader Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user