Remove game from library and server
This commit is contained in:
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -708,6 +708,35 @@ namespace OpenSaveCloudClient.Core
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DeleteGame(long gameId)
|
||||
{
|
||||
logManager.AddInformation("Delete a game from the server");
|
||||
string uuidTask = taskManager.StartTask("Deleting game", true, 1);
|
||||
try
|
||||
{
|
||||
using HttpClient client = new();
|
||||
client.DefaultRequestHeaders.Add("Authorization", "bearer " + token);
|
||||
HttpResponseMessage response = client.DeleteAsync(string.Format("{0}:{1}/api/v1/game/remove/{2}", host, port, gameId)).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string responseText = response.Content.ReadAsStringAsync().Result;
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogServerError(response);
|
||||
}
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logManager.AddError(ex);
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ChangePassword(NewPassword password)
|
||||
{
|
||||
logManager.AddInformation("Changing password");
|
||||
|
||||
31
OpenSaveCloudClient/DownloadGameForm.Designer.cs
generated
31
OpenSaveCloudClient/DownloadGameForm.Designer.cs
generated
@@ -38,6 +38,7 @@
|
||||
this.DownloadButton = new System.Windows.Forms.Button();
|
||||
this.RemoteList = new System.Windows.Forms.ListView();
|
||||
this.GameName = new System.Windows.Forms.ColumnHeader();
|
||||
this.infoPathLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LoadingIndicator)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -59,7 +60,7 @@
|
||||
this.LoadingIndicator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.LoadingIndicator.Image = ((System.Drawing.Image)(resources.GetObject("LoadingIndicator.Image")));
|
||||
this.LoadingIndicator.Location = new System.Drawing.Point(599, 5);
|
||||
this.LoadingIndicator.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.LoadingIndicator.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.LoadingIndicator.Name = "LoadingIndicator";
|
||||
this.LoadingIndicator.Size = new System.Drawing.Size(34, 39);
|
||||
this.LoadingIndicator.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
@@ -71,13 +72,14 @@
|
||||
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.Right)));
|
||||
this.groupBox1.Controls.Add(this.infoPathLabel);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.pathButton);
|
||||
this.groupBox1.Controls.Add(this.LocationBox);
|
||||
this.groupBox1.Location = new System.Drawing.Point(277, 50);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox1.Size = new System.Drawing.Size(354, 310);
|
||||
this.groupBox1.TabIndex = 8;
|
||||
this.groupBox1.TabStop = false;
|
||||
@@ -98,7 +100,7 @@
|
||||
this.pathButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pathButton.Enabled = false;
|
||||
this.pathButton.Location = new System.Drawing.Point(317, 61);
|
||||
this.pathButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pathButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.pathButton.Name = "pathButton";
|
||||
this.pathButton.Size = new System.Drawing.Size(33, 24);
|
||||
this.pathButton.TabIndex = 6;
|
||||
@@ -112,7 +114,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.LocationBox.Enabled = false;
|
||||
this.LocationBox.Location = new System.Drawing.Point(4, 62);
|
||||
this.LocationBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.LocationBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.LocationBox.Name = "LocationBox";
|
||||
this.LocationBox.Size = new System.Drawing.Size(310, 23);
|
||||
this.LocationBox.TabIndex = 5;
|
||||
@@ -123,7 +125,7 @@
|
||||
this.DownloadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.DownloadButton.Enabled = false;
|
||||
this.DownloadButton.Location = new System.Drawing.Point(556, 367);
|
||||
this.DownloadButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.DownloadButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.DownloadButton.Name = "DownloadButton";
|
||||
this.DownloadButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.DownloadButton.TabIndex = 9;
|
||||
@@ -139,7 +141,7 @@
|
||||
this.RemoteList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.GameName});
|
||||
this.RemoteList.Location = new System.Drawing.Point(8, 50);
|
||||
this.RemoteList.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.RemoteList.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.RemoteList.Name = "RemoteList";
|
||||
this.RemoteList.Size = new System.Drawing.Size(266, 311);
|
||||
this.RemoteList.TabIndex = 10;
|
||||
@@ -153,6 +155,18 @@
|
||||
this.GameName.Text = "Game name";
|
||||
this.GameName.Width = 240;
|
||||
//
|
||||
// infoPathLabel
|
||||
//
|
||||
this.infoPathLabel.AutoSize = true;
|
||||
this.infoPathLabel.Enabled = false;
|
||||
this.infoPathLabel.Location = new System.Drawing.Point(4, 87);
|
||||
this.infoPathLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.infoPathLabel.Name = "infoPathLabel";
|
||||
this.infoPathLabel.Size = new System.Drawing.Size(153, 15);
|
||||
this.infoPathLabel.TabIndex = 8;
|
||||
this.infoPathLabel.Text = "A \'\' folder will be created in ";
|
||||
this.infoPathLabel.Visible = false;
|
||||
//
|
||||
// DownloadGameForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
@@ -165,7 +179,7 @@
|
||||
this.Controls.Add(this.LoadingIndicator);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.MinimumSize = new System.Drawing.Size(660, 440);
|
||||
this.Name = "DownloadGameForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
@@ -190,5 +204,6 @@
|
||||
private Label label3;
|
||||
private Button pathButton;
|
||||
private TextBox LocationBox;
|
||||
private Label infoPathLabel;
|
||||
}
|
||||
}
|
||||
@@ -94,12 +94,15 @@ namespace OpenSaveCloudClient
|
||||
pathButton.Enabled = true;
|
||||
LocationBox.Enabled = true;
|
||||
LocationBox.Text = selectedItem.SubItems[2].Text;
|
||||
infoPathLabel.Text = String.Format("A '{0}' folder will be created", selectedItem.SubItems[0].Text);
|
||||
infoPathLabel.Visible = true;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
pathButton.Enabled = false;
|
||||
LocationBox.Enabled = false;
|
||||
infoPathLabel.Visible = false;
|
||||
LocationBox.Clear();
|
||||
}
|
||||
}
|
||||
@@ -122,7 +125,7 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
foreach (ListViewItem lvi in RemoteList.CheckedItems)
|
||||
{
|
||||
string path = lvi.SubItems[2].Text;
|
||||
string path = Path.Join(lvi.SubItems[2].Text, lvi.SubItems[0].Text);
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
MessageBox.Show("File folder cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
81
OpenSaveCloudClient/GameLibraryForm.Designer.cs
generated
81
OpenSaveCloudClient/GameLibraryForm.Designer.cs
generated
@@ -56,15 +56,17 @@
|
||||
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.listView1.LargeImageList = this.coverList;
|
||||
this.listView1.Location = new System.Drawing.Point(0, 120);
|
||||
this.listView1.Location = new System.Drawing.Point(0, 80);
|
||||
this.listView1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.ShowGroups = false;
|
||||
this.listView1.ShowItemToolTips = true;
|
||||
this.listView1.Size = new System.Drawing.Size(1506, 610);
|
||||
this.listView1.Size = new System.Drawing.Size(1004, 406);
|
||||
this.listView1.TabIndex = 2;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
|
||||
this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_Click);
|
||||
//
|
||||
// coverList
|
||||
//
|
||||
@@ -80,10 +82,9 @@
|
||||
this.TasksButton,
|
||||
this.StatusLabel,
|
||||
this.MainProgressBar});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 730);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 486);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 21, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1506, 36);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1004, 25);
|
||||
this.statusStrip1.TabIndex = 4;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
@@ -94,7 +95,7 @@
|
||||
this.TasksButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.TasksButton.Name = "TasksButton";
|
||||
this.TasksButton.ShowDropDownArrow = false;
|
||||
this.TasksButton.Size = new System.Drawing.Size(46, 33);
|
||||
this.TasksButton.Size = new System.Drawing.Size(32, 23);
|
||||
this.TasksButton.Text = "";
|
||||
this.TasksButton.Click += new System.EventHandler(this.toolStripDropDownButton1_Click);
|
||||
//
|
||||
@@ -102,13 +103,13 @@
|
||||
//
|
||||
this.StatusLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.StatusLabel.Name = "StatusLabel";
|
||||
this.StatusLabel.Size = new System.Drawing.Size(0, 29);
|
||||
this.StatusLabel.Size = new System.Drawing.Size(0, 20);
|
||||
//
|
||||
// MainProgressBar
|
||||
//
|
||||
this.MainProgressBar.MarqueeAnimationSpeed = 20;
|
||||
this.MainProgressBar.Name = "MainProgressBar";
|
||||
this.MainProgressBar.Size = new System.Drawing.Size(150, 28);
|
||||
this.MainProgressBar.Size = new System.Drawing.Size(100, 20);
|
||||
this.MainProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
this.MainProgressBar.Visible = false;
|
||||
//
|
||||
@@ -126,11 +127,10 @@
|
||||
this.panel1.Controls.Add(this.AddButton);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 120);
|
||||
this.panel1.MinimumSize = new System.Drawing.Size(0, 120);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 80);
|
||||
this.panel1.MinimumSize = new System.Drawing.Size(0, 80);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1506, 120);
|
||||
this.panel1.Size = new System.Drawing.Size(1004, 80);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// AboutButton
|
||||
@@ -139,10 +139,9 @@
|
||||
this.AboutButton.FlatAppearance.BorderSize = 0;
|
||||
this.AboutButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.AboutButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.AboutButton.Location = new System.Drawing.Point(758, 4);
|
||||
this.AboutButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.AboutButton.Location = new System.Drawing.Point(505, 3);
|
||||
this.AboutButton.Name = "AboutButton";
|
||||
this.AboutButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.AboutButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.AboutButton.TabIndex = 9;
|
||||
this.AboutButton.Text = "\r\n\r\nAbout";
|
||||
this.AboutButton.UseVisualStyleBackColor = true;
|
||||
@@ -153,10 +152,9 @@
|
||||
this.LogButton.FlatAppearance.BorderSize = 0;
|
||||
this.LogButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.LogButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.LogButton.Location = new System.Drawing.Point(663, 4);
|
||||
this.LogButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.LogButton.Location = new System.Drawing.Point(442, 3);
|
||||
this.LogButton.Name = "LogButton";
|
||||
this.LogButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.LogButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.LogButton.TabIndex = 8;
|
||||
this.LogButton.Text = "\r\n\r\nLog";
|
||||
this.LogButton.UseVisualStyleBackColor = true;
|
||||
@@ -168,10 +166,9 @@
|
||||
this.LogoutButton.FlatAppearance.BorderSize = 0;
|
||||
this.LogoutButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.LogoutButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.LogoutButton.Location = new System.Drawing.Point(568, 4);
|
||||
this.LogoutButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.LogoutButton.Location = new System.Drawing.Point(379, 3);
|
||||
this.LogoutButton.Name = "LogoutButton";
|
||||
this.LogoutButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.LogoutButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.LogoutButton.TabIndex = 7;
|
||||
this.LogoutButton.Text = "\r\n\r\nLogout";
|
||||
this.LogoutButton.UseVisualStyleBackColor = true;
|
||||
@@ -182,10 +179,9 @@
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label2.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.label2.Location = new System.Drawing.Point(530, 33);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Location = new System.Drawing.Point(353, 22);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(29, 48);
|
||||
this.label2.Size = new System.Drawing.Size(20, 32);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "|";
|
||||
//
|
||||
@@ -195,10 +191,9 @@
|
||||
this.UserSettingsButton.FlatAppearance.BorderSize = 0;
|
||||
this.UserSettingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.UserSettingsButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.UserSettingsButton.Location = new System.Drawing.Point(435, 4);
|
||||
this.UserSettingsButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.UserSettingsButton.Location = new System.Drawing.Point(290, 3);
|
||||
this.UserSettingsButton.Name = "UserSettingsButton";
|
||||
this.UserSettingsButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.UserSettingsButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.UserSettingsButton.TabIndex = 5;
|
||||
this.UserSettingsButton.Text = "\r\n\r\nMe";
|
||||
this.UserSettingsButton.UseVisualStyleBackColor = true;
|
||||
@@ -208,10 +203,9 @@
|
||||
this.SettingsButton.FlatAppearance.BorderSize = 0;
|
||||
this.SettingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.SettingsButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.SettingsButton.Location = new System.Drawing.Point(340, 4);
|
||||
this.SettingsButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.SettingsButton.Location = new System.Drawing.Point(227, 3);
|
||||
this.SettingsButton.Name = "SettingsButton";
|
||||
this.SettingsButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.SettingsButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.SettingsButton.TabIndex = 4;
|
||||
this.SettingsButton.Text = "\r\n\r\nOptions";
|
||||
this.SettingsButton.UseVisualStyleBackColor = true;
|
||||
@@ -222,10 +216,9 @@
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.label1.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.label1.Location = new System.Drawing.Point(302, 33);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Location = new System.Drawing.Point(201, 22);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 48);
|
||||
this.label1.Size = new System.Drawing.Size(20, 32);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "|";
|
||||
//
|
||||
@@ -235,10 +228,9 @@
|
||||
this.DownloadButton.FlatAppearance.BorderSize = 0;
|
||||
this.DownloadButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.DownloadButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.DownloadButton.Location = new System.Drawing.Point(207, 4);
|
||||
this.DownloadButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.DownloadButton.Location = new System.Drawing.Point(138, 3);
|
||||
this.DownloadButton.Name = "DownloadButton";
|
||||
this.DownloadButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.DownloadButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.DownloadButton.TabIndex = 2;
|
||||
this.DownloadButton.Text = "\r\n\r\nGet";
|
||||
this.DownloadButton.UseVisualStyleBackColor = true;
|
||||
@@ -250,10 +242,9 @@
|
||||
this.SyncButton.FlatAppearance.BorderSize = 0;
|
||||
this.SyncButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.SyncButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.SyncButton.Location = new System.Drawing.Point(112, 4);
|
||||
this.SyncButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.SyncButton.Location = new System.Drawing.Point(75, 3);
|
||||
this.SyncButton.Name = "SyncButton";
|
||||
this.SyncButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.SyncButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.SyncButton.TabIndex = 1;
|
||||
this.SyncButton.Text = "\r\n\r\nSync";
|
||||
this.SyncButton.UseVisualStyleBackColor = true;
|
||||
@@ -265,10 +256,9 @@
|
||||
this.AddButton.FlatAppearance.BorderSize = 0;
|
||||
this.AddButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.AddButton.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.AddButton.Location = new System.Drawing.Point(18, 4);
|
||||
this.AddButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.AddButton.Location = new System.Drawing.Point(12, 3);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(86, 111);
|
||||
this.AddButton.Size = new System.Drawing.Size(57, 74);
|
||||
this.AddButton.TabIndex = 0;
|
||||
this.AddButton.Text = "\r\n\r\nAdd";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
@@ -276,16 +266,17 @@
|
||||
//
|
||||
// GameLibrary
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ClientSize = new System.Drawing.Size(1506, 766);
|
||||
this.ClientSize = new System.Drawing.Size(1004, 511);
|
||||
this.Controls.Add(this.listView1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.DoubleBuffered = true;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(1516, 788);
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.MinimumSize = new System.Drawing.Size(1016, 538);
|
||||
this.Name = "GameLibrary";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Game Library";
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
private readonly IGDBClient? _client;
|
||||
//private readonly IGDBClient? _client;
|
||||
private readonly SaveManager saveManager;
|
||||
private readonly TaskManager taskManager;
|
||||
private readonly ServerConnector serverConnector;
|
||||
private readonly LogManager logManager;
|
||||
|
||||
private readonly ContextMenuStrip listViewContextMenu;
|
||||
|
||||
public GameLibrary()
|
||||
{
|
||||
@@ -24,6 +24,10 @@ namespace OpenSaveCloudClient
|
||||
serverConnector = ServerConnector.GetInstance();
|
||||
_configuration = Configuration.GetInstance();
|
||||
logManager = LogManager.GetInstance();
|
||||
|
||||
listViewContextMenu = new ContextMenuStrip();
|
||||
listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click;
|
||||
listViewContextMenu.Items.Add("Remove from local library").Click += contextMenuRemoveFromLocalLibrary_Click;
|
||||
/*if (_configuration.GetBoolean("igdb.enabled", false))
|
||||
{
|
||||
string clientId = _configuration.GetString("igdb.client_id", "");
|
||||
@@ -168,7 +172,7 @@ namespace OpenSaveCloudClient
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddGameForm form = new(_client);
|
||||
AddGameForm form = new(/*_client*/ null);
|
||||
if (form.ShowDialog() == DialogResult.OK) {
|
||||
GameSave newGame = form.Result;
|
||||
ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); });
|
||||
@@ -467,5 +471,69 @@ namespace OpenSaveCloudClient
|
||||
taskManager.TaskChanged -= taskManager_TaskChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void listView1_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (listView1.SelectedItems.Count == 1 && SyncButton.Enabled)
|
||||
{
|
||||
GameSave? g = saveManager.Saves.FirstOrDefault(g => g.Uuid == listView1.SelectedItems[0].SubItems[1].Text);
|
||||
if (g != null)
|
||||
{
|
||||
listViewContextMenu.Items[0].Enabled = g.Hash.Length > 0;
|
||||
listViewContextMenu.Show(listView1, e.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void contextMenuDeleteFromServer_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count == 1 && SyncButton.Enabled)
|
||||
{
|
||||
GameSave? g = saveManager.Saves.FirstOrDefault(g => g.Uuid == listView1.SelectedItems[0].SubItems[1].Text);
|
||||
if (g != null)
|
||||
{
|
||||
DialogResult res = MessageBox.Show(String.Format("Do you really want to remove '{0}' from the server?", g.Name) +
|
||||
" It will not be deleted from the hard drive", "Delete synced save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
LockCriticalControls(true);
|
||||
ThreadPool.QueueUserWorkItem(delegate {
|
||||
if (serverConnector.DeleteGame(g.Id))
|
||||
{
|
||||
saveManager.Saves.Remove(g);
|
||||
saveManager.Save();
|
||||
}
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
RefreshList();
|
||||
LockCriticalControls(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void contextMenuRemoveFromLocalLibrary_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count == 1 && SyncButton.Enabled)
|
||||
{
|
||||
GameSave? g = saveManager.Saves.FirstOrDefault(g => g.Uuid == listView1.SelectedItems[0].SubItems[1].Text);
|
||||
if (g != null)
|
||||
{
|
||||
DialogResult res = MessageBox.Show(String.Format("Do you really want to remove '{0}' from the library?", g.Name) +
|
||||
" It will not be deleted from the hard drive or the server", "Remove game from local library", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
saveManager.Saves.Remove(g);
|
||||
saveManager.Save();
|
||||
RefreshList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
||||
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
||||
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA7OMCAAJNU0Z0AUkBTAMBAQAB
|
||||
yAEBAcgBAQEIAQEBdgEBBP8BGQEACP8BQgFNATYHAAE2AwABKAMAASABBAIAAXYBAQIAAQEBAAEYBQAB
|
||||
4AEBAeABAQEIAQEBdgEBBP8BGQEACP8BQgFNATYHAAE2AwABKAMAASABBAIAAXYBAQIAAQEBAAEYBQAB
|
||||
QAEUARIRAANSA1EBUgFRBVICUQNSAlEDUgJRAVIEUQFSBVEBUg1RAVAIUQFQAlEBUAFRAVADUQFQAVEE
|
||||
UAFRAVABUQJQAVECUAFRAVABUQ5QAU8BUAFPAlADTwZQAU8BUAFPAVADTwNQAU8CUAZPAVABTwFQBU8B
|
||||
UAZPAU4ETwFOBE8BTgVPAU4DTwJOBE8CTgJPAU4BTwFOAU8HTgFPCE4BTwdOAU0GTgJNBE4BTQNOAk0B
|
||||
|
||||
Reference in New Issue
Block a user