diff --git a/DepotDownloader.sln b/DepotDownloader.sln index 631e75ec..821997b8 100644 --- a/DepotDownloader.sln +++ b/DepotDownloader.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26228.4 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35208.52 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepotDownloader", "DepotDownloader\DepotDownloader.csproj", "{39159C47-ACD3-449F-96CA-4F30C8ED147A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepotDownloader", "DepotDownloader\DepotDownloader.csproj", "{39159C47-ACD3-449F-96CA-4F30C8ED147A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoR2VersionSelector", "RoR2VersionSelector\RoR2VersionSelector.csproj", "{1EE8675C-C10B-449C-B994-84BB191D87C2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,8 +17,15 @@ Global {39159C47-ACD3-449F-96CA-4F30C8ED147A}.Debug|Any CPU.Build.0 = Debug|Any CPU {39159C47-ACD3-449F-96CA-4F30C8ED147A}.Release|Any CPU.ActiveCfg = Release|Any CPU {39159C47-ACD3-449F-96CA-4F30C8ED147A}.Release|Any CPU.Build.0 = Release|Any CPU + {1EE8675C-C10B-449C-B994-84BB191D87C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EE8675C-C10B-449C-B994-84BB191D87C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EE8675C-C10B-449C-B994-84BB191D87C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EE8675C-C10B-449C-B994-84BB191D87C2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D9317405-7B6C-443E-967C-BEE55672DF2F} + EndGlobalSection EndGlobal diff --git a/DepotDownloader/DepotDownloader.csproj b/DepotDownloader/DepotDownloader.csproj index 2a0e67f7..fc147842 100644 --- a/DepotDownloader/DepotDownloader.csproj +++ b/DepotDownloader/DepotDownloader.csproj @@ -1,7 +1,8 @@ - + Exe net8.0 + true true LatestMajor 2.6.0 diff --git a/RoR2VersionSelector/App.config b/RoR2VersionSelector/App.config new file mode 100644 index 00000000..56efbc7b --- /dev/null +++ b/RoR2VersionSelector/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/RoR2VersionSelector/FileSelectionDialog.Designer.cs b/RoR2VersionSelector/FileSelectionDialog.Designer.cs new file mode 100644 index 00000000..aed383e7 --- /dev/null +++ b/RoR2VersionSelector/FileSelectionDialog.Designer.cs @@ -0,0 +1,123 @@ +namespace RoR2VersionSelector +{ + partial class FileSelectionDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.ButtonOk = new System.Windows.Forms.Button(); + this.ButtonCancel = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.listBox1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 86.71497F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.28502F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(589, 414); + this.tableLayoutPanel1.TabIndex = 0; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Controls.Add(this.ButtonOk, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.ButtonCancel, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 362); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(583, 49); + this.tableLayoutPanel2.TabIndex = 0; + // + // ButtonOk + // + this.ButtonOk.Dock = System.Windows.Forms.DockStyle.Fill; + this.ButtonOk.Location = new System.Drawing.Point(3, 3); + this.ButtonOk.Name = "ButtonOk"; + this.ButtonOk.Size = new System.Drawing.Size(285, 43); + this.ButtonOk.TabIndex = 0; + this.ButtonOk.Text = "Ok"; + this.ButtonOk.UseVisualStyleBackColor = true; + this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click); + // + // ButtonCancel + // + this.ButtonCancel.Dock = System.Windows.Forms.DockStyle.Fill; + this.ButtonCancel.Location = new System.Drawing.Point(294, 3); + this.ButtonCancel.Name = "ButtonCancel"; + this.ButtonCancel.Size = new System.Drawing.Size(286, 43); + this.ButtonCancel.TabIndex = 1; + this.ButtonCancel.Text = "Cancel"; + this.ButtonCancel.UseVisualStyleBackColor = true; + this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // listBox1 + // + this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(3, 3); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(583, 353); + this.listBox1.TabIndex = 1; + // + // FileSelectionDialog + // + this.ClientSize = new System.Drawing.Size(589, 414); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "FileSelectionDialog"; + this.Text = "Select RoR2 Version To Copy"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.Button ButtonOk; + private System.Windows.Forms.Button ButtonCancel; + private System.Windows.Forms.ListBox listBox1; + } +} + diff --git a/RoR2VersionSelector/FileSelectionDialog.cs b/RoR2VersionSelector/FileSelectionDialog.cs new file mode 100644 index 00000000..c107941b --- /dev/null +++ b/RoR2VersionSelector/FileSelectionDialog.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using System.Windows.Forms; +using System; + +namespace RoR2VersionSelector +{ + public partial class FileSelectionDialog : Form + { + public string SelectedFilePath { get; private set; } + + public FileSelectionDialog(List filePaths) + { + InitializeComponent(); + + // Populate the ListBox with file paths + foreach (var path in filePaths) + { + listBox1.Items.Add(path); + } + } + + private void ButtonOk_Click(object sender, EventArgs e) + { + // Get the selected file path + SelectedFilePath = listBox1.SelectedItem?.ToString(); + + // Close the dialog with OK result + if (SelectedFilePath != null) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + else + { + MessageBox.Show("Please select a file.", "No Selection", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + // Close the dialog with Cancel result + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + } + +} + diff --git a/RoR2VersionSelector/FileSelectionDialog.resx b/RoR2VersionSelector/FileSelectionDialog.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/RoR2VersionSelector/FileSelectionDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RoR2VersionSelector/Program.cs b/RoR2VersionSelector/Program.cs new file mode 100644 index 00000000..976377b5 --- /dev/null +++ b/RoR2VersionSelector/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RoR2VersionSelector +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new RoR2VersionSelector()); + } + } +} diff --git a/RoR2VersionSelector/Properties/Resources.Designer.cs b/RoR2VersionSelector/Properties/Resources.Designer.cs new file mode 100644 index 00000000..4a4ec13b --- /dev/null +++ b/RoR2VersionSelector/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RoR2VersionSelector.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RoR2VersionSelector.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/RoR2VersionSelector/Properties/Resources.resx b/RoR2VersionSelector/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/RoR2VersionSelector/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RoR2VersionSelector/Properties/Settings.Designer.cs b/RoR2VersionSelector/Properties/Settings.Designer.cs new file mode 100644 index 00000000..166c01dd --- /dev/null +++ b/RoR2VersionSelector/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RoR2VersionSelector.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/RoR2VersionSelector/Properties/Settings.settings b/RoR2VersionSelector/Properties/Settings.settings new file mode 100644 index 00000000..39645652 --- /dev/null +++ b/RoR2VersionSelector/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/RoR2VersionSelector/RoR2VersionSelector.Designer.cs b/RoR2VersionSelector/RoR2VersionSelector.Designer.cs new file mode 100644 index 00000000..6a7a98d6 --- /dev/null +++ b/RoR2VersionSelector/RoR2VersionSelector.Designer.cs @@ -0,0 +1,196 @@ +namespace RoR2VersionSelector +{ + partial class RoR2VersionSelector + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.ButtonDownloadDepot = new System.Windows.Forms.Button(); + this.TextBoxDepotDownloaderResult = new System.Windows.Forms.TextBox(); + this.PanelMain = new System.Windows.Forms.Panel(); + this.GroupBoxMain = new System.Windows.Forms.GroupBox(); + this.ButtonCopyDownloadedVersionToSteamInstall = new System.Windows.Forms.Button(); + this.TextBoxPassword = new System.Windows.Forms.TextBox(); + this.LabelPassword = new System.Windows.Forms.Label(); + this.TextBoxUsername = new System.Windows.Forms.TextBox(); + this.LabelUsername = new System.Windows.Forms.Label(); + this.ComboBoxVersionSelector = new System.Windows.Forms.ComboBox(); + this.CheckBoxDownloadOnlyDLLFiles = new System.Windows.Forms.CheckBox(); + this.PanelMain.SuspendLayout(); + this.GroupBoxMain.SuspendLayout(); + this.SuspendLayout(); + // + // ButtonDownloadDepot + // + this.ButtonDownloadDepot.AutoSize = true; + this.ButtonDownloadDepot.Dock = System.Windows.Forms.DockStyle.Top; + this.ButtonDownloadDepot.Location = new System.Drawing.Point(3, 103); + this.ButtonDownloadDepot.Name = "ButtonDownloadDepot"; + this.ButtonDownloadDepot.Size = new System.Drawing.Size(794, 23); + this.ButtonDownloadDepot.TabIndex = 3; + this.ButtonDownloadDepot.Text = "Download"; + this.ButtonDownloadDepot.UseVisualStyleBackColor = true; + this.ButtonDownloadDepot.Click += new System.EventHandler(this.ButtonDownloadDepot_Click); + // + // TextBoxDepotDownloaderResult + // + this.TextBoxDepotDownloaderResult.Dock = System.Windows.Forms.DockStyle.Bottom; + this.TextBoxDepotDownloaderResult.Location = new System.Drawing.Point(0, 198); + this.TextBoxDepotDownloaderResult.Multiline = true; + this.TextBoxDepotDownloaderResult.Name = "TextBoxDepotDownloaderResult"; + this.TextBoxDepotDownloaderResult.Size = new System.Drawing.Size(800, 252); + this.TextBoxDepotDownloaderResult.TabIndex = 2; + this.TextBoxDepotDownloaderResult.TabStop = false; + // + // PanelMain + // + this.PanelMain.Controls.Add(this.GroupBoxMain); + this.PanelMain.Controls.Add(this.TextBoxDepotDownloaderResult); + this.PanelMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.PanelMain.Location = new System.Drawing.Point(0, 0); + this.PanelMain.Name = "PanelMain"; + this.PanelMain.Size = new System.Drawing.Size(800, 450); + this.PanelMain.TabIndex = 2; + // + // GroupBoxMain + // + this.GroupBoxMain.AutoSize = true; + this.GroupBoxMain.Controls.Add(this.CheckBoxDownloadOnlyDLLFiles); + this.GroupBoxMain.Controls.Add(this.ButtonCopyDownloadedVersionToSteamInstall); + this.GroupBoxMain.Controls.Add(this.ButtonDownloadDepot); + this.GroupBoxMain.Controls.Add(this.TextBoxPassword); + this.GroupBoxMain.Controls.Add(this.LabelPassword); + this.GroupBoxMain.Controls.Add(this.TextBoxUsername); + this.GroupBoxMain.Controls.Add(this.LabelUsername); + this.GroupBoxMain.Controls.Add(this.ComboBoxVersionSelector); + this.GroupBoxMain.Dock = System.Windows.Forms.DockStyle.Top; + this.GroupBoxMain.Location = new System.Drawing.Point(0, 0); + this.GroupBoxMain.Name = "GroupBoxMain"; + this.GroupBoxMain.Size = new System.Drawing.Size(800, 192); + this.GroupBoxMain.TabIndex = 0; + this.GroupBoxMain.TabStop = false; + this.GroupBoxMain.Text = "Version Selection"; + // + // ButtonCopyDownloadedVersionToSteamInstall + // + this.ButtonCopyDownloadedVersionToSteamInstall.AutoSize = true; + this.ButtonCopyDownloadedVersionToSteamInstall.Dock = System.Windows.Forms.DockStyle.Top; + this.ButtonCopyDownloadedVersionToSteamInstall.Location = new System.Drawing.Point(3, 126); + this.ButtonCopyDownloadedVersionToSteamInstall.Name = "ButtonCopyDownloadedVersionToSteamInstall"; + this.ButtonCopyDownloadedVersionToSteamInstall.Size = new System.Drawing.Size(794, 23); + this.ButtonCopyDownloadedVersionToSteamInstall.TabIndex = 4; + this.ButtonCopyDownloadedVersionToSteamInstall.Text = "Copy Downloaded Version To Steam Install"; + this.ButtonCopyDownloadedVersionToSteamInstall.UseVisualStyleBackColor = true; + this.ButtonCopyDownloadedVersionToSteamInstall.Click += new System.EventHandler(this.ButtonCopyDownloadedVersionToSteamInstall_Click); + // + // TextBoxPassword + // + this.TextBoxPassword.Dock = System.Windows.Forms.DockStyle.Top; + this.TextBoxPassword.Location = new System.Drawing.Point(3, 83); + this.TextBoxPassword.Name = "TextBoxPassword"; + this.TextBoxPassword.Size = new System.Drawing.Size(794, 20); + this.TextBoxPassword.TabIndex = 2; + // + // LabelPassword + // + this.LabelPassword.AutoSize = true; + this.LabelPassword.Dock = System.Windows.Forms.DockStyle.Top; + this.LabelPassword.Location = new System.Drawing.Point(3, 70); + this.LabelPassword.Name = "LabelPassword"; + this.LabelPassword.Size = new System.Drawing.Size(53, 13); + this.LabelPassword.TabIndex = 4; + this.LabelPassword.Text = "Password"; + // + // TextBoxUsername + // + this.TextBoxUsername.Dock = System.Windows.Forms.DockStyle.Top; + this.TextBoxUsername.Location = new System.Drawing.Point(3, 50); + this.TextBoxUsername.Name = "TextBoxUsername"; + this.TextBoxUsername.Size = new System.Drawing.Size(794, 20); + this.TextBoxUsername.TabIndex = 1; + // + // LabelUsername + // + this.LabelUsername.AutoSize = true; + this.LabelUsername.Dock = System.Windows.Forms.DockStyle.Top; + this.LabelUsername.Location = new System.Drawing.Point(3, 37); + this.LabelUsername.Name = "LabelUsername"; + this.LabelUsername.Size = new System.Drawing.Size(55, 13); + this.LabelUsername.TabIndex = 3; + this.LabelUsername.Text = "Username"; + // + // ComboBoxVersionSelector + // + this.ComboBoxVersionSelector.Dock = System.Windows.Forms.DockStyle.Top; + this.ComboBoxVersionSelector.FormattingEnabled = true; + this.ComboBoxVersionSelector.Location = new System.Drawing.Point(3, 16); + this.ComboBoxVersionSelector.Name = "ComboBoxVersionSelector"; + this.ComboBoxVersionSelector.Size = new System.Drawing.Size(794, 21); + this.ComboBoxVersionSelector.TabIndex = 0; + // + // CheckBoxDownloadOnlyDLLFiles + // + this.CheckBoxDownloadOnlyDLLFiles.Location = new System.Drawing.Point(316, 155); + this.CheckBoxDownloadOnlyDLLFiles.Name = "CheckBoxDownloadOnlyDLLFiles"; + this.CheckBoxDownloadOnlyDLLFiles.Size = new System.Drawing.Size(161, 18); + this.CheckBoxDownloadOnlyDLLFiles.TabIndex = 3; + this.CheckBoxDownloadOnlyDLLFiles.Text = "Download Only DLL Files"; + this.CheckBoxDownloadOnlyDLLFiles.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.CheckBoxDownloadOnlyDLLFiles.UseVisualStyleBackColor = true; + // + // RoR2VersionSelector + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.PanelMain); + this.Name = "RoR2VersionSelector"; + this.Text = "RoR2 Version Selector"; + this.Load += new System.EventHandler(this.RoR2VersionSelector_Load); + this.PanelMain.ResumeLayout(false); + this.PanelMain.PerformLayout(); + this.GroupBoxMain.ResumeLayout(false); + this.GroupBoxMain.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button ButtonDownloadDepot; + private System.Windows.Forms.TextBox TextBoxDepotDownloaderResult; + private System.Windows.Forms.Panel PanelMain; + private System.Windows.Forms.ComboBox ComboBoxVersionSelector; + private System.Windows.Forms.GroupBox GroupBoxMain; + private System.Windows.Forms.Label LabelUsername; + private System.Windows.Forms.Label LabelPassword; + private System.Windows.Forms.TextBox TextBoxUsername; + private System.Windows.Forms.TextBox TextBoxPassword; + private System.Windows.Forms.Button ButtonCopyDownloadedVersionToSteamInstall; + private System.Windows.Forms.CheckBox CheckBoxDownloadOnlyDLLFiles; + } +} + diff --git a/RoR2VersionSelector/RoR2VersionSelector.cs b/RoR2VersionSelector/RoR2VersionSelector.cs new file mode 100644 index 00000000..08771146 --- /dev/null +++ b/RoR2VersionSelector/RoR2VersionSelector.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Net.NetworkInformation; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RoR2VersionSelector +{ + public partial class RoR2VersionSelector : Form + { + private Process DepotDownloaderProcess; + + private string[] AllRoR2VersionsStringSorted; + + public RoR2VersionSelector() + { + InitializeComponent(); + } + + private bool IsValidDownloadedDepot(string folderName) + { + if (!Directory.Exists(folderName)) + { + return false; + } + + foreach (var filePath in Directory.EnumerateFiles(folderName, "Risk of Rain 2.exe", SearchOption.AllDirectories)) + { + return true; + } + + return false; + } + + private List GetRiskofRain2Folders(string rootPath) + { + var res = new List(); + + foreach (var filePath in Directory.EnumerateFiles(rootPath, "Risk of Rain 2.exe", SearchOption.AllDirectories)) + { + res.Add(Path.GetDirectoryName(filePath)); + } + + return res; + } + + private void RoR2VersionSelector_Load(object sender, EventArgs e) + { + new Thread(() => + { + while (true) + { + ButtonCopyDownloadedVersionToSteamInstall.InvokeIfRequired((ctrl) => + { + ctrl.Enabled = IsValidDownloadedDepot("./depots"); + }); + + Thread.Sleep(3000); + } + }).Start(); + + AllRoR2VersionsStringSorted = Enum.GetNames(typeof(RoR2Versions)); + Array.Sort(AllRoR2VersionsStringSorted); + ComboBoxVersionSelector.DataSource = AllRoR2VersionsStringSorted; + + TextBoxDepotDownloaderResult.ReadOnly = true; + + TextBoxDepotDownloaderResult.Text = "Download the version of your choice through the interface above." + + Environment.NewLine + + "You may need to enter a Steam Guard code for DepotDownloader to download the version correctly." + + Environment.NewLine + + "Once manifest depot download has reached 100%:" + + Environment.NewLine + + "If you wish to use this version via Steam / r2modman / Thunderstore Mod Manager:" + + Environment.NewLine + + "Press the Copy Downloaded Version To Steam Install button," + + Environment.NewLine + + "A File dialog box will then open, allowing you to select the folder to which the ror2 version just downloaded is to be copied." + + Environment.NewLine + + "Otherwise, you can find the downloaded depots here: " + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "depots"); + } + + private async void ButtonDownloadDepot_Click(object sender, EventArgs e) + { + ButtonDownloadDepot.Enabled = false; + + var allRoR2VersionsStringNotSorted = Enum.GetNames(typeof(RoR2Versions)); + var ror2Versions = (RoR2Versions[])Enum.GetValues(typeof(RoR2Versions)); + long manifestId = 0; + for (var i = 0; i < AllRoR2VersionsStringSorted.Length; i++) + { + if (allRoR2VersionsStringNotSorted[i] == AllRoR2VersionsStringSorted[ComboBoxVersionSelector.SelectedIndex]) + { + manifestId = (long)ror2Versions[i]; + } + } + + var manifestArg = manifestId != -1 ? $" -manifest {manifestId} " : " "; + var fileListArg = " "; + if (CheckBoxDownloadOnlyDLLFiles.Checked) + { + var dllOnlyFilePath = "dllonly.txt"; + fileListArg = $" -filelist {dllOnlyFilePath} "; + + if (!File.Exists(dllOnlyFilePath)) + { + File.WriteAllText(dllOnlyFilePath, @"regex:.*\.dll$"); + } + } + + var outputfolderPath = Path.Combine("./depots", AllRoR2VersionsStringSorted[ComboBoxVersionSelector.SelectedIndex]); + + var startInfo = new ProcessStartInfo + { + FileName = "cmd.exe", + Arguments = $"/k \".\\DepotDownloader.exe " + + $"-app 632360 " + + $"-depot 632361 " + + $"{manifestArg} " + + $"-username {TextBoxUsername.Text} " + + $"-password {TextBoxPassword.Text} " + + $"{fileListArg} " + + $"-dir {outputfolderPath}\"", + UseShellExecute = true + }; + + try + { + DepotDownloaderProcess = new Process { StartInfo = startInfo }; + + DepotDownloaderProcess.Start(); + + DepotDownloaderProcess.WaitForExit(); + } + catch (Exception ex) + { + MessageBox.Show("An error occurred: " + ex.Message); + } + finally + { + ButtonDownloadDepot.Enabled = true; + } + } + + private static void CopyFilesRecursively(string sourcePath, string targetPath) + { + foreach (var dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories)) + { + Directory.CreateDirectory(dirPath.Replace(sourcePath, targetPath)); + } + + foreach (var newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories)) + { + File.Copy(newPath, newPath.Replace(sourcePath, targetPath), true); + } + } + + private void ButtonCopyDownloadedVersionToSteamInstall_Click(object sender, EventArgs e) + { + var sourceFolders = GetRiskofRain2Folders("./depots"); + if (sourceFolders.Count <= 0) + { + MessageBox.Show("Folder copy operation invalid.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + using var fileDialog = new FileSelectionDialog(sourceFolders); + if (fileDialog.ShowDialog() != DialogResult.OK) + { + MessageBox.Show("Folder copy operation invalid (2).", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + using var openFileDialog = new OpenFileDialog(); + // Set to filter out all files, but allow folder selection + openFileDialog.Filter = "Folders|*.none"; + openFileDialog.CheckFileExists = false; + openFileDialog.CheckPathExists = true; + openFileDialog.FileName = "Risk of Rain 2 Folder"; + + openFileDialog.Title = "Select the destination folder where the depot will be copied to."; + + const string defaultSteamRoR2InstallFolderPath = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Risk of Rain 2"; + if (Directory.Exists(defaultSteamRoR2InstallFolderPath)) + { + openFileDialog.InitialDirectory = defaultSteamRoR2InstallFolderPath; + } + + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + var selectedFolderPath = Path.GetDirectoryName(openFileDialog.FileName); + + // Get the selected file path + string selectedFilePath = fileDialog.SelectedFilePath; + + // Prompt the user for confirmation + var result = MessageBox.Show( + $"Do you want to copy the downloaded RoR2 Version from\n\n{selectedFilePath}\n\nto\n\n{selectedFolderPath}", + "Confirm Folder Copy", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question + ); + + if (result == DialogResult.Yes) + { + var destinationFolder = selectedFolderPath; + + try + { + CopyFilesRecursively(selectedFilePath, destinationFolder); + + MessageBox.Show("Folder copied successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Error copying folder: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + MessageBox.Show("Folder copy operation canceled.", "Canceled", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + MessageBox.Show("No destination folder selected.", "Operation Canceled", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } +} diff --git a/RoR2VersionSelector/RoR2VersionSelector.csproj b/RoR2VersionSelector/RoR2VersionSelector.csproj new file mode 100644 index 00000000..17b6f7b0 --- /dev/null +++ b/RoR2VersionSelector/RoR2VersionSelector.csproj @@ -0,0 +1,17 @@ + + + Exe + net472 + preview + + + + + + + + + Form + + + diff --git a/RoR2VersionSelector/RoR2VersionSelector.resx b/RoR2VersionSelector/RoR2VersionSelector.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/RoR2VersionSelector/RoR2VersionSelector.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RoR2VersionSelector/RoR2Versions.cs b/RoR2VersionSelector/RoR2Versions.cs new file mode 100644 index 00000000..4507cb14 --- /dev/null +++ b/RoR2VersionSelector/RoR2Versions.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoR2VersionSelector +{ + internal enum RoR2Versions : long + { + V_2019_03_28_EarlyAccess_Launch = 4785037072112130807, + V_2019_04_03_EarlyAccess_Patch = 5182444948675866264, + V_2019_04_16_EarlyAccess_Patch = 1280738030908307534, + V_2019_05_21_EarlyAccess_Patch = 3793891161392450065, + + V_2019_06_25_EarlyAccess_ContentUpdate_ScorchedAcres = 2112019357004186123, + V_2019_07_03_EarlyAccess_Patch = 3670024595274968264, + + V_2019_09_17_EarlyAccess_ContentUpdate_Skills2_0 = 4255430772592120193, + V_2019_10_10_EarlyAccess_Patch = 7012808837121522032, + + V_2019_12_17_EarlyAccess_ContentUpdate_HiddenRealms = 5239878991551190606, + + V_2020_03_31_EarlyAccess_ContentUpdate_Artifacts = 2472907969637403728, + V_2020_04_21_EarlyAccess_Patch = 6052191829405703267, + + V_2020_08_11_EarlyAccess_ContentUpdate_5 = 6571321385300192800, + V_2020_08_13_EarlyAccess_ContentUpdate_5_Hotfix = 9204909284884878595, + V_2020_09_01_Patch_1_0_1_1 = 5049246425996249487, + V_2020_11_03_Patch_1_0_2_0 = 3160519164886166204, + V_2020_12_15_Patch_1_0_3_1 = 8643078234309832101, + + V_2021_03_25_Update_Anniversary = 7255008819833157291, + V_2021_04_12_Patch_1_1_1_2 = 4163843425391060582, + V_2021_04_20_Patch_1_1_1_4 = 2934004482569727060, + + V_2022_03_01_DLC_01_SurvivorsOfTheVoid = 5430547693553236352, + V_2022_03_11_Patch_1_2_2_0 = 226983827800243462, + V_2022_04_19_Patch_1_2_3_0 = 4649272427595582012, + V_2022_05_26_Patch_1_2_4_0 = 8981465225844154625, + V_2022_09_29_Patch_1_2_4_1 = 7660073450841700654, + + V_2023_11_06_Patch_7_5 = 2538203695974683966, + + V_2024_05_20_Update_Devotion = 9058106608706845920, + + V_Latest = -1 + } +} diff --git a/RoR2VersionSelector/ThreadHelperClass.cs b/RoR2VersionSelector/ThreadHelperClass.cs new file mode 100644 index 00000000..1101910c --- /dev/null +++ b/RoR2VersionSelector/ThreadHelperClass.cs @@ -0,0 +1,20 @@ +using System; +using System.Windows.Forms; + +namespace RoR2VersionSelector +{ + public static class ThreadHelperClass + { + public static void InvokeIfRequired(this Control c, Action action) + { + if (c.InvokeRequired) + { + c.Invoke(new Action(() => action(c))); + } + else + { + action(c); + } + } + } +}