diff --git a/.vs/OpenSaveCloudClient/DesignTimeBuild/.dtbcache.v2 b/.vs/OpenSaveCloudClient/DesignTimeBuild/.dtbcache.v2 index 19e6f1c..f494b4a 100644 Binary files a/.vs/OpenSaveCloudClient/DesignTimeBuild/.dtbcache.v2 and b/.vs/OpenSaveCloudClient/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/OpenSaveCloudClient/FileContentIndex/4294e2fc-fb72-4287-9d0e-dc8b3a84c3ce.vsidx b/.vs/OpenSaveCloudClient/FileContentIndex/4294e2fc-fb72-4287-9d0e-dc8b3a84c3ce.vsidx new file mode 100644 index 0000000..bef1d1f Binary files /dev/null and b/.vs/OpenSaveCloudClient/FileContentIndex/4294e2fc-fb72-4287-9d0e-dc8b3a84c3ce.vsidx differ diff --git a/.vs/OpenSaveCloudClient/FileContentIndex/05d238f9-f592-4654-b2b7-234e7aaeb830.vsidx b/.vs/OpenSaveCloudClient/FileContentIndex/a00d43d9-cc0b-42bf-b292-7c4296950020.vsidx similarity index 73% rename from .vs/OpenSaveCloudClient/FileContentIndex/05d238f9-f592-4654-b2b7-234e7aaeb830.vsidx rename to .vs/OpenSaveCloudClient/FileContentIndex/a00d43d9-cc0b-42bf-b292-7c4296950020.vsidx index 9ce9193..2a5bf64 100644 Binary files a/.vs/OpenSaveCloudClient/FileContentIndex/05d238f9-f592-4654-b2b7-234e7aaeb830.vsidx and b/.vs/OpenSaveCloudClient/FileContentIndex/a00d43d9-cc0b-42bf-b292-7c4296950020.vsidx differ diff --git a/.vs/OpenSaveCloudClient/FileContentIndex/b89a2528-5c7e-4956-807b-b5c9481cde0c.vsidx b/.vs/OpenSaveCloudClient/FileContentIndex/b89a2528-5c7e-4956-807b-b5c9481cde0c.vsidx deleted file mode 100644 index f8b0da5..0000000 Binary files a/.vs/OpenSaveCloudClient/FileContentIndex/b89a2528-5c7e-4956-807b-b5c9481cde0c.vsidx and /dev/null differ diff --git a/.vs/OpenSaveCloudClient/FileContentIndex/c5381d0b-5965-49f8-b118-b6bbc6639102.vsidx b/.vs/OpenSaveCloudClient/FileContentIndex/c5381d0b-5965-49f8-b118-b6bbc6639102.vsidx deleted file mode 100644 index f053cf9..0000000 Binary files a/.vs/OpenSaveCloudClient/FileContentIndex/c5381d0b-5965-49f8-b118-b6bbc6639102.vsidx and /dev/null differ diff --git a/.vs/OpenSaveCloudClient/FileContentIndex/e175e10d-fa29-474a-91ab-8c8d01429ac3.vsidx b/.vs/OpenSaveCloudClient/FileContentIndex/e175e10d-fa29-474a-91ab-8c8d01429ac3.vsidx new file mode 100644 index 0000000..4789dbf Binary files /dev/null and b/.vs/OpenSaveCloudClient/FileContentIndex/e175e10d-fa29-474a-91ab-8c8d01429ac3.vsidx differ diff --git a/.vs/ProjectEvaluation/opensavecloudclient.metadata.v2 b/.vs/ProjectEvaluation/opensavecloudclient.metadata.v2 index 21e7ddc..a718788 100644 Binary files a/.vs/ProjectEvaluation/opensavecloudclient.metadata.v2 and b/.vs/ProjectEvaluation/opensavecloudclient.metadata.v2 differ diff --git a/.vs/ProjectEvaluation/opensavecloudclient.projects.v2 b/.vs/ProjectEvaluation/opensavecloudclient.projects.v2 index 5fc2061..6e8cb32 100644 Binary files a/.vs/ProjectEvaluation/opensavecloudclient.projects.v2 and b/.vs/ProjectEvaluation/opensavecloudclient.projects.v2 differ diff --git a/OpenSaveCloudClient/AboutBox.cs b/OpenSaveCloudClient/AboutBox.cs index 138a66d..c2ea889 100644 --- a/OpenSaveCloudClient/AboutBox.cs +++ b/OpenSaveCloudClient/AboutBox.cs @@ -20,7 +20,7 @@ namespace OpenSaveCloudClient public AboutBox() { InitializeComponent(); - serverConnector = ServerConnector.GetInstance(); + serverConnector = ServerConnector.Instance; } private void AboutBox_Load(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/AddGameForm.cs b/OpenSaveCloudClient/AddGameForm.cs index 50696c6..4728861 100644 --- a/OpenSaveCloudClient/AddGameForm.cs +++ b/OpenSaveCloudClient/AddGameForm.cs @@ -22,7 +22,7 @@ namespace OpenSaveCloudClient public AddGameForm() { InitializeComponent(); - saveManager = SaveManager.GetInstance(); + saveManager = SaveManager.Instance; NoCoverLabel.Text = "IGDB is not configured"; } diff --git a/OpenSaveCloudClient/AddUser.cs b/OpenSaveCloudClient/AddUser.cs index 2a1ff5b..0a8e89a 100644 --- a/OpenSaveCloudClient/AddUser.cs +++ b/OpenSaveCloudClient/AddUser.cs @@ -21,8 +21,8 @@ namespace OpenSaveCloudClient public AddUser() { InitializeComponent(); - serverConnector = ServerConnector.GetInstance(); - taskManager = TaskManager.GetInstance(); + serverConnector = ServerConnector.Instance; + taskManager = TaskManager.Instance; } private void AddUser_Load(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/Core/LogManager.cs b/OpenSaveCloudClient/Core/LogManager.cs index 39c87fd..4db005e 100644 --- a/OpenSaveCloudClient/Core/LogManager.cs +++ b/OpenSaveCloudClient/Core/LogManager.cs @@ -20,10 +20,16 @@ namespace OpenSaveCloudClient.Core messages = new List(); } - public static LogManager GetInstance() + public static LogManager Instance { - if (instance == null) { instance = new LogManager(); } - return instance; + get + { + if (instance == null) + { + instance = new LogManager(); + } + return instance; + } } public void AddError(Exception ex) diff --git a/OpenSaveCloudClient/Core/SaveManager.cs b/OpenSaveCloudClient/Core/SaveManager.cs index a635a3f..592aaf1 100644 --- a/OpenSaveCloudClient/Core/SaveManager.cs +++ b/OpenSaveCloudClient/Core/SaveManager.cs @@ -22,13 +22,16 @@ namespace OpenSaveCloudClient.Core 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) diff --git a/OpenSaveCloudClient/Core/ServerConnector.cs b/OpenSaveCloudClient/Core/ServerConnector.cs index d13e3bc..6175a83 100644 --- a/OpenSaveCloudClient/Core/ServerConnector.cs +++ b/OpenSaveCloudClient/Core/ServerConnector.cs @@ -29,7 +29,7 @@ namespace OpenSaveCloudClient.Core private readonly LogManager logManager; private readonly TaskManager taskManager; - private readonly Configuration configuration; + private readonly UserConfiguration configuration; private readonly SaveManager saveManager; @@ -42,19 +42,21 @@ namespace OpenSaveCloudClient.Core private ServerConnector() { - configuration = Configuration.GetInstance(); - logManager = LogManager.GetInstance(); - taskManager = TaskManager.GetInstance(); - saveManager = SaveManager.GetInstance(); + configuration = UserConfiguration.Instance; + logManager = LogManager.Instance; + taskManager = TaskManager.Instance; + saveManager = SaveManager.Instance; } - public static ServerConnector GetInstance() + public static ServerConnector Instance { - if (instance == null) - { - instance = new ServerConnector(); + get { + if (instance == null) + { + instance = new ServerConnector(); + } + return instance; } - return instance; } /// @@ -441,6 +443,7 @@ namespace OpenSaveCloudClient.Core client.DefaultRequestHeaders.Add("X-Upload-Key", uploadToken); client.DefaultRequestHeaders.Add("X-Game-Save-Hash", newHash); 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; if (response.IsSuccessStatusCode) { @@ -480,6 +483,7 @@ namespace OpenSaveCloudClient.Core using HttpClient client = new(); client.DefaultRequestHeaders.Add("Authorization", "bearer " + token); 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; if (response.IsSuccessStatusCode) { diff --git a/OpenSaveCloudClient/Core/TaskManager.cs b/OpenSaveCloudClient/Core/TaskManager.cs index ea89bc5..ec1cfec 100644 --- a/OpenSaveCloudClient/Core/TaskManager.cs +++ b/OpenSaveCloudClient/Core/TaskManager.cs @@ -21,7 +21,7 @@ namespace OpenSaveCloudClient.Core private TaskManager() { - logManager = LogManager.GetInstance(); + logManager = LogManager.Instance; _tasks = new Dictionary(); mut = new Mutex(); timer = new System.Timers.Timer @@ -32,13 +32,16 @@ namespace OpenSaveCloudClient.Core 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) diff --git a/OpenSaveCloudClient/DownloadGameForm.cs b/OpenSaveCloudClient/DownloadGameForm.cs index a318d94..83b73a9 100644 --- a/OpenSaveCloudClient/DownloadGameForm.cs +++ b/OpenSaveCloudClient/DownloadGameForm.cs @@ -28,8 +28,8 @@ namespace OpenSaveCloudClient { InitializeComponent(); result = new List(); - serverConnector = ServerConnector.GetInstance(); - saveManager = SaveManager.GetInstance(); + serverConnector = ServerConnector.Instance; + saveManager = SaveManager.Instance; } private void DownloadGameForm_Load(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/GameLibraryForm.cs b/OpenSaveCloudClient/GameLibraryForm.cs index cac86fb..b7871f7 100644 --- a/OpenSaveCloudClient/GameLibraryForm.cs +++ b/OpenSaveCloudClient/GameLibraryForm.cs @@ -7,7 +7,7 @@ namespace OpenSaveCloudClient public partial class GameLibrary : Form { - private readonly Configuration _configuration; + private readonly UserConfiguration _configuration; private readonly SaveManager saveManager; private readonly TaskManager taskManager; private readonly ServerConnector serverConnector; @@ -17,11 +17,11 @@ namespace OpenSaveCloudClient public GameLibrary() { InitializeComponent(); - saveManager = SaveManager.GetInstance(); - taskManager = TaskManager.GetInstance(); - serverConnector = ServerConnector.GetInstance(); - _configuration = Configuration.GetInstance(); - logManager = LogManager.GetInstance(); + saveManager = SaveManager.Instance; + taskManager = TaskManager.Instance; + serverConnector = ServerConnector.Instance; + _configuration = UserConfiguration.Instance; + logManager = LogManager.Instance; listViewContextMenu = new ContextMenuStrip(); listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click; diff --git a/OpenSaveCloudClient/LoginForm.cs b/OpenSaveCloudClient/LoginForm.cs index 338e9e1..d94ecbe 100644 --- a/OpenSaveCloudClient/LoginForm.cs +++ b/OpenSaveCloudClient/LoginForm.cs @@ -19,7 +19,7 @@ namespace OpenSaveCloudClient public LoginForm() { InitializeComponent(); - serverConnector = ServerConnector.GetInstance(); + serverConnector = ServerConnector.Instance; } private void LoginButton_Click(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/LogsForm.cs b/OpenSaveCloudClient/LogsForm.cs index 0009b26..0806aa6 100644 --- a/OpenSaveCloudClient/LogsForm.cs +++ b/OpenSaveCloudClient/LogsForm.cs @@ -19,7 +19,7 @@ namespace OpenSaveCloudClient public LogsForm() { InitializeComponent(); - logManager = LogManager.GetInstance(); + logManager = LogManager.Instance; logManager.NewMessage += logManager_NewError; } diff --git a/OpenSaveCloudClient/Models/Configuration.cs b/OpenSaveCloudClient/Models/Configuration.cs index cfb95ca..be6f254 100644 --- a/OpenSaveCloudClient/Models/Configuration.cs +++ b/OpenSaveCloudClient/Models/Configuration.cs @@ -7,24 +7,27 @@ using System.Text.Json; namespace OpenSaveCloudClient.Models { - public class Configuration + public class UserConfiguration { - private static Configuration? instance; + private static UserConfiguration? instance; private Dictionary _values; - private Configuration() + private UserConfiguration() { _values = new Dictionary(); 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() diff --git a/OpenSaveCloudClient/Models/GameSave.cs b/OpenSaveCloudClient/Models/GameSave.cs index e55927c..52e6234 100644 --- a/OpenSaveCloudClient/Models/GameSave.cs +++ b/OpenSaveCloudClient/Models/GameSave.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.IO.Compression; using System.Security.Cryptography; using OpenSaveCloudClient.Core; +using System.Globalization; namespace OpenSaveCloudClient.Models { @@ -96,7 +97,7 @@ namespace OpenSaveCloudClient.Models byte[]? hashBytes = HashTool.HashDirectory(FolderPath); 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("-", ""); if (currentHash != hash) diff --git a/OpenSaveCloudClient/OpenSaveCloudClient.csproj b/OpenSaveCloudClient/OpenSaveCloudClient.csproj index 2de5c25..69d3fa2 100644 --- a/OpenSaveCloudClient/OpenSaveCloudClient.csproj +++ b/OpenSaveCloudClient/OpenSaveCloudClient.csproj @@ -14,7 +14,7 @@ True D:\keyPair.snk 6.0-all - 1.0.1 + 1.0.2 diff --git a/OpenSaveCloudClient/SettingsForm.cs b/OpenSaveCloudClient/SettingsForm.cs index 103059a..9028930 100644 --- a/OpenSaveCloudClient/SettingsForm.cs +++ b/OpenSaveCloudClient/SettingsForm.cs @@ -14,12 +14,12 @@ namespace OpenSaveCloudClient public partial class SettingsForm : Form { - private readonly Configuration _configuration; + private readonly UserConfiguration _configuration; public SettingsForm() { InitializeComponent(); - _configuration = Configuration.GetInstance(); + _configuration = UserConfiguration.Instance; InitAndFillFields(); } diff --git a/OpenSaveCloudClient/TasksForm.cs b/OpenSaveCloudClient/TasksForm.cs index 3b927dc..bdecedc 100644 --- a/OpenSaveCloudClient/TasksForm.cs +++ b/OpenSaveCloudClient/TasksForm.cs @@ -19,7 +19,7 @@ namespace OpenSaveCloudClient public TasksForm() { InitializeComponent(); - taskManager = TaskManager.GetInstance(); + taskManager = TaskManager.Instance; } private void AddLVItem(string key, string name, string status, bool undefined, int value, int max) diff --git a/OpenSaveCloudClient/UserForm.cs b/OpenSaveCloudClient/UserForm.cs index 2ae011b..22d4c53 100644 --- a/OpenSaveCloudClient/UserForm.cs +++ b/OpenSaveCloudClient/UserForm.cs @@ -20,7 +20,7 @@ namespace OpenSaveCloudClient public UserForm() { InitializeComponent(); - serverConnector = ServerConnector.GetInstance(); + serverConnector = ServerConnector.Instance; } private void UserForm_Load(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/UserManagementForm.cs b/OpenSaveCloudClient/UserManagementForm.cs index d784718..7af2ee9 100644 --- a/OpenSaveCloudClient/UserManagementForm.cs +++ b/OpenSaveCloudClient/UserManagementForm.cs @@ -20,7 +20,7 @@ namespace OpenSaveCloudClient public UserManagementForm() { InitializeComponent(); - serverConnector = ServerConnector.GetInstance(); + serverConnector = ServerConnector.Instance; } private void UserSettingsButton_Click(object sender, EventArgs e) diff --git a/OpenSaveCloudClient/WaitingForm.Designer.cs b/OpenSaveCloudClient/WaitingForm.Designer.cs index df74ae8..fcd3d4f 100644 --- a/OpenSaveCloudClient/WaitingForm.Designer.cs +++ b/OpenSaveCloudClient/WaitingForm.Designer.cs @@ -82,6 +82,5 @@ private Label label1; private PictureBox LoadingIndicator; - private System.Windows.Forms.Timer timer1; } } \ No newline at end of file diff --git a/OpenSaveCloudClient/WaitingForm.cs b/OpenSaveCloudClient/WaitingForm.cs index 465be53..6acf4e8 100644 --- a/OpenSaveCloudClient/WaitingForm.cs +++ b/OpenSaveCloudClient/WaitingForm.cs @@ -19,7 +19,7 @@ namespace OpenSaveCloudClient public WaitingForm() { InitializeComponent(); - taskManager = TaskManager.GetInstance(); + taskManager = TaskManager.Instance; taskManager.TaskChanged += OnTaskChanged; }