From 67c96b2e7b4ac06a78dff576f2e8c8cda0fe8f33 Mon Sep 17 00:00:00 2001 From: "RetroDriven.com" <44145655+RetroDriven@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:43:36 -0400 Subject: [PATCH] v1.5.6 --- .../Organize_Cores/Organize_Cores.Designer.cs | 195 +++++--- Controls/Organize_Cores/Organize_Cores.cs | 41 ++ .../Update_Pocket/Update_Pocket.Designer.cs | 461 ++++++++++++------ Controls/Update_Pocket/Update_Pocket.cs | 121 ++++- Forms/Main/Form1.Designer.cs | 46 +- Forms/Main/Form1.cs | 2 +- Lib/Updater/Factory.cs | 14 + .../MissingRequiredInstanceFiles.cs | 20 + Lib/Updater/helpers/GlobalHelper.cs | 36 ++ Lib/Updater/models/Archive/File.cs | 6 +- Lib/Updater/models/ImagePack.cs | 2 +- Lib/Updater/services/ArchiveService.cs | 14 +- Lib/Updater/services/ImagePacksService.cs | 2 +- Pocket_Updater.csproj | 2 +- lib/Updater/Updater.cs | 176 ++++--- lib/Updater/helpers/HttpHelper.cs | 117 ++++- lib/Updater/models/Core.cs | 87 ++-- lib/Updater/models/Settings/Config.cs | 13 + lib/Updater/services/AssetsService.cs | 17 +- lib/Updater/services/CoresService.cs | 7 +- lib/Updater/services/GithubApiService.cs | 10 + 21 files changed, 995 insertions(+), 394 deletions(-) create mode 100644 Lib/Updater/Factory.cs create mode 100644 Lib/Updater/exceptions/MissingRequiredInstanceFiles.cs create mode 100644 Lib/Updater/helpers/GlobalHelper.cs diff --git a/Controls/Organize_Cores/Organize_Cores.Designer.cs b/Controls/Organize_Cores/Organize_Cores.Designer.cs index 0d01dcf..6fc7272 100644 --- a/Controls/Organize_Cores/Organize_Cores.Designer.cs +++ b/Controls/Organize_Cores/Organize_Cores.Designer.cs @@ -30,31 +30,36 @@ private void InitializeComponent() { Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges1 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges2 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges9 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges10 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges11 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges12 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges3 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges4 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges5 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges6 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges7 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges8 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges9 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges10 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges11 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges13 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); this.Panel_Top = new Guna.UI2.WinForms.Guna2Panel(); this.label4 = new System.Windows.Forms.Label(); this.guna2Separator2 = new Guna.UI2.WinForms.Guna2Separator(); this.Panel_Bottom = new Guna.UI2.WinForms.Guna2GradientPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox2 = new Guna.UI2.WinForms.Guna2ComboBox(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.Save = new Guna.UI2.WinForms.Guna2Button(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.Pocket_Drive = new Guna.UI2.WinForms.Guna2ComboBox(); this.label3 = new System.Windows.Forms.Label(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.Button_Refresh = new Guna.UI2.WinForms.Guna2Button(); - this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); - this.Save = new Guna.UI2.WinForms.Guna2Button(); this.dataGridView1 = new Guna.UI2.WinForms.Guna2DataGridView(); this.CoreName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.CoreDeveloper = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -64,9 +69,10 @@ private void InitializeComponent() this.Panel_Top.SuspendLayout(); this.Panel_Bottom.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); - this.tableLayoutPanel5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -108,29 +114,123 @@ private void InitializeComponent() // Panel_Bottom // this.Panel_Bottom.Controls.Add(this.flowLayoutPanel1); - this.Panel_Bottom.CustomizableEdges = customizableEdges9; + this.Panel_Bottom.CustomizableEdges = customizableEdges11; this.Panel_Bottom.Dock = System.Windows.Forms.DockStyle.Bottom; - this.Panel_Bottom.Location = new System.Drawing.Point(0, 522); + this.Panel_Bottom.Location = new System.Drawing.Point(0, 534); this.Panel_Bottom.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.Panel_Bottom.Name = "Panel_Bottom"; this.Panel_Bottom.Padding = new System.Windows.Forms.Padding(0, 11, 0, 11); - this.Panel_Bottom.ShadowDecoration.CustomizableEdges = customizableEdges10; - this.Panel_Bottom.Size = new System.Drawing.Size(726, 84); + this.Panel_Bottom.ShadowDecoration.CustomizableEdges = customizableEdges12; + this.Panel_Bottom.Size = new System.Drawing.Size(726, 124); this.Panel_Bottom.TabIndex = 4; // // flowLayoutPanel1 // this.flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel1); + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel5); this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel2); this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel4); - this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel5); this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 11); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0, 1, 4, 1); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(131, 0, 0, 0); - this.flowLayoutPanel1.Size = new System.Drawing.Size(726, 58); + this.flowLayoutPanel1.Size = new System.Drawing.Size(726, 110); this.flowLayoutPanel1.TabIndex = 22; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.comboBox2, 1, 0); + this.tableLayoutPanel1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.tableLayoutPanel1.Location = new System.Drawing.Point(134, 2); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(325, 40); + this.tableLayoutPanel1.TabIndex = 10; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(3, 10); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(116, 20); + this.label1.TabIndex = 6; + this.label1.Text = "Cores Location:"; + // + // comboBox2 + // + this.comboBox2.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.comboBox2.AutoRoundedCorners = true; + this.comboBox2.BackColor = System.Drawing.Color.Transparent; + this.comboBox2.BorderRadius = 17; + this.comboBox2.Cursor = System.Windows.Forms.Cursors.Hand; + this.comboBox2.CustomizableEdges = customizableEdges3; + this.comboBox2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(44)))), ((int)(((byte)(66))))); + this.comboBox2.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.comboBox2.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.comboBox2.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.comboBox2.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.comboBox2.ItemHeight = 30; + this.comboBox2.Items.AddRange(new object[] { + "Current Directory", + "Removable Storage"}); + this.comboBox2.ItemsAppearance.SelectedBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.comboBox2.Location = new System.Drawing.Point(125, 2); + this.comboBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.ShadowDecoration.CustomizableEdges = customizableEdges4; + this.comboBox2.Size = new System.Drawing.Size(197, 36); + this.comboBox2.TabIndex = 10; + this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.AutoSize = true; + this.tableLayoutPanel5.ColumnCount = 1; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.Controls.Add(this.Save, 0, 0); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Top; + this.tableLayoutPanel5.Location = new System.Drawing.Point(466, 1); + this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.RowCount = 1; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); + this.tableLayoutPanel5.Size = new System.Drawing.Size(107, 50); + this.tableLayoutPanel5.TabIndex = 11; + // + // Save + // + this.Save.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.Save.AutoRoundedCorners = true; + this.Save.BorderRadius = 20; + this.Save.Cursor = System.Windows.Forms.Cursors.Hand; + this.Save.CustomizableEdges = customizableEdges5; + this.Save.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.Save.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.Save.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.Save.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.Save.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.Save.ForeColor = System.Drawing.Color.White; + this.Save.Location = new System.Drawing.Point(4, 1); + this.Save.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); + this.Save.Name = "Save"; + this.Save.ShadowDecoration.CustomizableEdges = customizableEdges6; + this.Save.Size = new System.Drawing.Size(99, 42); + this.Save.TabIndex = 1; + this.Save.Text = "Organize"; + this.Save.Click += new System.EventHandler(this.Save_Click); + // // tableLayoutPanel2 // this.tableLayoutPanel2.AutoSize = true; @@ -140,7 +240,7 @@ private void InitializeComponent() this.tableLayoutPanel2.Controls.Add(this.Pocket_Drive, 0, 0); this.tableLayoutPanel2.Controls.Add(this.label3, 0, 0); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanel2.Location = new System.Drawing.Point(135, 1); + this.tableLayoutPanel2.Location = new System.Drawing.Point(135, 53); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 1; @@ -155,7 +255,7 @@ private void InitializeComponent() this.Pocket_Drive.BackColor = System.Drawing.Color.Transparent; this.Pocket_Drive.BorderRadius = 17; this.Pocket_Drive.Cursor = System.Windows.Forms.Cursors.Hand; - this.Pocket_Drive.CustomizableEdges = customizableEdges3; + this.Pocket_Drive.CustomizableEdges = customizableEdges7; this.Pocket_Drive.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.Pocket_Drive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.Pocket_Drive.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(44)))), ((int)(((byte)(66))))); @@ -168,9 +268,10 @@ private void InitializeComponent() this.Pocket_Drive.Location = new System.Drawing.Point(156, 1); this.Pocket_Drive.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.Pocket_Drive.Name = "Pocket_Drive"; - this.Pocket_Drive.ShadowDecoration.CustomizableEdges = customizableEdges4; + this.Pocket_Drive.ShadowDecoration.CustomizableEdges = customizableEdges8; this.Pocket_Drive.Size = new System.Drawing.Size(176, 36); this.Pocket_Drive.TabIndex = 16; + this.Pocket_Drive.Visible = false; this.Pocket_Drive.SelectedIndexChanged += new System.EventHandler(this.Pocket_Drive_SelectedIndexChanged); // // label3 @@ -184,6 +285,7 @@ private void InitializeComponent() this.label3.Size = new System.Drawing.Size(148, 20); this.label3.TabIndex = 15; this.label3.Text = "Pocket Drive Letter:"; + this.label3.Visible = false; // // tableLayoutPanel4 // @@ -192,7 +294,7 @@ private void InitializeComponent() this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 44F)); this.tableLayoutPanel4.Controls.Add(this.Button_Refresh, 0, 0); this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanel4.Location = new System.Drawing.Point(475, 1); + this.tableLayoutPanel4.Location = new System.Drawing.Point(475, 53); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0, 1, 0, 1); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 1; @@ -203,7 +305,7 @@ private void InitializeComponent() // Button_Refresh // this.Button_Refresh.Cursor = System.Windows.Forms.Cursors.Hand; - this.Button_Refresh.CustomizableEdges = customizableEdges5; + this.Button_Refresh.CustomizableEdges = customizableEdges9; this.Button_Refresh.DisabledState.BorderColor = System.Drawing.Color.DarkGray; this.Button_Refresh.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; this.Button_Refresh.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); @@ -217,47 +319,11 @@ private void InitializeComponent() this.Button_Refresh.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.Button_Refresh.Name = "Button_Refresh"; this.Button_Refresh.PressedColor = System.Drawing.Color.Transparent; - this.Button_Refresh.ShadowDecoration.CustomizableEdges = customizableEdges6; + this.Button_Refresh.ShadowDecoration.CustomizableEdges = customizableEdges10; this.Button_Refresh.Size = new System.Drawing.Size(36, 40); this.Button_Refresh.TabIndex = 0; this.ToolTip.SetToolTip(this.Button_Refresh, "Refresh your Removable Drive List"); - // - // tableLayoutPanel5 - // - this.tableLayoutPanel5.AutoSize = true; - this.tableLayoutPanel5.ColumnCount = 1; - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel5.Controls.Add(this.Save, 0, 0); - this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanel5.Location = new System.Drawing.Point(523, 1); - this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); - this.tableLayoutPanel5.Name = "tableLayoutPanel5"; - this.tableLayoutPanel5.RowCount = 1; - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel5.Size = new System.Drawing.Size(107, 44); - this.tableLayoutPanel5.TabIndex = 3; - // - // Save - // - this.Save.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.Save.AutoRoundedCorners = true; - this.Save.BorderRadius = 20; - this.Save.Cursor = System.Windows.Forms.Cursors.Hand; - this.Save.CustomizableEdges = customizableEdges7; - this.Save.DisabledState.BorderColor = System.Drawing.Color.DarkGray; - this.Save.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; - this.Save.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); - this.Save.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); - this.Save.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.Save.ForeColor = System.Drawing.Color.White; - this.Save.Location = new System.Drawing.Point(4, 1); - this.Save.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); - this.Save.Name = "Save"; - this.Save.ShadowDecoration.CustomizableEdges = customizableEdges8; - this.Save.Size = new System.Drawing.Size(99, 42); - this.Save.TabIndex = 1; - this.Save.Text = "Organize"; - this.Save.Click += new System.EventHandler(this.Save_Click); + this.Button_Refresh.Visible = false; // // dataGridView1 // @@ -311,7 +377,7 @@ private void InitializeComponent() this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.RowTemplate.Height = 29; - this.dataGridView1.Size = new System.Drawing.Size(722, 483); + this.dataGridView1.Size = new System.Drawing.Size(722, 495); this.dataGridView1.TabIndex = 5; this.dataGridView1.ThemeStyle.AlternatingRowsStyle.BackColor = System.Drawing.Color.White; this.dataGridView1.ThemeStyle.AlternatingRowsStyle.Font = null; @@ -360,7 +426,7 @@ private void InitializeComponent() this.guna2CircleButton1.Location = new System.Drawing.Point(432, 436); this.guna2CircleButton1.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.guna2CircleButton1.Name = "guna2CircleButton1"; - this.guna2CircleButton1.ShadowDecoration.CustomizableEdges = customizableEdges11; + this.guna2CircleButton1.ShadowDecoration.CustomizableEdges = customizableEdges13; this.guna2CircleButton1.ShadowDecoration.Mode = Guna.UI2.WinForms.Enums.ShadowMode.Circle; this.guna2CircleButton1.Size = new System.Drawing.Size(162, 101); this.guna2CircleButton1.TabIndex = 4; @@ -374,7 +440,7 @@ private void InitializeComponent() this.panel1.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.panel1.Name = "panel1"; this.panel1.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.panel1.Size = new System.Drawing.Size(726, 483); + this.panel1.Size = new System.Drawing.Size(726, 495); this.panel1.TabIndex = 6; // // ToolTip @@ -401,16 +467,18 @@ private void InitializeComponent() this.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.Name = "Organize_Cores"; - this.Size = new System.Drawing.Size(726, 606); + this.Size = new System.Drawing.Size(726, 658); this.Panel_Top.ResumeLayout(false); this.Panel_Top.PerformLayout(); this.Panel_Bottom.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.tableLayoutPanel5.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); this.tableLayoutPanel4.ResumeLayout(false); - this.tableLayoutPanel5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.panel1.ResumeLayout(false); this.ResumeLayout(false); @@ -429,8 +497,6 @@ private void InitializeComponent() private TableLayoutPanel tableLayoutPanel2; private Label label3; private TableLayoutPanel tableLayoutPanel4; - private TableLayoutPanel tableLayoutPanel5; - private Guna.UI2.WinForms.Guna2Button Save; private Guna.UI2.WinForms.Guna2ComboBox Pocket_Drive; private Guna.UI2.WinForms.Guna2Button Button_Refresh; private Guna.UI2.WinForms.Guna2CircleButton guna2CircleButton1; @@ -438,5 +504,10 @@ private void InitializeComponent() private DataGridViewTextBoxColumn CoreDeveloper; private Panel panel1; private Guna.UI2.WinForms.Guna2HtmlToolTip ToolTip; + private TableLayoutPanel tableLayoutPanel1; + private Label label1; + private Guna.UI2.WinForms.Guna2ComboBox comboBox2; + private TableLayoutPanel tableLayoutPanel5; + private Guna.UI2.WinForms.Guna2Button Save; } } diff --git a/Controls/Organize_Cores/Organize_Cores.cs b/Controls/Organize_Cores/Organize_Cores.cs index 9b48935..4972de5 100644 --- a/Controls/Organize_Cores/Organize_Cores.cs +++ b/Controls/Organize_Cores/Organize_Cores.cs @@ -4,6 +4,7 @@ using System.Net; using System.ComponentModel; using Pocket_Updater.Forms.Message_Box; +using System.Diagnostics; //using Analogue; namespace Pocket_Updater.Controls.Organize_Cores @@ -90,6 +91,8 @@ public void ReadPlatforms(string Dir) { var Dir_Check = Dir + "Platforms"; + Debug.WriteLine(Dir_Check); + if (Directory.Exists(Dir_Check)) { @@ -182,5 +185,43 @@ private void Button_Refresh_Click(object sender, EventArgs e) dataGridView1.Rows.Clear(); PopulateDrives(); } + + private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) + { + String Location_Type = comboBox2.SelectedItem.ToString(); + if (Location_Type == "Removable Storage") + { + dataGridView1.Rows.Clear(); + PopulateDrives(); + label3.Visible = true; + Pocket_Drive.Visible = true; + Button_Refresh.Visible = true; + + if (Pocket_Drive.SelectedIndex == -1) + { + Save.Enabled = false; + } + else + { + Save.Enabled = true; + } + } + else + { + label3.Visible = false; + Pocket_Drive.Visible = false; + Button_Refresh.Visible = false; + } + if (Location_Type == "Current Directory") + { + //Get Json Data + string Current = Directory.GetCurrentDirectory()+"\\"; + _settings = new SettingsManager(Current); + dataGridView1.Rows.Clear(); + ReadPlatforms(Current); + + //Save.Enabled = true; + } + } } } diff --git a/Controls/Update_Pocket/Update_Pocket.Designer.cs b/Controls/Update_Pocket/Update_Pocket.Designer.cs index 212fd5d..26c7a16 100644 --- a/Controls/Update_Pocket/Update_Pocket.Designer.cs +++ b/Controls/Update_Pocket/Update_Pocket.Designer.cs @@ -42,8 +42,8 @@ private void InitializeComponent() Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges12 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges13 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges14 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges33 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges34 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges41 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges42 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges15 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges16 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges17 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); @@ -62,14 +62,22 @@ private void InitializeComponent() Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges30 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges31 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges32 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges33 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges34 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges35 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges36 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges41 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); - Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges42 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges37 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges38 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges39 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges40 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges43 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges44 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges49 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges50 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges45 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges46 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges47 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges48 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.Panel_Title = new Guna.UI2.WinForms.Guna2Panel(); this.label3 = new System.Windows.Forms.Label(); @@ -95,6 +103,10 @@ private void InitializeComponent() this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.label6 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); + this.Toggle_Alternatives = new Guna.UI2.WinForms.Guna2ToggleSwitch(); + this.label16 = new System.Windows.Forms.Label(); + this.Toggle_Jotego = new Guna.UI2.WinForms.Guna2ToggleSwitch(); + this.label13 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); @@ -103,12 +115,15 @@ private void InitializeComponent() this.Toggle_Skipped = new Guna.UI2.WinForms.Guna2ToggleSwitch(); this.Toggle_Assets = new Guna.UI2.WinForms.Guna2ToggleSwitch(); this.Toggle_Firmware = new Guna.UI2.WinForms.Guna2ToggleSwitch(); - this.label7 = new System.Windows.Forms.Label(); this.Toggle_Jsons = new Guna.UI2.WinForms.Guna2ToggleSwitch(); - this.Toggle_GitHub = new Guna.UI2.WinForms.Guna2ToggleSwitch(); + this.label7 = new System.Windows.Forms.Label(); + this.Toggle_Alternate = new Guna.UI2.WinForms.Guna2ToggleSwitch(); this.label12 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.Toggle_CRC = new Guna.UI2.WinForms.Guna2ToggleSwitch(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); - this.GitHub_Token = new Guna.UI2.WinForms.Guna2TextBox(); + this.Alternate_Location = new Guna.UI2.WinForms.Guna2TextBox(); + this.TextBox2 = new Guna.UI2.WinForms.Guna2TextBox(); this.Button_Save = new Guna.UI2.WinForms.Guna2Button(); this.Panel_Left_Top = new System.Windows.Forms.Panel(); this.textBox1 = new Guna.UI2.WinForms.Guna2TextBox(); @@ -145,7 +160,7 @@ private void InitializeComponent() this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(496, 154); + this.flowLayoutPanel1.Size = new System.Drawing.Size(512, 154); this.flowLayoutPanel1.TabIndex = 11; // // Panel_Title @@ -160,7 +175,7 @@ private void InitializeComponent() this.Panel_Title.Name = "Panel_Title"; this.Panel_Title.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0); this.Panel_Title.ShadowDecoration.CustomizableEdges = customizableEdges2; - this.Panel_Title.Size = new System.Drawing.Size(301, 36); + this.Panel_Title.Size = new System.Drawing.Size(301, 37); this.Panel_Title.TabIndex = 2; // // label3 @@ -168,7 +183,7 @@ private void InitializeComponent() this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Segoe UI", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(0, -2); + this.label3.Location = new System.Drawing.Point(0, -1); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(13, 0, 0, 0); this.label3.Size = new System.Drawing.Size(155, 25); @@ -179,7 +194,7 @@ private void InitializeComponent() // this.guna2Separator1.Anchor = System.Windows.Forms.AnchorStyles.Left; this.guna2Separator1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(107)))), ((int)(((byte)(121))))); - this.guna2Separator1.Location = new System.Drawing.Point(17, 25); + this.guna2Separator1.Location = new System.Drawing.Point(17, 26); this.guna2Separator1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.guna2Separator1.Name = "guna2Separator1"; this.guna2Separator1.Padding = new System.Windows.Forms.Padding(13, 0, 0, 0); @@ -197,7 +212,7 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.Update, 2, 0); this.tableLayoutPanel1.Controls.Add(this.comboBox2, 1, 0); this.tableLayoutPanel1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 42); + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 43); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0); @@ -278,7 +293,7 @@ private void InitializeComponent() this.tableLayoutPanel2.Controls.Add(this.comboBox1, 1, 0); this.tableLayoutPanel2.Controls.Add(this.Button_Refresh, 2, 0); this.tableLayoutPanel2.Controls.Add(this.label2, 0, 0); - this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 85); + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 86); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0); @@ -362,7 +377,7 @@ private void InitializeComponent() this.guna2Panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.guna2Panel1.Name = "guna2Panel1"; this.guna2Panel1.ShadowDecoration.CustomizableEdges = customizableEdges12; - this.guna2Panel1.Size = new System.Drawing.Size(493, 31); + this.guna2Panel1.Size = new System.Drawing.Size(509, 31); this.guna2Panel1.TabIndex = 10; // // label5 @@ -399,7 +414,7 @@ private void InitializeComponent() this.Panel_Status_Title.Name = "Panel_Status_Title"; this.Panel_Status_Title.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0); this.Panel_Status_Title.ShadowDecoration.CustomizableEdges = customizableEdges14; - this.Panel_Status_Title.Size = new System.Drawing.Size(677, 39); + this.Panel_Status_Title.Size = new System.Drawing.Size(661, 39); this.Panel_Status_Title.TabIndex = 3; // // label4 @@ -426,13 +441,13 @@ private void InitializeComponent() this.Panel_Left.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.Panel_Left.Controls.Add(this.Panel_Left_Main); this.Panel_Left.Controls.Add(this.Panel_Left_Top); - this.Panel_Left.CustomizableEdges = customizableEdges33; + this.Panel_Left.CustomizableEdges = customizableEdges41; this.Panel_Left.Dock = System.Windows.Forms.DockStyle.Left; this.Panel_Left.Location = new System.Drawing.Point(0, 0); this.Panel_Left.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Left.Name = "Panel_Left"; - this.Panel_Left.ShadowDecoration.CustomizableEdges = customizableEdges34; - this.Panel_Left.Size = new System.Drawing.Size(496, 627); + this.Panel_Left.ShadowDecoration.CustomizableEdges = customizableEdges42; + this.Panel_Left.Size = new System.Drawing.Size(512, 665); this.Panel_Left.TabIndex = 13; // // Panel_Left_Main @@ -442,7 +457,7 @@ private void InitializeComponent() this.Panel_Left_Main.Location = new System.Drawing.Point(0, 154); this.Panel_Left_Main.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Left_Main.Name = "Panel_Left_Main"; - this.Panel_Left_Main.Size = new System.Drawing.Size(496, 473); + this.Panel_Left_Main.Size = new System.Drawing.Size(512, 511); this.Panel_Left_Main.TabIndex = 14; // // Panel_Left_Bottom @@ -454,7 +469,7 @@ private void InitializeComponent() this.Panel_Left_Bottom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Left_Bottom.Name = "Panel_Left_Bottom"; this.Panel_Left_Bottom.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.Panel_Left_Bottom.Size = new System.Drawing.Size(496, 473); + this.Panel_Left_Bottom.Size = new System.Drawing.Size(512, 511); this.Panel_Left_Bottom.TabIndex = 12; // // flowLayoutPanel2 @@ -467,7 +482,7 @@ private void InitializeComponent() this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 31); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(493, 442); + this.flowLayoutPanel2.Size = new System.Drawing.Size(509, 480); this.flowLayoutPanel2.TabIndex = 11; // // tableLayoutPanel3 @@ -478,6 +493,10 @@ private void InitializeComponent() this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel3.Controls.Add(this.label6, 0, 4); this.tableLayoutPanel3.Controls.Add(this.label8, 0, 3); + this.tableLayoutPanel3.Controls.Add(this.Toggle_Alternatives, 1, 7); + this.tableLayoutPanel3.Controls.Add(this.label16, 0, 7); + this.tableLayoutPanel3.Controls.Add(this.Toggle_Jotego, 1, 6); + this.tableLayoutPanel3.Controls.Add(this.label13, 0, 6); this.tableLayoutPanel3.Controls.Add(this.label9, 0, 2); this.tableLayoutPanel3.Controls.Add(this.label10, 0, 1); this.tableLayoutPanel3.Controls.Add(this.label11, 0, 0); @@ -486,15 +505,19 @@ private void InitializeComponent() this.tableLayoutPanel3.Controls.Add(this.Toggle_Skipped, 1, 4); this.tableLayoutPanel3.Controls.Add(this.Toggle_Assets, 1, 1); this.tableLayoutPanel3.Controls.Add(this.Toggle_Firmware, 1, 0); - this.tableLayoutPanel3.Controls.Add(this.label7, 0, 5); this.tableLayoutPanel3.Controls.Add(this.Toggle_Jsons, 1, 5); - this.tableLayoutPanel3.Controls.Add(this.Toggle_GitHub, 1, 6); - this.tableLayoutPanel3.Controls.Add(this.label12, 0, 6); + this.tableLayoutPanel3.Controls.Add(this.label7, 0, 5); + this.tableLayoutPanel3.Controls.Add(this.Toggle_Alternate, 1, 9); + this.tableLayoutPanel3.Controls.Add(this.label12, 0, 9); + this.tableLayoutPanel3.Controls.Add(this.label14, 0, 8); + this.tableLayoutPanel3.Controls.Add(this.Toggle_CRC, 1, 8); this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 2); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0); - this.tableLayoutPanel3.RowCount = 7; + this.tableLayoutPanel3.RowCount = 10; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); @@ -502,7 +525,8 @@ private void InitializeComponent() this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel3.Size = new System.Drawing.Size(292, 203); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.Size = new System.Drawing.Size(327, 290); this.tableLayoutPanel3.TabIndex = 0; // // label6 @@ -510,7 +534,7 @@ private void InitializeComponent() this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label6.Location = new System.Drawing.Point(78, 120); + this.label6.Location = new System.Drawing.Point(113, 120); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(160, 20); this.label6.TabIndex = 11; @@ -522,19 +546,93 @@ private void InitializeComponent() this.label8.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label8.Location = new System.Drawing.Point(25, 91); + this.label8.Location = new System.Drawing.Point(60, 91); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(213, 20); this.label8.TabIndex = 9; this.label8.Text = "Download Pre-Release Cores:"; this.ToolTip.SetToolTip(this.label8, "Enable/Disable Downloadig Alpha/Beta Pre-Release Cores"); // + // Toggle_Alternatives + // + this.Toggle_Alternatives.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.Toggle_Alternatives.AutoRoundedCorners = true; + this.Toggle_Alternatives.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Alternatives.CheckedState.BorderRadius = 11; + this.Toggle_Alternatives.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Alternatives.CheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Alternatives.CheckedState.InnerBorderRadius = 7; + this.Toggle_Alternatives.CheckedState.InnerColor = System.Drawing.Color.White; + this.Toggle_Alternatives.Cursor = System.Windows.Forms.Cursors.Hand; + this.Toggle_Alternatives.CustomizableEdges = customizableEdges15; + this.Toggle_Alternatives.Location = new System.Drawing.Point(279, 205); + this.Toggle_Alternatives.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Toggle_Alternatives.Name = "Toggle_Alternatives"; + this.Toggle_Alternatives.ShadowDecoration.CustomizableEdges = customizableEdges16; + this.Toggle_Alternatives.Size = new System.Drawing.Size(45, 25); + this.Toggle_Alternatives.TabIndex = 16; + this.Toggle_Alternatives.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Alternatives.UncheckedState.BorderRadius = 11; + this.Toggle_Alternatives.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Alternatives.UncheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Alternatives.UncheckedState.InnerBorderRadius = 7; + this.Toggle_Alternatives.UncheckedState.InnerColor = System.Drawing.Color.White; + // + // label16 + // + this.label16.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label16.Location = new System.Drawing.Point(61, 207); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(212, 20); + this.label16.TabIndex = 15; + this.label16.Text = "Skip Alternative Arcade Files:"; + this.ToolTip.SetToolTip(this.label16, "Skip downloading any Alternative Arcade Files"); + // + // Toggle_Jotego + // + this.Toggle_Jotego.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.Toggle_Jotego.AutoRoundedCorners = true; + this.Toggle_Jotego.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Jotego.CheckedState.BorderRadius = 11; + this.Toggle_Jotego.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Jotego.CheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Jotego.CheckedState.InnerBorderRadius = 7; + this.Toggle_Jotego.CheckedState.InnerColor = System.Drawing.Color.White; + this.Toggle_Jotego.Cursor = System.Windows.Forms.Cursors.Hand; + this.Toggle_Jotego.CustomizableEdges = customizableEdges17; + this.Toggle_Jotego.Location = new System.Drawing.Point(279, 176); + this.Toggle_Jotego.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Toggle_Jotego.Name = "Toggle_Jotego"; + this.Toggle_Jotego.ShadowDecoration.CustomizableEdges = customizableEdges18; + this.Toggle_Jotego.Size = new System.Drawing.Size(45, 25); + this.Toggle_Jotego.TabIndex = 15; + this.Toggle_Jotego.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Jotego.UncheckedState.BorderRadius = 11; + this.Toggle_Jotego.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Jotego.UncheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Jotego.UncheckedState.InnerBorderRadius = 7; + this.Toggle_Jotego.UncheckedState.InnerColor = System.Drawing.Color.White; + // + // label13 + // + this.label13.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label13.Location = new System.Drawing.Point(99, 178); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(174, 20); + this.label13.TabIndex = 14; + this.label13.Text = "Fix Jotego Core Names:"; + this.ToolTip.SetToolTip(this.label13, "Automatically rename Jotego Cores to more friendly names"); + // // label9 // this.label9.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label9.Location = new System.Drawing.Point(91, 62); + this.label9.Location = new System.Drawing.Point(126, 62); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(147, 20); this.label9.TabIndex = 7; @@ -546,7 +644,7 @@ private void InitializeComponent() this.label10.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label10.Location = new System.Drawing.Point(66, 33); + this.label10.Location = new System.Drawing.Point(101, 33); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(172, 20); this.label10.TabIndex = 5; @@ -558,7 +656,7 @@ private void InitializeComponent() this.label11.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label11.Location = new System.Drawing.Point(33, 4); + this.label11.Location = new System.Drawing.Point(68, 4); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(205, 20); this.label11.TabIndex = 3; @@ -576,11 +674,11 @@ private void InitializeComponent() this.Toggle_PreRelease.CheckedState.InnerBorderRadius = 7; this.Toggle_PreRelease.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_PreRelease.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_PreRelease.CustomizableEdges = customizableEdges15; - this.Toggle_PreRelease.Location = new System.Drawing.Point(244, 89); + this.Toggle_PreRelease.CustomizableEdges = customizableEdges19; + this.Toggle_PreRelease.Location = new System.Drawing.Point(279, 89); this.Toggle_PreRelease.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_PreRelease.Name = "Toggle_PreRelease"; - this.Toggle_PreRelease.ShadowDecoration.CustomizableEdges = customizableEdges16; + this.Toggle_PreRelease.ShadowDecoration.CustomizableEdges = customizableEdges20; this.Toggle_PreRelease.Size = new System.Drawing.Size(45, 25); this.Toggle_PreRelease.TabIndex = 10; this.Toggle_PreRelease.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -601,11 +699,11 @@ private void InitializeComponent() this.Toggle_Platforms.CheckedState.InnerBorderRadius = 7; this.Toggle_Platforms.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_Platforms.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_Platforms.CustomizableEdges = customizableEdges17; - this.Toggle_Platforms.Location = new System.Drawing.Point(244, 60); + this.Toggle_Platforms.CustomizableEdges = customizableEdges21; + this.Toggle_Platforms.Location = new System.Drawing.Point(279, 60); this.Toggle_Platforms.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_Platforms.Name = "Toggle_Platforms"; - this.Toggle_Platforms.ShadowDecoration.CustomizableEdges = customizableEdges18; + this.Toggle_Platforms.ShadowDecoration.CustomizableEdges = customizableEdges22; this.Toggle_Platforms.Size = new System.Drawing.Size(45, 25); this.Toggle_Platforms.TabIndex = 15; this.Toggle_Platforms.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -626,11 +724,11 @@ private void InitializeComponent() this.Toggle_Skipped.CheckedState.InnerBorderRadius = 7; this.Toggle_Skipped.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_Skipped.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_Skipped.CustomizableEdges = customizableEdges19; - this.Toggle_Skipped.Location = new System.Drawing.Point(244, 118); + this.Toggle_Skipped.CustomizableEdges = customizableEdges23; + this.Toggle_Skipped.Location = new System.Drawing.Point(279, 118); this.Toggle_Skipped.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_Skipped.Name = "Toggle_Skipped"; - this.Toggle_Skipped.ShadowDecoration.CustomizableEdges = customizableEdges20; + this.Toggle_Skipped.ShadowDecoration.CustomizableEdges = customizableEdges24; this.Toggle_Skipped.Size = new System.Drawing.Size(45, 25); this.Toggle_Skipped.TabIndex = 12; this.Toggle_Skipped.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -651,11 +749,11 @@ private void InitializeComponent() this.Toggle_Assets.CheckedState.InnerBorderRadius = 7; this.Toggle_Assets.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_Assets.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_Assets.CustomizableEdges = customizableEdges21; - this.Toggle_Assets.Location = new System.Drawing.Point(244, 31); + this.Toggle_Assets.CustomizableEdges = customizableEdges25; + this.Toggle_Assets.Location = new System.Drawing.Point(279, 31); this.Toggle_Assets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_Assets.Name = "Toggle_Assets"; - this.Toggle_Assets.ShadowDecoration.CustomizableEdges = customizableEdges22; + this.Toggle_Assets.ShadowDecoration.CustomizableEdges = customizableEdges26; this.Toggle_Assets.Size = new System.Drawing.Size(45, 25); this.Toggle_Assets.TabIndex = 16; this.Toggle_Assets.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -676,11 +774,11 @@ private void InitializeComponent() this.Toggle_Firmware.CheckedState.InnerBorderRadius = 7; this.Toggle_Firmware.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_Firmware.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_Firmware.CustomizableEdges = customizableEdges23; - this.Toggle_Firmware.Location = new System.Drawing.Point(244, 2); + this.Toggle_Firmware.CustomizableEdges = customizableEdges27; + this.Toggle_Firmware.Location = new System.Drawing.Point(279, 2); this.Toggle_Firmware.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_Firmware.Name = "Toggle_Firmware"; - this.Toggle_Firmware.ShadowDecoration.CustomizableEdges = customizableEdges24; + this.Toggle_Firmware.ShadowDecoration.CustomizableEdges = customizableEdges28; this.Toggle_Firmware.Size = new System.Drawing.Size(45, 25); this.Toggle_Firmware.TabIndex = 17; this.Toggle_Firmware.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -689,19 +787,6 @@ private void InitializeComponent() this.Toggle_Firmware.UncheckedState.InnerBorderColor = System.Drawing.Color.White; this.Toggle_Firmware.UncheckedState.InnerBorderRadius = 7; this.Toggle_Firmware.UncheckedState.InnerColor = System.Drawing.Color.White; - // - // label7 - // - this.label7.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label7.Location = new System.Drawing.Point(62, 149); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(176, 20); - this.label7.TabIndex = 13; - this.label7.Text = "Generate PCECD JSONs:"; - this.ToolTip.SetToolTip(this.label7, "This will auto create the required JSON Files for the PCECD Games on your SD Card" + - ""); // // Toggle_Jsons // @@ -714,11 +799,11 @@ private void InitializeComponent() this.Toggle_Jsons.CheckedState.InnerBorderRadius = 7; this.Toggle_Jsons.CheckedState.InnerColor = System.Drawing.Color.White; this.Toggle_Jsons.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_Jsons.CustomizableEdges = customizableEdges25; - this.Toggle_Jsons.Location = new System.Drawing.Point(244, 147); + this.Toggle_Jsons.CustomizableEdges = customizableEdges29; + this.Toggle_Jsons.Location = new System.Drawing.Point(279, 147); this.Toggle_Jsons.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Toggle_Jsons.Name = "Toggle_Jsons"; - this.Toggle_Jsons.ShadowDecoration.CustomizableEdges = customizableEdges26; + this.Toggle_Jsons.ShadowDecoration.CustomizableEdges = customizableEdges30; this.Toggle_Jsons.Size = new System.Drawing.Size(45, 25); this.Toggle_Jsons.TabIndex = 14; this.Toggle_Jsons.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); @@ -728,86 +813,167 @@ private void InitializeComponent() this.Toggle_Jsons.UncheckedState.InnerBorderRadius = 7; this.Toggle_Jsons.UncheckedState.InnerColor = System.Drawing.Color.White; // - // Toggle_GitHub - // - this.Toggle_GitHub.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.Toggle_GitHub.AutoRoundedCorners = true; - this.Toggle_GitHub.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); - this.Toggle_GitHub.CheckedState.BorderRadius = 11; - this.Toggle_GitHub.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); - this.Toggle_GitHub.CheckedState.InnerBorderColor = System.Drawing.Color.White; - this.Toggle_GitHub.CheckedState.InnerBorderRadius = 7; - this.Toggle_GitHub.CheckedState.InnerColor = System.Drawing.Color.White; - this.Toggle_GitHub.Cursor = System.Windows.Forms.Cursors.Hand; - this.Toggle_GitHub.CustomizableEdges = customizableEdges27; - this.Toggle_GitHub.Location = new System.Drawing.Point(244, 176); - this.Toggle_GitHub.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.Toggle_GitHub.Name = "Toggle_GitHub"; - this.Toggle_GitHub.ShadowDecoration.CustomizableEdges = customizableEdges28; - this.Toggle_GitHub.Size = new System.Drawing.Size(45, 25); - this.Toggle_GitHub.TabIndex = 19; - this.Toggle_GitHub.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); - this.Toggle_GitHub.UncheckedState.BorderRadius = 11; - this.Toggle_GitHub.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); - this.Toggle_GitHub.UncheckedState.InnerBorderColor = System.Drawing.Color.White; - this.Toggle_GitHub.UncheckedState.InnerBorderRadius = 7; - this.Toggle_GitHub.UncheckedState.InnerColor = System.Drawing.Color.White; - this.Toggle_GitHub.CheckedChanged += new System.EventHandler(this.Toggle_GitHub_CheckedChanged); + // label7 + // + this.label7.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label7.Location = new System.Drawing.Point(97, 149); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(176, 20); + this.label7.TabIndex = 13; + this.label7.Text = "Generate PCECD JSONs:"; + this.ToolTip.SetToolTip(this.label7, "This will auto create the required JSON Files for the PCECD Games on your SD Card" + + ""); + // + // Toggle_Alternate + // + this.Toggle_Alternate.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.Toggle_Alternate.AutoRoundedCorners = true; + this.Toggle_Alternate.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Alternate.CheckedState.BorderRadius = 11; + this.Toggle_Alternate.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_Alternate.CheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Alternate.CheckedState.InnerBorderRadius = 7; + this.Toggle_Alternate.CheckedState.InnerColor = System.Drawing.Color.White; + this.Toggle_Alternate.Cursor = System.Windows.Forms.Cursors.Hand; + this.Toggle_Alternate.CustomizableEdges = customizableEdges31; + this.Toggle_Alternate.Location = new System.Drawing.Point(279, 263); + this.Toggle_Alternate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Toggle_Alternate.Name = "Toggle_Alternate"; + this.Toggle_Alternate.ShadowDecoration.CustomizableEdges = customizableEdges32; + this.Toggle_Alternate.Size = new System.Drawing.Size(45, 25); + this.Toggle_Alternate.TabIndex = 19; + this.Toggle_Alternate.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Alternate.UncheckedState.BorderRadius = 11; + this.Toggle_Alternate.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_Alternate.UncheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_Alternate.UncheckedState.InnerBorderRadius = 7; + this.Toggle_Alternate.UncheckedState.InnerColor = System.Drawing.Color.White; + this.Toggle_Alternate.CheckedChanged += new System.EventHandler(this.Toggle_Alternate_CheckedChanged); // // label12 // this.label12.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label12.AutoSize = true; this.label12.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.label12.Location = new System.Drawing.Point(99, 178); + this.label12.Location = new System.Drawing.Point(25, 265); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(139, 20); + this.label12.Size = new System.Drawing.Size(248, 20); this.label12.TabIndex = 18; - this.label12.Text = "Use GitHub Token:"; - this.ToolTip.SetToolTip(this.label12, "This is an Optional setting to use a Personal GitHub Token to avoid Rate Limit Is" + - "sues/Errors"); + this.label12.Text = "Use Alternate Download Location:"; + this.ToolTip.SetToolTip(this.label12, "You can supply your own Download URL/Location to get your ROMS and BIOS instead o" + + "f using Archive.org by default."); + // + // label14 + // + this.label14.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label14.Location = new System.Drawing.Point(180, 236); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(93, 20); + this.label14.TabIndex = 15; + this.label14.Text = "CRC Checks:"; + this.ToolTip.SetToolTip(this.label14, "Enable/Disable CRC checking for ROMS/BIOS. Disabling should speed the update proc" + + "ess up"); + // + // Toggle_CRC + // + this.Toggle_CRC.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.Toggle_CRC.AutoRoundedCorners = true; + this.Toggle_CRC.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_CRC.CheckedState.BorderRadius = 11; + this.Toggle_CRC.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Toggle_CRC.CheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_CRC.CheckedState.InnerBorderRadius = 7; + this.Toggle_CRC.CheckedState.InnerColor = System.Drawing.Color.White; + this.Toggle_CRC.Cursor = System.Windows.Forms.Cursors.Hand; + this.Toggle_CRC.CustomizableEdges = customizableEdges33; + this.Toggle_CRC.Location = new System.Drawing.Point(279, 234); + this.Toggle_CRC.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Toggle_CRC.Name = "Toggle_CRC"; + this.Toggle_CRC.ShadowDecoration.CustomizableEdges = customizableEdges34; + this.Toggle_CRC.Size = new System.Drawing.Size(45, 25); + this.Toggle_CRC.TabIndex = 15; + this.Toggle_CRC.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_CRC.UncheckedState.BorderRadius = 11; + this.Toggle_CRC.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.Toggle_CRC.UncheckedState.InnerBorderColor = System.Drawing.Color.White; + this.Toggle_CRC.UncheckedState.InnerBorderRadius = 7; + this.Toggle_CRC.UncheckedState.InnerColor = System.Drawing.Color.White; // // tableLayoutPanel4 // - this.tableLayoutPanel4.AutoSize = true; - this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanel4.ColumnCount = 1; this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel4.Controls.Add(this.GitHub_Token, 0, 0); - this.tableLayoutPanel4.Controls.Add(this.Button_Save, 0, 1); - this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 209); + this.tableLayoutPanel4.Controls.Add(this.Alternate_Location, 0, 0); + this.tableLayoutPanel4.Controls.Add(this.TextBox2, 0, 1); + this.tableLayoutPanel4.Controls.Add(this.Button_Save, 0, 2); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 296); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; - this.tableLayoutPanel4.RowCount = 2; + this.tableLayoutPanel4.RowCount = 3; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel4.Size = new System.Drawing.Size(415, 96); + this.tableLayoutPanel4.Size = new System.Drawing.Size(352, 132); this.tableLayoutPanel4.TabIndex = 2; // - // GitHub_Token - // - this.GitHub_Token.AutoRoundedCorners = true; - this.GitHub_Token.BorderRadius = 18; - this.GitHub_Token.CustomizableEdges = customizableEdges29; - this.GitHub_Token.DefaultText = ""; - this.GitHub_Token.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); - this.GitHub_Token.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); - this.GitHub_Token.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); - this.GitHub_Token.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); - this.GitHub_Token.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); - this.GitHub_Token.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.GitHub_Token.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); - this.GitHub_Token.Location = new System.Drawing.Point(28, 2); - this.GitHub_Token.Margin = new System.Windows.Forms.Padding(28, 2, 3, 2); - this.GitHub_Token.Name = "GitHub_Token"; - this.GitHub_Token.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); - this.GitHub_Token.PasswordChar = '\0'; - this.GitHub_Token.PlaceholderText = ""; - this.GitHub_Token.SelectedText = ""; - this.GitHub_Token.ShadowDecoration.CustomizableEdges = customizableEdges30; - this.GitHub_Token.Size = new System.Drawing.Size(384, 38); - this.GitHub_Token.TabIndex = 1; - this.GitHub_Token.Visible = false; + // Alternate_Location + // + this.Alternate_Location.AutoRoundedCorners = true; + this.Alternate_Location.BorderRadius = 18; + this.Alternate_Location.CustomizableEdges = customizableEdges35; + this.Alternate_Location.DefaultText = ""; + this.Alternate_Location.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.Alternate_Location.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.Alternate_Location.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.Alternate_Location.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.Alternate_Location.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(44)))), ((int)(((byte)(66))))); + this.Alternate_Location.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Alternate_Location.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.Alternate_Location.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.Alternate_Location.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.Alternate_Location.Location = new System.Drawing.Point(28, 2); + this.Alternate_Location.Margin = new System.Windows.Forms.Padding(28, 2, 3, 2); + this.Alternate_Location.Name = "Alternate_Location"; + this.Alternate_Location.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); + this.Alternate_Location.PasswordChar = '\0'; + this.Alternate_Location.PlaceholderText = ""; + this.Alternate_Location.SelectedText = ""; + this.Alternate_Location.ShadowDecoration.CustomizableEdges = customizableEdges36; + this.Alternate_Location.Size = new System.Drawing.Size(304, 38); + this.Alternate_Location.TabIndex = 1; + this.Alternate_Location.Visible = false; + // + // TextBox2 + // + this.TextBox2.BackColor = System.Drawing.Color.Transparent; + this.TextBox2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); + this.TextBox2.BorderThickness = 0; + this.TextBox2.CustomizableEdges = customizableEdges37; + this.TextBox2.DefaultText = "Suggested Location: https://updater.retrodriven.com"; + this.TextBox2.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.TextBox2.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.TextBox2.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.TextBox2.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.TextBox2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); + this.TextBox2.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.TextBox2.Font = new System.Drawing.Font("Segoe UI", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point); + this.TextBox2.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.TextBox2.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); + this.TextBox2.Location = new System.Drawing.Point(28, 42); + this.TextBox2.Margin = new System.Windows.Forms.Padding(28, 0, 2, 2); + this.TextBox2.Name = "TextBox2"; + this.TextBox2.PasswordChar = '\0'; + this.TextBox2.PlaceholderText = ""; + this.TextBox2.ReadOnly = true; + this.TextBox2.SelectedText = ""; + this.TextBox2.ShadowDecoration.CustomizableEdges = customizableEdges38; + this.TextBox2.Size = new System.Drawing.Size(322, 21); + this.TextBox2.TabIndex = 3; + this.TextBox2.Visible = false; // // Button_Save // @@ -815,17 +981,17 @@ private void InitializeComponent() this.Button_Save.AutoRoundedCorners = true; this.Button_Save.BorderRadius = 17; this.Button_Save.Cursor = System.Windows.Forms.Cursors.Hand; - this.Button_Save.CustomizableEdges = customizableEdges31; + this.Button_Save.CustomizableEdges = customizableEdges39; this.Button_Save.DisabledState.BorderColor = System.Drawing.Color.DarkGray; this.Button_Save.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; this.Button_Save.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); this.Button_Save.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); this.Button_Save.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.Button_Save.ForeColor = System.Drawing.Color.White; - this.Button_Save.Location = new System.Drawing.Point(209, 57); - this.Button_Save.Margin = new System.Windows.Forms.Padding(88, 15, 3, 2); + this.Button_Save.Location = new System.Drawing.Point(178, 79); + this.Button_Save.Margin = new System.Windows.Forms.Padding(88, 0, 3, 2); this.Button_Save.Name = "Button_Save"; - this.Button_Save.ShadowDecoration.CustomizableEdges = customizableEdges32; + this.Button_Save.ShadowDecoration.CustomizableEdges = customizableEdges40; this.Button_Save.Size = new System.Drawing.Size(81, 37); this.Button_Save.TabIndex = 0; this.Button_Save.Text = "Save"; @@ -838,7 +1004,7 @@ private void InitializeComponent() this.Panel_Left_Top.Location = new System.Drawing.Point(0, 0); this.Panel_Left_Top.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Left_Top.Name = "Panel_Left_Top"; - this.Panel_Left_Top.Size = new System.Drawing.Size(496, 154); + this.Panel_Left_Top.Size = new System.Drawing.Size(512, 154); this.Panel_Left_Top.TabIndex = 13; // // textBox1 @@ -847,7 +1013,7 @@ private void InitializeComponent() this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(44)))), ((int)(((byte)(66))))); this.textBox1.BorderRadius = 10; this.textBox1.BorderThickness = 0; - this.textBox1.CustomizableEdges = customizableEdges35; + this.textBox1.CustomizableEdges = customizableEdges43; this.textBox1.DefaultText = ""; this.textBox1.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); this.textBox1.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); @@ -868,46 +1034,46 @@ private void InitializeComponent() this.textBox1.ReadOnly = true; this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.textBox1.SelectedText = ""; - this.textBox1.ShadowDecoration.CustomizableEdges = customizableEdges36; - this.textBox1.Size = new System.Drawing.Size(673, 588); + this.textBox1.ShadowDecoration.CustomizableEdges = customizableEdges44; + this.textBox1.Size = new System.Drawing.Size(657, 626); this.textBox1.TabIndex = 1; // // Panel_Right // this.Panel_Right.Controls.Add(this.Panel_Right_Main); this.Panel_Right.Controls.Add(this.Panel_Right_Top); - this.Panel_Right.CustomizableEdges = customizableEdges41; + this.Panel_Right.CustomizableEdges = customizableEdges49; this.Panel_Right.Dock = System.Windows.Forms.DockStyle.Fill; - this.Panel_Right.Location = new System.Drawing.Point(496, 0); + this.Panel_Right.Location = new System.Drawing.Point(512, 0); this.Panel_Right.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Right.Name = "Panel_Right"; - this.Panel_Right.ShadowDecoration.CustomizableEdges = customizableEdges42; - this.Panel_Right.Size = new System.Drawing.Size(677, 627); + this.Panel_Right.ShadowDecoration.CustomizableEdges = customizableEdges50; + this.Panel_Right.Size = new System.Drawing.Size(661, 665); this.Panel_Right.TabIndex = 14; // // Panel_Right_Main // this.Panel_Right_Main.Controls.Add(this.textBox1); - this.Panel_Right_Main.CustomizableEdges = customizableEdges37; + this.Panel_Right_Main.CustomizableEdges = customizableEdges45; this.Panel_Right_Main.Dock = System.Windows.Forms.DockStyle.Fill; this.Panel_Right_Main.Location = new System.Drawing.Point(0, 39); this.Panel_Right_Main.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Right_Main.Name = "Panel_Right_Main"; this.Panel_Right_Main.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0); - this.Panel_Right_Main.ShadowDecoration.CustomizableEdges = customizableEdges38; - this.Panel_Right_Main.Size = new System.Drawing.Size(677, 588); + this.Panel_Right_Main.ShadowDecoration.CustomizableEdges = customizableEdges46; + this.Panel_Right_Main.Size = new System.Drawing.Size(661, 626); this.Panel_Right_Main.TabIndex = 1; // // Panel_Right_Top // this.Panel_Right_Top.Controls.Add(this.Panel_Status_Title); - this.Panel_Right_Top.CustomizableEdges = customizableEdges39; + this.Panel_Right_Top.CustomizableEdges = customizableEdges47; this.Panel_Right_Top.Dock = System.Windows.Forms.DockStyle.Top; this.Panel_Right_Top.Location = new System.Drawing.Point(0, 0); this.Panel_Right_Top.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Panel_Right_Top.Name = "Panel_Right_Top"; - this.Panel_Right_Top.ShadowDecoration.CustomizableEdges = customizableEdges40; - this.Panel_Right_Top.Size = new System.Drawing.Size(677, 39); + this.Panel_Right_Top.ShadowDecoration.CustomizableEdges = customizableEdges48; + this.Panel_Right_Top.Size = new System.Drawing.Size(661, 39); this.Panel_Right_Top.TabIndex = 0; // // ToolTip @@ -931,7 +1097,7 @@ private void InitializeComponent() this.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "Update_Pocket"; - this.Size = new System.Drawing.Size(1173, 627); + this.Size = new System.Drawing.Size(1173, 665); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); this.Panel_Title.ResumeLayout(false); @@ -1005,12 +1171,19 @@ private void InitializeComponent() private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Skipped; private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Assets; private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Firmware; - private Guna.UI2.WinForms.Guna2TextBox GitHub_Token; + private Guna.UI2.WinForms.Guna2TextBox Alternate_Location; private Guna.UI2.WinForms.Guna2Button Button_Save; private Guna.UI2.WinForms.Guna2HtmlToolTip ToolTip; private TableLayoutPanel tableLayoutPanel4; - private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_GitHub; + private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Alternate; private Label label12; private Guna.UI2.WinForms.Guna2Separator guna2Separator1; + private Label label14; + private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_CRC; + private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Jotego; + private Label label13; + private Guna.UI2.WinForms.Guna2ToggleSwitch Toggle_Alternatives; + private Label label16; + private Guna.UI2.WinForms.Guna2TextBox TextBox2; } } diff --git a/Controls/Update_Pocket/Update_Pocket.cs b/Controls/Update_Pocket/Update_Pocket.cs index b4847c4..18d3a12 100644 --- a/Controls/Update_Pocket/Update_Pocket.cs +++ b/Controls/Update_Pocket/Update_Pocket.cs @@ -41,7 +41,7 @@ public async Task RunCoreUpdateProcess(string updatePath, string coresJsonPath, Button_Refresh.Enabled = false; comboBox1.Enabled = false; //GitHub Token - //_updater.SetGithubApiKey("apikey"); + _updater.SetGithubApiKey("apikey"); await _updater.RunUpdates(); Update.Enabled = true; Button_Refresh.Enabled = true; @@ -88,6 +88,7 @@ private async void Update_Click(object sender, EventArgs e) _updater.DownloadAssets(_settings.GetConfig().download_assets); _updater.DeleteSkippedCores(_settings.GetConfig().delete_skipped_cores); _updater.PreservePlatformsFolder(_settings.GetConfig().preserve_platforms_folder); + _updater.RenameJotegoCores(_settings.GetConfig().fix_jt_names); if (github_token != null) { @@ -134,6 +135,7 @@ private async void Update_Click(object sender, EventArgs e) _updater.DownloadAssets(_settings.GetConfig().download_assets); _updater.DeleteSkippedCores(_settings.GetConfig().delete_skipped_cores); _updater.PreservePlatformsFolder(_settings.GetConfig().preserve_platforms_folder); + _updater.RenameJotegoCores(_settings.GetConfig().fix_jt_names); if (github_token != null) { @@ -379,19 +381,33 @@ public async Task ReadSettingsAsync() string Current_Dir = Directory.GetCurrentDirectory(); _settings = new SettingsManager(Current_Dir); - //GitHub Token - GitHub_Token.Text = _settings.GetConfig().github_token; - - if (_settings.GetConfig().github_token != null) + //Alternate Arcade Files + if (_settings.GetConfig().skip_alternative_assets == true) { - Toggle_GitHub.Checked = true; + Toggle_Alternatives.Checked = true; } else { - Toggle_GitHub.Checked = false; + Toggle_Alternatives.Checked = false; } + //GitHub Token + //Alternate_Location.Text = _settings.GetConfig().use_custom_archive; + if (_settings.GetConfig().use_custom_archive == true) + { + Toggle_Alternate.Checked = true; + + var custom = _settings.GetConfig().custom_archive; + var url = custom["url"]; + var index = custom["index"]; + Alternate_Location.Text = url; + //CRC_Json.Text = index; + } + else + { + Toggle_Alternate.Checked = false; + } //Download Pocket Firmware if (_settings.GetConfig().download_firmware == true) { @@ -437,6 +453,24 @@ public async Task ReadSettingsAsync() { Toggle_Jsons.Checked = false; } + //Jotego Core Rename + if (_settings.GetConfig().fix_jt_names == true) + { + Toggle_Jotego.Checked = true; + } + else + { + Toggle_Jotego.Checked = false; + } + //CRC Checking + if (_settings.GetConfig().crc_check == true) + { + Toggle_CRC.Checked = true; + } + else + { + Toggle_CRC.Checked = false; + } //Pre-release Cores List cores = await CoresService.GetCores(); foreach (Core core in cores) @@ -456,11 +490,36 @@ public async Task ReadSettingsAsync() } private async void Button_Save_Click(object sender, EventArgs e) { - string value = GitHub_Token.Text; + //string value = Alternate_Location.Text; Config config = _settings.GetConfig(); //GitHub Token - config.github_token = value; + //config.github_token = value; + + //Alternate Arcade Files + if (Toggle_Alternatives.Checked == true) + { + config.skip_alternative_assets = true; + } + else + { + config.skip_alternative_assets = false; + } + + //Alternate Download Location + if (Toggle_Alternate.Checked == true) + { + config.use_custom_archive = true; + + var custom = _settings.GetConfig().custom_archive; + custom["url"] = Alternate_Location.Text; + //custom["index"] = CRC_Json.Text; + _settings.GetConfig().custom_archive = custom; + } + else + { + config.use_custom_archive = false; + } //Download Pocket Firmware if (Toggle_Firmware.Checked == true) @@ -507,6 +566,24 @@ private async void Button_Save_Click(object sender, EventArgs e) { config.build_instance_jsons = false; } + //Jotego Rename + if (Toggle_Jotego.Checked == true) + { + config.fix_jt_names = true; + } + else + { + config.fix_jt_names = false; + } + //CRC Check + if (Toggle_CRC.Checked == true) + { + config.crc_check = true; + } + else + { + config.crc_check = false; + } //Pre-Release Cores try { @@ -558,15 +635,25 @@ private void Button_Refresh_Click_1(object sender, EventArgs e) } } - private void Toggle_GitHub_CheckedChanged(object sender, EventArgs e) + private void Toggle_Alternate_CheckedChanged(object sender, EventArgs e) { - if (Toggle_GitHub.Checked == true) - { - GitHub_Token.Visible = true; - } - if (Toggle_GitHub.Checked == false) - { - GitHub_Token.Visible = false; + if (Toggle_Alternate.Checked == true) + { + Alternate_Location.Visible = true; + TextBox2.Visible = true; + //CRC_Json.Visible = true; + //label15.Visible = true; + //label17.Visible = true; + //label18.Visible = true; + } + if (Toggle_Alternate.Checked == false) + { + Alternate_Location.Visible = false; + TextBox2.Visible = false; + //CRC_Json.Visible = false; + //label15.Visible = false; + //label17.Visible = false; + //label18.Visible = false; } } } diff --git a/Forms/Main/Form1.Designer.cs b/Forms/Main/Form1.Designer.cs index 594b84e..bce3768 100644 --- a/Forms/Main/Form1.Designer.cs +++ b/Forms/Main/Form1.Designer.cs @@ -120,7 +120,7 @@ private void InitializeComponent() this.Panel_Top.Location = new System.Drawing.Point(0, 0); this.Panel_Top.Name = "Panel_Top"; this.Panel_Top.ShadowDecoration.CustomizableEdges = customizableEdges24; - this.Panel_Top.Size = new System.Drawing.Size(1273, 46); + this.Panel_Top.Size = new System.Drawing.Size(1399, 46); this.Panel_Top.TabIndex = 28; // // guna2HtmlLabel1 @@ -131,9 +131,9 @@ private void InitializeComponent() this.guna2HtmlLabel1.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.guna2HtmlLabel1.Location = new System.Drawing.Point(12, 12); this.guna2HtmlLabel1.Name = "guna2HtmlLabel1"; - this.guna2HtmlLabel1.Size = new System.Drawing.Size(212, 30); + this.guna2HtmlLabel1.Size = new System.Drawing.Size(169, 23); this.guna2HtmlLabel1.TabIndex = 0; - this.guna2HtmlLabel1.Text = "Pocket Updater v1.5.5"; + this.guna2HtmlLabel1.Text = "Pocket Updater v1.5.6"; // // guna2ControlBox1 // @@ -144,7 +144,7 @@ private void InitializeComponent() this.guna2ControlBox1.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox1.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox1.IconColor = System.Drawing.Color.White; - this.guna2ControlBox1.Location = new System.Drawing.Point(1175, 7); + this.guna2ControlBox1.Location = new System.Drawing.Point(1301, 7); this.guna2ControlBox1.Name = "guna2ControlBox1"; this.guna2ControlBox1.ShadowDecoration.CustomizableEdges = customizableEdges14; this.guna2ControlBox1.Size = new System.Drawing.Size(28, 28); @@ -159,7 +159,7 @@ private void InitializeComponent() this.guna2ControlBox2.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox2.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox2.IconColor = System.Drawing.Color.White; - this.guna2ControlBox2.Location = new System.Drawing.Point(1206, 7); + this.guna2ControlBox2.Location = new System.Drawing.Point(1332, 7); this.guna2ControlBox2.Name = "guna2ControlBox2"; this.guna2ControlBox2.ShadowDecoration.CustomizableEdges = customizableEdges16; this.guna2ControlBox2.Size = new System.Drawing.Size(28, 28); @@ -175,7 +175,7 @@ private void InitializeComponent() this.guna2ControlBox3.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox3.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); this.guna2ControlBox3.IconColor = System.Drawing.Color.White; - this.guna2ControlBox3.Location = new System.Drawing.Point(1237, 7); + this.guna2ControlBox3.Location = new System.Drawing.Point(1363, 7); this.guna2ControlBox3.Name = "guna2ControlBox3"; this.guna2ControlBox3.ShadowDecoration.CustomizableEdges = customizableEdges18; this.guna2ControlBox3.Size = new System.Drawing.Size(28, 28); @@ -185,7 +185,7 @@ private void InitializeComponent() // this.Update_Available.Anchor = System.Windows.Forms.AnchorStyles.Right; this.Update_Available.AutoRoundedCorners = true; - this.Update_Available.BorderRadius = 17; + this.Update_Available.BorderRadius = 14; this.Update_Available.Cursor = System.Windows.Forms.Cursors.Hand; this.Update_Available.CustomizableEdges = customizableEdges19; this.Update_Available.DefaultAutoSize = true; @@ -195,11 +195,11 @@ private void InitializeComponent() this.Update_Available.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); this.Update_Available.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.Update_Available.ForeColor = System.Drawing.Color.White; - this.Update_Available.Location = new System.Drawing.Point(962, 7); + this.Update_Available.Location = new System.Drawing.Point(1088, 7); this.Update_Available.Margin = new System.Windows.Forms.Padding(100, 20, 3, 3); this.Update_Available.Name = "Update_Available"; this.Update_Available.ShadowDecoration.CustomizableEdges = customizableEdges20; - this.Update_Available.Size = new System.Drawing.Size(232, 36); + this.Update_Available.Size = new System.Drawing.Size(190, 31); this.Update_Available.TabIndex = 3; this.Update_Available.Text = "App Update Available!"; this.Update_Available.Visible = false; @@ -209,7 +209,7 @@ private void InitializeComponent() // this.No_Internet.Anchor = System.Windows.Forms.AnchorStyles.Right; this.No_Internet.AutoRoundedCorners = true; - this.No_Internet.BorderRadius = 17; + this.No_Internet.BorderRadius = 14; this.No_Internet.Cursor = System.Windows.Forms.Cursors.Hand; this.No_Internet.CustomizableEdges = customizableEdges21; this.No_Internet.DefaultAutoSize = true; @@ -221,11 +221,11 @@ private void InitializeComponent() this.No_Internet.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.No_Internet.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.No_Internet.ForeColor = System.Drawing.Color.White; - this.No_Internet.Location = new System.Drawing.Point(470, 7); + this.No_Internet.Location = new System.Drawing.Point(596, 7); this.No_Internet.Margin = new System.Windows.Forms.Padding(100, 20, 3, 3); this.No_Internet.Name = "No_Internet"; this.No_Internet.ShadowDecoration.CustomizableEdges = customizableEdges22; - this.No_Internet.Size = new System.Drawing.Size(332, 36); + this.No_Internet.Size = new System.Drawing.Size(271, 31); this.No_Internet.TabIndex = 4; this.No_Internet.Text = "No Internet Connection Detected!"; this.No_Internet.Visible = false; @@ -242,7 +242,7 @@ private void InitializeComponent() this.Panel_Menu.Dock = System.Windows.Forms.DockStyle.Left; this.Panel_Menu.Location = new System.Drawing.Point(0, 46); this.Panel_Menu.Name = "Panel_Menu"; - this.Panel_Menu.Size = new System.Drawing.Size(263, 642); + this.Panel_Menu.Size = new System.Drawing.Size(263, 641); this.Panel_Menu.TabIndex = 29; // // flowLayoutPanel1 @@ -260,7 +260,7 @@ private void InitializeComponent() this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0); - this.flowLayoutPanel1.Size = new System.Drawing.Size(263, 642); + this.flowLayoutPanel1.Size = new System.Drawing.Size(263, 641); this.flowLayoutPanel1.TabIndex = 0; // // pictureBox1 @@ -476,7 +476,7 @@ private void InitializeComponent() this.Panel_Main.Location = new System.Drawing.Point(263, 46); this.Panel_Main.Name = "Panel_Main"; this.Panel_Main.Padding = new System.Windows.Forms.Padding(0, 25, 0, 0); - this.Panel_Main.Size = new System.Drawing.Size(1010, 642); + this.Panel_Main.Size = new System.Drawing.Size(1136, 641); this.Panel_Main.TabIndex = 31; // // update_Pocket1 @@ -491,7 +491,7 @@ private void InitializeComponent() this.update_Pocket1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.update_Pocket1.Name = "update_Pocket1"; this.update_Pocket1.Pocket_Drive = null; - this.update_Pocket1.Size = new System.Drawing.Size(1010, 617); + this.update_Pocket1.Size = new System.Drawing.Size(1136, 616); this.update_Pocket1.TabIndex = 0; // // image_Packs1 @@ -505,7 +505,7 @@ private void InitializeComponent() this.image_Packs1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.image_Packs1.Name = "image_Packs1"; this.image_Packs1.Pocket_Drive = null; - this.image_Packs1.Size = new System.Drawing.Size(1010, 617); + this.image_Packs1.Size = new System.Drawing.Size(1136, 616); this.image_Packs1.TabIndex = 3; this.image_Packs1.Visible = false; // @@ -519,7 +519,7 @@ private void InitializeComponent() this.organize_Cores1.Location = new System.Drawing.Point(0, 25); this.organize_Cores1.Margin = new System.Windows.Forms.Padding(4, 1, 4, 1); this.organize_Cores1.Name = "organize_Cores1"; - this.organize_Cores1.Size = new System.Drawing.Size(1010, 617); + this.organize_Cores1.Size = new System.Drawing.Size(1136, 616); this.organize_Cores1.TabIndex = 2; this.organize_Cores1.updateFile = null; this.organize_Cores1.Visible = false; @@ -534,7 +534,7 @@ private void InitializeComponent() this.manageCores1.Location = new System.Drawing.Point(0, 25); this.manageCores1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.manageCores1.Name = "manageCores1"; - this.manageCores1.Size = new System.Drawing.Size(1010, 617); + this.manageCores1.Size = new System.Drawing.Size(1136, 616); this.manageCores1.TabIndex = 1; this.manageCores1.updateFile = null; // @@ -546,7 +546,7 @@ private void InitializeComponent() this.logs1.Location = new System.Drawing.Point(0, 25); this.logs1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.logs1.Name = "logs1"; - this.logs1.Size = new System.Drawing.Size(1010, 617); + this.logs1.Size = new System.Drawing.Size(1136, 616); this.logs1.TabIndex = 5; this.logs1.Visible = false; // @@ -559,16 +559,16 @@ private void InitializeComponent() this.about1.Location = new System.Drawing.Point(0, 25); this.about1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.about1.Name = "about1"; - this.about1.Size = new System.Drawing.Size(1010, 617); + this.about1.Size = new System.Drawing.Size(1136, 616); this.about1.TabIndex = 6; this.about1.Visible = false; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(62)))), ((int)(((byte)(78))))); - this.ClientSize = new System.Drawing.Size(1273, 688); + this.ClientSize = new System.Drawing.Size(1399, 687); this.Controls.Add(this.Panel_Main); this.Controls.Add(this.Panel_Menu); this.Controls.Add(this.Panel_Top); diff --git a/Forms/Main/Form1.cs b/Forms/Main/Form1.cs index c9ccde3..783da27 100644 --- a/Forms/Main/Form1.cs +++ b/Forms/Main/Form1.cs @@ -9,7 +9,7 @@ namespace Pocket_Updater { public partial class Form1 : Form { - private const string VERSION = "1.5.5"; + private const string VERSION = "1.5.6"; private const string API_URL = "https://api.github.com/repos/RetroDriven/Pocket_Updater/releases"; private const string RELEASE_URL = "https://github.com/RetroDriven/Pocket_Updater/releases/latest"; diff --git a/Lib/Updater/Factory.cs b/Lib/Updater/Factory.cs new file mode 100644 index 0000000..c9a59ce --- /dev/null +++ b/Lib/Updater/Factory.cs @@ -0,0 +1,14 @@ +namespace pannella.analoguepocket; + +public class Factory +{ + public static HttpHelper GetHttpHelper() + { + return HttpHelper.Instance; + } + + public static GlobalHelper GetGlobals() + { + return GlobalHelper.Instance; + } +} \ No newline at end of file diff --git a/Lib/Updater/exceptions/MissingRequiredInstanceFiles.cs b/Lib/Updater/exceptions/MissingRequiredInstanceFiles.cs new file mode 100644 index 0000000..0f1818f --- /dev/null +++ b/Lib/Updater/exceptions/MissingRequiredInstanceFiles.cs @@ -0,0 +1,20 @@ +namespace pannella.analoguepocket; + +using System; + +public class MissingRequiredInstanceFiles : Exception +{ + public MissingRequiredInstanceFiles() + { + } + + public MissingRequiredInstanceFiles(string message) + : base(message) + { + } + + public MissingRequiredInstanceFiles(string message, Exception inner) + : base(message, inner) + { + } +} \ No newline at end of file diff --git a/Lib/Updater/helpers/GlobalHelper.cs b/Lib/Updater/helpers/GlobalHelper.cs new file mode 100644 index 0000000..e06bf8c --- /dev/null +++ b/Lib/Updater/helpers/GlobalHelper.cs @@ -0,0 +1,36 @@ +using System.IO; +using System.Net.Http; + +namespace pannella.analoguepocket; + +public class GlobalHelper +{ + private static GlobalHelper instance = null; + private static object syncLock = new object(); + public archiveorg.Archive ArchiveFiles { get; set; } + public SettingsManager? SettingsManager { get; set ;} + public string UpdateDirectory { get; set; } + public string SettingsPath { get; set; } + public string[] Blacklist { get; set; } + public List? Cores { get; set; } + + private GlobalHelper() + { + + } + + public static GlobalHelper Instance + { + get + { + lock (syncLock) + { + if (GlobalHelper.instance == null) { + GlobalHelper.instance = new GlobalHelper(); + } + + return GlobalHelper.instance; + } + } + } +} diff --git a/Lib/Updater/models/Archive/File.cs b/Lib/Updater/models/Archive/File.cs index 9ab0a45..fbade30 100644 --- a/Lib/Updater/models/Archive/File.cs +++ b/Lib/Updater/models/Archive/File.cs @@ -2,8 +2,8 @@ namespace archiveorg; public class File { - public string name { get; set; } - public string md5 { get; set; } + public string? name { get; set; } + public string? md5 { get; set; } public string crc32 { get; set; } - public string source { get; set; } + public string? source { get; set; } } \ No newline at end of file diff --git a/Lib/Updater/models/ImagePack.cs b/Lib/Updater/models/ImagePack.cs index d118c72..cb5737d 100644 --- a/Lib/Updater/models/ImagePack.cs +++ b/Lib/Updater/models/ImagePack.cs @@ -34,7 +34,7 @@ private async Task fetchImagePack(string path) } if(downloadUrl != "") { Console.WriteLine("Downloading image pack..."); - await HttpHelper.DownloadFileAsync(downloadUrl, localFile); + await Factory.GetHttpHelper().DownloadFileAsync(downloadUrl, localFile); Console.WriteLine("Download complete."); return localFile; } diff --git a/Lib/Updater/services/ArchiveService.cs b/Lib/Updater/services/ArchiveService.cs index f145176..87f8548 100644 --- a/Lib/Updater/services/ArchiveService.cs +++ b/Lib/Updater/services/ArchiveService.cs @@ -11,9 +11,21 @@ public static class ArchiveService public static async Task GetFiles(string archive) { string url = String.Format(END_POINT, archive); - string json = await HttpHelper.GetHTML(url); + string json = await Factory.GetHttpHelper().GetHTML(url); Archive result = JsonSerializer.Deserialize(json); return result; } + + public static async Task GetFilesCustom(string url) + { + try { + string json = await Factory.GetHttpHelper().GetHTML(url); + Archive result = JsonSerializer.Deserialize(json); + + return result; + } catch(Exception e) { + return null; + } + } } \ No newline at end of file diff --git a/Lib/Updater/services/ImagePacksService.cs b/Lib/Updater/services/ImagePacksService.cs index 9f13b09..e04beb6 100644 --- a/Lib/Updater/services/ImagePacksService.cs +++ b/Lib/Updater/services/ImagePacksService.cs @@ -8,7 +8,7 @@ public static class ImagePacksService public static async Task GetImagePacks() { - string json = await HttpHelper.GetHTML(END_POINT); + string json = await Factory.GetHttpHelper().GetHTML(END_POINT); ImagePack[] packs = JsonSerializer.Deserialize(json); if(packs != null) { diff --git a/Pocket_Updater.csproj b/Pocket_Updater.csproj index 650e621..2ebe325 100644 --- a/Pocket_Updater.csproj +++ b/Pocket_Updater.csproj @@ -3,7 +3,7 @@ WinExe net6.0-windows - 1.5.5 + 1.5.6 Pocket_Updater enable true diff --git a/lib/Updater/Updater.cs b/lib/Updater/Updater.cs index 7aafcf4..ccf1d90 100644 --- a/lib/Updater/Updater.cs +++ b/lib/Updater/Updater.cs @@ -22,25 +22,12 @@ public class PocketCoreUpdater : Base private string _githubApiKey = ""; - private bool _extractAll = false; private bool _downloadFirmare = true; private bool _deleteSkippedCores = true; private bool _useConsole = false; - /// - /// The directory where fpga cores will be installed and updated into - /// - public string UpdateDirectory { get; set; } - - public string SettingsPath { get; set; } - - private SettingsManager? _settingsManager; - - private List? _cores; + private bool _renameJotegoCores = true; - private Dictionary? _assets; - - private archiveorg.Archive _archiveFiles; - private string[] _blacklist; + private Dictionary _platformFiles = new Dictionary(); /// /// Constructor @@ -49,60 +36,82 @@ public class PocketCoreUpdater : Base /// Path to settings json file public PocketCoreUpdater(string updateDirectory, string? settingsPath = null) { - UpdateDirectory = updateDirectory; - Directory.CreateDirectory(Path.Combine(UpdateDirectory, "Cores")); + Factory.GetGlobals().UpdateDirectory = updateDirectory; + Directory.CreateDirectory(Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores")); if(settingsPath != null) { - SettingsPath = settingsPath; + Factory.GetGlobals().SettingsPath = settingsPath; } else { - SettingsPath = updateDirectory; + Factory.GetGlobals().SettingsPath = updateDirectory; } } public async Task Initialize() { - + await LoadPlatformFiles(); await LoadCores(); - // await LoadDependencies(); LoadSettings(); await LoadArchive(); await LoadBlacklist(); } - private async Task LoadArchive() + private async Task LoadPlatformFiles() { - _archiveFiles = await ArchiveService.GetFiles(this._settingsManager.GetConfig().archive_name); + try { + List files = await GithubApi.GetFiles("dyreschlock", "pocket-platform-images", "arcade/Platforms"); + Dictionary platformFiles = new Dictionary(); + foreach(Github.File file in files) { + string url = file.download_url; + string filename = file.name; + if (filename.EndsWith(".json")) { + string platform = Path.GetFileNameWithoutExtension(filename); + platformFiles.Add(platform, url); + } + } + _platformFiles = platformFiles; + } catch (Exception e) { + _writeMessage("Unable to retrieve archive contents. Asset download may not work."); + _platformFiles = new Dictionary(); + } } - public async Task LoadDependencies() + private async Task LoadArchive() { - _assets = await AssetsService.GetAssets(); + if(Factory.GetGlobals().SettingsManager.GetConfig().use_custom_archive) { + var custom = Factory.GetGlobals().SettingsManager.GetConfig().custom_archive; + Uri baseUrl = new Uri(custom["url"]); + Uri url = new Uri(baseUrl, custom["index"]); + + Factory.GetGlobals().ArchiveFiles = await ArchiveService.GetFilesCustom(url.ToString()); + } else { + Factory.GetGlobals().ArchiveFiles = await ArchiveService.GetFiles(Factory.GetGlobals().SettingsManager.GetConfig().archive_name); + } } + private async Task LoadBlacklist() { - _blacklist = await AssetsService.GetBlacklist(); + Factory.GetGlobals().Blacklist = await AssetsService.GetBlacklist(); } public async Task LoadCores() { - _cores = await CoresService.GetCores(); - foreach(Core core in _cores) { + Factory.GetGlobals().Cores = await CoresService.GetCores(); + foreach(Core core in Factory.GetGlobals().Cores) { core.StatusUpdated += updater_StatusUpdated; //attach handler to bubble event up } - // await LoadNonAPICores(); } public async Task LoadNonAPICores() { - _cores.AddRange(await CoresService.GetNonAPICores()); + Factory.GetGlobals().Cores.AddRange(await CoresService.GetNonAPICores()); } public void LoadSettings() { - _settingsManager = new SettingsManager(SettingsPath, _cores); + Factory.GetGlobals().SettingsManager = new SettingsManager(Factory.GetGlobals().SettingsPath, Factory.GetGlobals().Cores); } - public List GetMissingCores() => _settingsManager?.GetMissingCores() ?? new List(); + public List GetMissingCores() => Factory.GetGlobals().SettingsManager?.GetMissingCores() ?? new List(); /// /// Turn on/off printing progress messages to the console @@ -113,6 +122,11 @@ public void PrintToConsole(bool set) _useConsole = set; } + public void RenameJotegoCores(bool set) + { + _renameJotegoCores = set; + } + /// /// Turn on/off the automatic BIOS downloader /// @@ -139,7 +153,7 @@ public void DownloadFirmware(bool set) //get api and local cores private async Task> getAllCores() { - List cores = _cores; + List cores = Factory.GetGlobals().Cores; List local = await GetLocalCores(); foreach(Core core in local) { core.StatusUpdated += updater_StatusUpdated; //attach handler to bubble event up @@ -152,8 +166,7 @@ private async Task> getAllCores() public async Task BuildInstanceJSON(bool overwrite = false, string? corename = null) { List cores = await getAllCores(); - foreach(Core core in _cores) { - core.UpdateDirectory = UpdateDirectory; + foreach(Core core in Factory.GetGlobals().Cores) { if(core.CheckInstancePackager() && (corename == null || corename == core.identifier)) { _writeMessage(core.identifier); core.BuildInstanceJSONs(overwrite); @@ -173,7 +186,7 @@ public async Task RunUpdates() Dictionary> results = new Dictionary>(); bool imagesBacked = false; string firmwareDownloaded = ""; - if(_cores == null) { + if(Factory.GetGlobals().Cores == null) { throw new Exception("Must initialize updater before running update process"); } @@ -183,22 +196,21 @@ public async Task RunUpdates() if(_preservePlatformsFolder) { _writeMessage("Backing up platforms folder"); - Util.BackupPlatformsDirectory(UpdateDirectory); + Util.BackupPlatformsDirectory(Factory.GetGlobals().UpdateDirectory); _writeMessage("Finished backing up platforms folder"); Divide(); imagesBacked = true; } List cores = await getAllCores(); string json; - foreach(Core core in _cores) { - core.UpdateDirectory = UpdateDirectory; - core.archive = _settingsManager.GetConfig().archive_name; + foreach(Core core in Factory.GetGlobals().Cores) { + core.archive = Factory.GetGlobals().SettingsManager.GetConfig().archive_name; core.downloadAssets = _downloadAssets; - core.archiveFiles = _archiveFiles; - core.blacklist = _blacklist; - core.buildInstances = _settingsManager.GetConfig().build_instance_jsons; + core.buildInstances = Factory.GetGlobals().SettingsManager.GetConfig().build_instance_jsons; + core.useCRC = Factory.GetGlobals().SettingsManager.GetConfig().crc_check; + core.skipAlts = Factory.GetGlobals().SettingsManager.GetConfig().skip_alternative_assets; try { - if(_settingsManager.GetCoreSettings(core.identifier).skip) { + if(Factory.GetGlobals().SettingsManager.GetCoreSettings(core.identifier).skip) { _DeleteCore(core); continue; } @@ -210,7 +222,7 @@ public async Task RunUpdates() } _writeMessage("Checking Core: " + name); - bool allowPrerelease = _settingsManager.GetCoreSettings(core.identifier).allowPrerelease; + bool allowPrerelease = Factory.GetGlobals().SettingsManager.GetCoreSettings(core.identifier).allowPrerelease; var mostRecentRelease = core.version; if(mostRecentRelease == null) { @@ -218,6 +230,7 @@ public async Task RunUpdates() results = await core.DownloadAssets(); installedAssets.AddRange(results["installed"]); skippedAssets.AddRange(results["skipped"]); + await JotegoRename(core); Divide(); continue; } @@ -235,6 +248,7 @@ public async Task RunUpdates() _writeMessage("Updating core"); } else { results = await core.DownloadAssets(); + await JotegoRename(core); installedAssets.AddRange(results["installed"]); skippedAssets.AddRange(results["skipped"]); _writeMessage("Up to date. Skipping core"); @@ -245,13 +259,14 @@ public async Task RunUpdates() _writeMessage("Downloading core"); } - if(await core.Install(UpdateDirectory, _githubApiKey)) { + if(await core.Install(_githubApiKey)) { Dictionary summary = new Dictionary(); summary.Add("version", mostRecentRelease); summary.Add("core", core.identifier); summary.Add("platform", core.platform.name); installed.Add(summary); } + await JotegoRename(core); results = await core.DownloadAssets(); installedAssets.AddRange(results["installed"]); skippedAssets.AddRange(results["skipped"]); @@ -266,7 +281,7 @@ public async Task RunUpdates() if(imagesBacked) { _writeMessage("Restoring platforms folder"); - Util.RestorePlatformsDirectory(UpdateDirectory); + Util.RestorePlatformsDirectory(Factory.GetGlobals().UpdateDirectory); Divide(); } UpdateProcessCompleteEventArgs args = new UpdateProcessCompleteEventArgs(); @@ -278,23 +293,44 @@ public async Task RunUpdates() OnUpdateProcessComplete(args); } + private async Task JotegoRename(Core core) + { + if(_renameJotegoCores && core.identifier.Contains("jotego")) { + core.platform_id = core.identifier.Split('.')[1]; //whatever + string path = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Platforms", core.platform_id + ".json"); + string json = File.ReadAllText(path); + Dictionary data = JsonSerializer.Deserialize>(json); + Platform platform = data["platform"]; + if(_platformFiles.ContainsKey(core.platform_id) && platform.name == core.platform_id) { + _writeMessage("Updating JT Platform Name..."); + await Factory.GetHttpHelper().DownloadFileAsync(_platformFiles[core.platform_id], path); + _writeMessage("Complete"); + } + } + } + public async Task RunAssetDownloader(string? id = null) { List installedAssets = new List(); List skippedAssets = new List(); Dictionary> results = new Dictionary>(); - if(_cores == null) { + if(Factory.GetGlobals().Cores == null) { throw new Exception("Must initialize updater before running update process"); } List cores = await getAllCores(); - foreach(Core core in _cores) { + foreach(Core core in Factory.GetGlobals().Cores) { if(id != null && core.identifier != id) { continue; } - core.UpdateDirectory = UpdateDirectory; - core.archive = _settingsManager.GetConfig().archive_name; - core.archiveFiles = _archiveFiles; - core.blacklist = _blacklist; + + if(Factory.GetGlobals().SettingsManager.GetCoreSettings(core.identifier).skip) { + continue; + } + + core.downloadAssets = true; + core.archive = Factory.GetGlobals().SettingsManager.GetConfig().archive_name; + core.useCRC = Factory.GetGlobals().SettingsManager.GetConfig().crc_check; + core.skipAlts = Factory.GetGlobals().SettingsManager.GetConfig().skip_alternative_assets; try { string name = core.identifier; if(name == null) { @@ -326,7 +362,7 @@ private void Divide() private string BuildAssetUrl(DependencyFile asset) { - string archive = _settingsManager.GetConfig().archive_name; + string archive = Factory.GetGlobals().SettingsManager.GetConfig().archive_name; if(asset.file_name != null && asset.archive_zip == null && asset.archive_file == null && !asset.zip) { return ARCHIVE_BASE_URL + "/" + archive + "/" + asset.file_name; } else if(archive != null && asset.archive_zip != null) { @@ -342,18 +378,18 @@ private string BuildAssetUrl(DependencyFile asset) private string BuildAssetUrlNew(string filename) { - string archive = _settingsManager.GetConfig().archive_name; + string archive = Factory.GetGlobals().SettingsManager.GetConfig().archive_name; return ARCHIVE_BASE_URL + "/" + archive + "/" + filename; } public async Task> GetLocalCores() { - string coresDirectory = Path.Combine(UpdateDirectory, "Cores"); + string coresDirectory = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores"); string[] directories = Directory.GetDirectories(coresDirectory,"*", SearchOption.TopDirectoryOnly); List all = new List(); foreach(string name in directories) { string n = Path.GetFileName(name); - var matches = _cores.Where(i=>i.identifier == n); + var matches = Factory.GetGlobals().Cores.Where(i=>i.identifier == n); if(matches.Count() == 0) { Core c = new Core { identifier = n @@ -383,7 +419,7 @@ public async Task UpdateFirmware() { string version = ""; _writeMessage("Checking for firmware updates..."); - string html = await HttpHelper.GetHTML(FIRMWARE_URL); + string html = await Factory.GetHttpHelper().GetHTML(FIRMWARE_URL); MatchCollection matches = BIN_REGEX.Matches(html); if(matches.Count != 1) { @@ -395,21 +431,21 @@ public async Task UpdateFirmware() string[] parts = firmwareUrl.Split("/"); string filename = parts[parts.Length-1]; - Firmware current = _settingsManager.GetCurrentFirmware(); - if(current.version != filename || !File.Exists(Path.Combine(UpdateDirectory, filename))) { + Firmware current = Factory.GetGlobals().SettingsManager.GetCurrentFirmware(); + if(current.version != filename || !File.Exists(Path.Combine(Factory.GetGlobals().UpdateDirectory, filename))) { version = filename; - var oldfiles = Directory.GetFiles(UpdateDirectory, FIRMWARE_FILENAME_PATTERN); + var oldfiles = Directory.GetFiles(Factory.GetGlobals().UpdateDirectory, FIRMWARE_FILENAME_PATTERN); _writeMessage("Firmware update found. Downloading..."); - await HttpHelper.DownloadFileAsync(firmwareUrl, Path.Combine(UpdateDirectory, filename)); + await Factory.GetHttpHelper().DownloadFileAsync(firmwareUrl, Path.Combine(Factory.GetGlobals().UpdateDirectory, filename)); _writeMessage("Download Complete"); - _writeMessage(Path.Combine(UpdateDirectory, filename)); + _writeMessage(Path.Combine(Factory.GetGlobals().UpdateDirectory, filename)); foreach (string oldfile in oldfiles) { if (File.Exists(oldfile) && Path.GetFileName(oldfile) != filename) { _writeMessage("Deleting old firmware file..."); File.Delete(oldfile); } } - _settingsManager.SetFirmwareVersion(filename); + Factory.GetGlobals().SettingsManager.SetFirmwareVersion(filename); _writeMessage("To install firmware, restart your Pocket."); } else { _writeMessage("Firmware up to date."); @@ -418,11 +454,6 @@ public async Task UpdateFirmware() return version; } - public void ExtractAll(bool value) - { - _extractAll = value; - } - public void DeleteSkippedCores(bool value) { _deleteSkippedCores = value; @@ -434,7 +465,7 @@ private void _DeleteCore(Core core) return; } - core.Uninstall(UpdateDirectory); + core.Uninstall(); } private void updater_StatusUpdated(object sender, StatusUpdatedEventArgs e) @@ -442,6 +473,11 @@ private void updater_StatusUpdated(object sender, StatusUpdatedEventArgs e) this.OnStatusUpdated(e); } public event EventHandler? UpdateProcessComplete; + + public void SetDownloadProgressHandler(EventHandler handler) + { + Factory.GetHttpHelper().DownloadProgressUpdate += handler; + } } public class UpdateProcessCompleteEventArgs : EventArgs diff --git a/lib/Updater/helpers/HttpHelper.cs b/lib/Updater/helpers/HttpHelper.cs index 82d3706..5e407c2 100644 --- a/lib/Updater/helpers/HttpHelper.cs +++ b/lib/Updater/helpers/HttpHelper.cs @@ -3,30 +3,117 @@ namespace pannella.analoguepocket; -public static class HttpHelper +public class HttpHelper { - private static readonly HttpClient _httpClient = new HttpClient(); + private static HttpHelper instance = null; + private static object syncLock = new object(); + private HttpClient client = null; + public event EventHandler DownloadProgressUpdate; - public static async Task DownloadFileAsync(string uri, string outputPath) + private HttpHelper() + { + this.client = new HttpClient(); + this.client.Timeout = TimeSpan.FromMinutes(10); //10min + } + + public static HttpHelper Instance + { + get + { + lock (syncLock) + { + if (HttpHelper.instance == null) { + HttpHelper.instance = new HttpHelper(); + } + + return HttpHelper.instance; + } + } + } + + public async Task DownloadFileAsync(string uri, string outputPath, int timeout = 100) { - Uri? uriResult; + bool console = false; + try { + var test = Console.WindowWidth; + console = true; + } catch (Exception) { } - if (!Uri.TryCreate(uri, UriKind.Absolute, out uriResult)) - throw new InvalidOperationException("URI is invalid."); + using var cts = new CancellationTokenSource(); + cts.CancelAfter(TimeSpan.FromSeconds(timeout)); + Uri? uriResult; - byte[] fileBytes = await _httpClient.GetByteArrayAsync(uri); - File.WriteAllBytes(outputPath, fileBytes); - } + if (!Uri.TryCreate(uri, UriKind.Absolute, out uriResult)) + throw new InvalidOperationException("URI is invalid."); + + using HttpResponseMessage r = await this.client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead, cts.Token); + + var totalSize = r.Content.Headers.ContentLength ?? -1L; + var readSoFar = 0L; + var buffer = new byte[4096]; + var isMoreToRead = true; - public static async Task GetHTML(string uri) + using var stream = await r.Content.ReadAsStreamAsync(); + using var fileStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write); + + while (isMoreToRead) + { + var read = await stream.ReadAsync(buffer, 0, buffer.Length); + if (read == 0) + { + isMoreToRead = false; + if (console) { + Console.Write("\r"); + } + } + else + { + readSoFar += read; + var progress = (double)readSoFar / totalSize; + if (console) { + var progressWidth = Console.WindowWidth - 14; + var progressBarWidth = (int)(progress * progressWidth); + var progressBar = new string('=', progressBarWidth); + var emptyProgressBar = new string(' ', progressWidth - progressBarWidth); + Console.Write($"\r{progressBar}{emptyProgressBar}] {(progress * 100):0.00}%"); + if (readSoFar == totalSize) + { + Console.CursorLeft = 0; + Console.Write(new string(' ', Console.WindowWidth)); + Console.CursorLeft = 0; + } + } + DownloadProgressEventArgs args = new DownloadProgressEventArgs(); + args.progress = progress; + OnDownloadProgressUpdate(args); + await fileStream.WriteAsync(buffer, 0, read); + } + } + } + + public async Task GetHTML(string uri) { - Uri? uriResult; + Uri? uriResult; - if (!Uri.TryCreate(uri, UriKind.Absolute, out uriResult)) - throw new InvalidOperationException("URI is invalid."); + if (!Uri.TryCreate(uri, UriKind.Absolute, out uriResult)) + throw new InvalidOperationException("URI is invalid."); - string html = await _httpClient.GetStringAsync(uri); + string html = await this.client.GetStringAsync(uri); - return html; + return html; } + + protected virtual void OnDownloadProgressUpdate(DownloadProgressEventArgs e) + { + EventHandler handler = DownloadProgressUpdate; + if(handler != null) + { + handler(this, e); + } + } +} + +public class DownloadProgressEventArgs : EventArgs +{ + public double progress = 0; } diff --git a/lib/Updater/models/Core.cs b/lib/Updater/models/Core.cs index 0d94ec6..4d13e3c 100644 --- a/lib/Updater/models/Core.cs +++ b/lib/Updater/models/Core.cs @@ -17,31 +17,26 @@ public class Core : Base public string? download_url { get; set; } public string? date_release { get; set; } public string? version { get; set; } - public List assets { get; set; } - - private static readonly string[] ZIP_TYPES = {"application/x-zip-compressed", "application/zip"}; private const string ZIP_FILE_NAME = "core.zip"; - public string UpdateDirectory { get; set; } public string archive { get; set; } public bool downloadAssets { get; set; } = true; - public archiveorg.Archive archiveFiles { get; set; } - public string[] blacklist { get; set; } public bool buildInstances { get; set; } = true; + public bool useCRC { get; set; } = true; + public bool skipAlts { get; set; } = false; public override string ToString() { return platform.name; } - public async Task Install(string UpdateDirectory, string githubApiKey = "") + public async Task Install(string githubApiKey = "") { if(this.repository == null) { _writeMessage("Core installed manually. Skipping."); return false; } - this.UpdateDirectory = UpdateDirectory; //iterate through assets to find the zip release return await _installGithubAsset(); } @@ -54,9 +49,9 @@ private async Task _installGithubAsset() return updated; } _writeMessage("Downloading file " + this.download_url + "..."); - string zipPath = Path.Combine(UpdateDirectory, ZIP_FILE_NAME); - string extractPath = UpdateDirectory; - await HttpHelper.DownloadFileAsync(this.download_url, zipPath); + string zipPath = Path.Combine(Factory.GetGlobals().UpdateDirectory, ZIP_FILE_NAME); + string extractPath = Factory.GetGlobals().UpdateDirectory; + await Factory.GetHttpHelper().DownloadFileAsync(this.download_url, zipPath); _writeMessage("Extracting..."); string tempDir = Path.Combine(extractPath, "temp", this.identifier); @@ -84,21 +79,18 @@ private async Task _installGithubAsset() private bool checkUpdateDirectory() { - if(this.UpdateDirectory == null) { - throw new Exception("Didn't set an update directory"); - } - if(!Directory.Exists(this.UpdateDirectory)) { + if(!Directory.Exists(Factory.GetGlobals().UpdateDirectory)) { throw new Exception("Unable to access update directory"); } return true; } - public void Uninstall(string UpdateDirectory) + public void Uninstall() { List folders = new List{"Cores", "Presets"}; foreach(string folder in folders) { - string path = Path.Combine(UpdateDirectory, folder, this.identifier); + string path = Path.Combine(Factory.GetGlobals().UpdateDirectory, folder, this.identifier); if(Directory.Exists(path)) { _writeMessage("Uninstalling " + path); Directory.Delete(path, true); @@ -120,6 +112,7 @@ public async Task>> DownloadAssets() checkUpdateDirectory(); _writeMessage("Looking for Assets"); Analogue.Core info = this.getConfig().core; + string UpdateDirectory = Factory.GetGlobals().UpdateDirectory; string coreDirectory = Path.Combine(UpdateDirectory, "Cores", this.identifier); //cores with multiple platforms won't work...not sure any exist right now? string instancesDirectory = Path.Combine(UpdateDirectory, "Assets", info.metadata.platform_ids[0], this.identifier); @@ -133,7 +126,7 @@ public async Task>> DownloadAssets() Analogue.DataJSON data = JsonSerializer.Deserialize(File.ReadAllText(dataFile), options); if(data.data.data_slots.Length > 0) { foreach(Analogue.DataSlot slot in data.data.data_slots) { - if(slot.filename != null && !blacklist.Contains(slot.filename)) { + if(slot.filename != null && !Factory.GetGlobals().Blacklist.Contains(slot.filename)) { string path = Path.Combine(UpdateDirectory, "Assets", info.metadata.platform_ids[0]); if(slot.isCoreSpecific()) { path = Path.Combine(path, this.identifier); @@ -184,11 +177,14 @@ public async Task>> DownloadAssets() if(File.GetAttributes(file).HasFlag(FileAttributes.Hidden)) { continue; } + if(skipAlts && file.Contains(Path.Combine(instancesDirectory, "_alternatives"))) { + continue; + } Analogue.InstanceJSON instance = JsonSerializer.Deserialize(File.ReadAllText(file), options); if(instance.instance.data_slots.Length > 0) { string data_path = instance.instance.data_path; foreach(Analogue.DataSlot slot in instance.instance.data_slots) { - if(!blacklist.Contains(slot.filename)) { + if(!Factory.GetGlobals().Blacklist.Contains(slot.filename)) { string path = Path.Combine(UpdateDirectory, "Assets", info.metadata.platform_ids[0], "common", data_path, slot.filename); if(File.Exists(path) && CheckCRC(path)) { _writeMessage("Already installed: " + slot.filename); @@ -203,7 +199,7 @@ public async Task>> DownloadAssets() } } } catch (Exception e) { - _writeMessage("Unable to read " + file); + _writeMessage("Error while processing " + file); _writeMessage(e.Message); } } @@ -218,7 +214,7 @@ public async Task>> DownloadAssets() public Analogue.Config? getConfig() { checkUpdateDirectory(); - string file = Path.Combine(UpdateDirectory, "Cores", this.identifier, "core.json"); + string file = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores", this.identifier, "core.json"); string json = File.ReadAllText(file); var options = new JsonSerializerOptions() { @@ -232,14 +228,14 @@ public async Task>> DownloadAssets() public bool isInstalled() { checkUpdateDirectory(); - string localCoreFile = Path.Combine(UpdateDirectory, "Cores", this.identifier, "core.json"); + string localCoreFile = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores", this.identifier, "core.json"); return File.Exists(localCoreFile); } private async Task DownloadAsset(string filename, string destination) { - if(archiveFiles != null) { - archiveorg.File? file = archiveFiles.GetFile(filename); + if(Factory.GetGlobals().ArchiveFiles != null) { + archiveorg.File? file = Factory.GetGlobals().ArchiveFiles.GetFile(filename); if(file == null) { _writeMessage("Unable to find " + filename + " in archive"); return false; @@ -251,7 +247,7 @@ private async Task DownloadAsset(string filename, string destination) int count = 0; do { _writeMessage("Downloading " + filename); - await HttpHelper.DownloadFileAsync(url, destination); + await Factory.GetHttpHelper().DownloadFileAsync(url, destination, 600); _writeMessage("Finished downloading " + filename); count++; } while(count < 3 && !CheckCRC(destination)); @@ -270,13 +266,23 @@ private async Task DownloadAsset(string filename, string destination) private string BuildAssetUrl(string filename) { - return ARCHIVE_BASE_URL + "/" + archive + "/" + filename; + if(Factory.GetGlobals().SettingsManager.GetConfig().use_custom_archive) { + var custom = Factory.GetGlobals().SettingsManager.GetConfig().custom_archive; + Uri baseUrl = new Uri(custom["url"]); + Uri url = new Uri(baseUrl, filename); + return url.ToString(); + } else { + return ARCHIVE_BASE_URL + "/" + archive + "/" + filename; + } } private bool CheckCRC(string filepath) { + if(Factory.GetGlobals().ArchiveFiles == null || !useCRC) { + return true; + } string filename = Path.GetFileName(filepath); - archiveorg.File? file = archiveFiles.GetFile(filename); + archiveorg.File? file = Factory.GetGlobals().ArchiveFiles.GetFile(filename); if(file == null) { return true; //no checksum to compare to } @@ -295,14 +301,14 @@ public void BuildInstanceJSONs(bool overwrite = true) if(!this.buildInstances) { return; } - string instancePackagerFile = Path.Combine(UpdateDirectory, "Cores", this.identifier, "instance-packager.json"); + string instancePackagerFile = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores", this.identifier, "instance-packager.json"); if(!File.Exists(instancePackagerFile)) { return; } _writeMessage("Building instance json files."); InstancePackager packager = JsonSerializer.Deserialize(File.ReadAllText(instancePackagerFile)); - string commonPath = Path.Combine(UpdateDirectory, "Assets", packager.platform_id, "common"); - string outputDir = Path.Combine(UpdateDirectory, packager.output); + string commonPath = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Assets", packager.platform_id, "common"); + string outputDir = Path.Combine(Factory.GetGlobals().UpdateDirectory, packager.output); bool warning = false; foreach(string dir in Directory.GetDirectories(commonPath, "*", SearchOption.AllDirectories)) { Analogue.SimpleInstanceJSON instancejson = new Analogue.SimpleInstanceJSON(); @@ -326,7 +332,7 @@ public void BuildInstanceJSONs(bool overwrite = true) break; } if(slot.required && files.Count() == 0) { - throw new Exception("Missing required files."); + throw new MissingRequiredInstanceFiles("Missing required files."); } foreach(string file in files) { if(File.GetAttributes(file).HasFlag(FileAttributes.Hidden)) { @@ -355,15 +361,26 @@ public void BuildInstanceJSONs(bool overwrite = true) { WriteIndented = true }; - if(!overwrite && File.Exists(Path.Combine(UpdateDirectory, packager.output, jsonFileName))) { + string[] parts = dir.Split(commonPath); + parts = parts[1].Split(jsonFileName.Remove(jsonFileName.Length - 5)); + string subdir = ""; + if(parts[0].Length > 1) { + subdir = parts[0].Trim(Path.DirectorySeparatorChar); + } + string outputfile = Path.Combine(Factory.GetGlobals().UpdateDirectory, packager.output, subdir, jsonFileName); + if(!overwrite && File.Exists(outputfile)) { _writeMessage(jsonFileName + " already exists."); } else { string json = JsonSerializer.Serialize(instancejson, options); _writeMessage("Saving " + jsonFileName); - File.WriteAllText(Path.Combine(UpdateDirectory, packager.output, jsonFileName), json); + FileInfo file = new System.IO.FileInfo(outputfile); + file.Directory.Create(); // If the directory already exists, this method does nothing. + File.WriteAllText(outputfile, json); } + } catch(MissingRequiredInstanceFiles) { + //do nothin } catch(Exception e) { - //_writeMessage("Unable to build " + dirName); + _writeMessage("Unable to build " + dirName); } } if (warning) { @@ -375,7 +392,7 @@ public void BuildInstanceJSONs(bool overwrite = true) public bool CheckInstancePackager() { - string instancePackagerFile = Path.Combine(UpdateDirectory, "Cores", this.identifier, "instance-packager.json"); + string instancePackagerFile = Path.Combine(Factory.GetGlobals().UpdateDirectory, "Cores", this.identifier, "instance-packager.json"); return File.Exists(instancePackagerFile); } } diff --git a/lib/Updater/models/Settings/Config.cs b/lib/Updater/models/Settings/Config.cs index cc923e8..1ea5f19 100644 --- a/lib/Updater/models/Settings/Config.cs +++ b/lib/Updater/models/Settings/Config.cs @@ -11,6 +11,11 @@ public class Config public bool delete_skipped_cores { get; set; } public string? download_new_cores { get; set; } public bool build_instance_jsons { get; set; } + public bool crc_check { get; set; } + public bool fix_jt_names { get; set; } + public bool skip_alternative_assets { get; set; } + public bool use_custom_archive { get; set; } + public Dictionary custom_archive { get; set; } public Config() { @@ -22,5 +27,13 @@ public Config() delete_skipped_cores = true; download_new_cores = null; build_instance_jsons = true; + crc_check = true; + fix_jt_names = true; + skip_alternative_assets = true; + use_custom_archive = true; + custom_archive = new Dictionary() { + {"url", "https://updater.retrodriven.com"}, + {"index", "updater.php"} + }; } } \ No newline at end of file diff --git a/lib/Updater/services/AssetsService.cs b/lib/Updater/services/AssetsService.cs index 92eaab0..03ca92a 100644 --- a/lib/Updater/services/AssetsService.cs +++ b/lib/Updater/services/AssetsService.cs @@ -4,25 +4,12 @@ namespace pannella.analoguepocket; public static class AssetsService { - private const string END_POINT = "https://raw.githubusercontent.com/mattpannella/pocket-updater-utility/main/pocket_updater_assets.json"; private const string IMAGE_PACKS = "https://raw.githubusercontent.com/mattpannella/pocket-updater-utility/main/image_packs.json"; private const string BLACKLIST = "https://raw.githubusercontent.com/mattpannella/pocket-updater-utility/main/blacklist.json"; - public static async Task> GetAssets() - { - string json = await HttpHelper.GetHTML(END_POINT); - Dictionary? assets = JsonSerializer.Deserialize?>(json); - - if(assets != null) { - return assets; - } - - return new Dictionary(); - } - public static async Task GetImagePacks() { - string json = await HttpHelper.GetHTML(IMAGE_PACKS); + string json = await Factory.GetHttpHelper().GetHTML(IMAGE_PACKS); ImagePack[] packs = JsonSerializer.Deserialize(json); if(packs != null) { @@ -34,7 +21,7 @@ public static async Task GetImagePacks() public static async Task GetBlacklist() { - string json = await HttpHelper.GetHTML(BLACKLIST); + string json = await Factory.GetHttpHelper().GetHTML(BLACKLIST); string[] files = JsonSerializer.Deserialize(json); if(files != null) { diff --git a/lib/Updater/services/CoresService.cs b/lib/Updater/services/CoresService.cs index 28d1aac..892b6e3 100644 --- a/lib/Updater/services/CoresService.cs +++ b/lib/Updater/services/CoresService.cs @@ -9,15 +9,12 @@ public static class CoresService public static async Task> GetCores() { - string json = await HttpHelper.GetHTML(END_POINT); + string json = await Factory.GetHttpHelper().GetHTML(END_POINT); Dictionary> parsed = JsonSerializer.Deserialize>>(json); if(parsed.ContainsKey("data")) { - // var others = await GetNonAPICores(); var cores = parsed["data"]; - // cores.AddRange(others); return cores; - //return parsed["data"]; } else { throw new Exception("Error communicating with openFPGA Cores API"); } @@ -25,7 +22,7 @@ public static async Task> GetCores() public static async Task> GetNonAPICores() { - string json = await HttpHelper.GetHTML(OTHER); + string json = await Factory.GetHttpHelper().GetHTML(OTHER); List parsed = JsonSerializer.Deserialize>(json); return parsed; diff --git a/lib/Updater/services/GithubApiService.cs b/lib/Updater/services/GithubApiService.cs index c2c1238..b479acd 100644 --- a/lib/Updater/services/GithubApiService.cs +++ b/lib/Updater/services/GithubApiService.cs @@ -53,6 +53,16 @@ public static class GithubApi return file; } + public static async Task?> GetFiles(string user, string repository, string path, string? token = "") + { + string url = String.Format(CONTENTS, user, repository, path); + + var responseBody = await CallAPI(url, token); + List? files = JsonSerializer.Deserialize>(responseBody); + + return files; + } + private static async Task CallAPI(string url, string? token = "") { var client = new HttpClient();