diff --git a/InternalUpdater/App.config b/InternalUpdater/App.config deleted file mode 100644 index 88fa402..0000000 --- a/InternalUpdater/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/InternalUpdater/InternalUpdater.csproj b/InternalUpdater/InternalUpdater.csproj deleted file mode 100644 index bb3f70d..0000000 --- a/InternalUpdater/InternalUpdater.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - - Debug - AnyCPU - {9781BFB8-690F-498F-BE50-11279EB4571B} - Exe - InternalUpdater - InternalUpdater - v4.5.2 - 512 - true - true - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - - - InternalUpdater.Program - - - - false - - - 7687A0E9F25BEFCB5EE943B02778E8E3F6308A33 - - - true - - - PrimeHack.pfx - - - Internet - - - true - - - Properties\app.manifest - - - - - - - - - - - - - - - - - Component - - - - - - - - - - False - Microsoft .NET Framework 4.5.2 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - \ No newline at end of file diff --git a/InternalUpdater/Program.cs b/InternalUpdater/Program.cs deleted file mode 100644 index 9597151..0000000 --- a/InternalUpdater/Program.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Diagnostics; -using System.Net; -using System.Windows.Forms; - -namespace InternalUpdater -{ - class Program - { - [STAThread] - static void Main(string[] args) - { - if (args.Length == 0) - { - MessageBox.Show("Severe Error. No arguments supplied. This should be impossible. Please reinstall PrimeHack.", "PrimeHack Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); - Environment.Exit(0); - } - while (true) - { - Process[] runningProcesses = Process.GetProcessesByName("PrimeHack Updater.exe"); - if (runningProcesses.Length != 0) - { - Console.WriteLine("PrimeHack Updater is running. Please close it to continue updating. Hit any key to continue."); - Console.ReadKey(); - } - else - { - break; - } - } - - string path = ""; - for (int i = 1; i < args.Length; i++) - { - path = path+args[i]+" "; - } - - try - { - downloadLatest(args[0], path); - } catch (Exception e) - { - MessageBox.Show("Download Failed.\nError: "+e.Message, "PrimeHack Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - public static void downloadLatest(string url, string extractpath) - { - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls - | SecurityProtocolType.Tls11 - | SecurityProtocolType.Tls12 - | SecurityProtocolType.Ssl3; - - Console.WriteLine("Downloading: " + url); - using (var client = new TimedWebClient()) - { - Console.WriteLine("Downloading to: "+extractpath); - client.Proxy = null; - client.DownloadFile(url, extractpath); - } - - Process.Start(extractpath); - Environment.Exit(0); - } - } -} diff --git a/InternalUpdater/Properties/AssemblyInfo.cs b/InternalUpdater/Properties/AssemblyInfo.cs deleted file mode 100644 index cfcecbe..0000000 --- a/InternalUpdater/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("InternalUpdater")] -[assembly: AssemblyDescription("InternalUpdater for PrimeHack Updater")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("created by SirMangler")] -[assembly: AssemblyProduct("InternalUpdater")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("9781bfb8-690f-498f-be50-11279eb4571b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/InternalUpdater/Properties/app.manifest b/InternalUpdater/Properties/app.manifest deleted file mode 100644 index 66981ed..0000000 --- a/InternalUpdater/Properties/app.manifest +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/InternalUpdater/TimedWebClient.cs b/InternalUpdater/TimedWebClient.cs deleted file mode 100644 index c5803b0..0000000 --- a/InternalUpdater/TimedWebClient.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Net; - - -namespace InternalUpdater -{ - class TimedWebClient : WebClient - { - protected override WebRequest GetWebRequest(Uri address) - { - WebRequest w = base.GetWebRequest(address); - w.Timeout = 5000; - return w; - } - } -} diff --git a/PrimeHack Updater.sln b/PrimeHack Updater.sln index 86dc2d1..b96c20b 100644 --- a/PrimeHack Updater.sln +++ b/PrimeHack Updater.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.329 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30503.244 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrimeHack Updater", "PrimeHack Updater\PrimeHack Updater.csproj", "{BC203460-914A-46A0-90E3-97897438CE4E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternalUpdater", "InternalUpdater\InternalUpdater.csproj", "{9781BFB8-690F-498F-BE50-11279EB4571B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,18 +27,6 @@ Global {BC203460-914A-46A0-90E3-97897438CE4E}.Release|x64.Build.0 = Release|Any CPU {BC203460-914A-46A0-90E3-97897438CE4E}.Release|x86.ActiveCfg = Release|Any CPU {BC203460-914A-46A0-90E3-97897438CE4E}.Release|x86.Build.0 = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|x64.ActiveCfg = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|x64.Build.0 = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|x86.ActiveCfg = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Debug|x86.Build.0 = Debug|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|Any CPU.Build.0 = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|x64.ActiveCfg = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|x64.Build.0 = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|x86.ActiveCfg = Release|Any CPU - {9781BFB8-690F-498F-BE50-11279EB4571B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PrimeHack Updater/PrimeHack Updater.csproj b/PrimeHack Updater/PrimeHack Updater.csproj index c5a6806..92f0778 100644 --- a/PrimeHack Updater/PrimeHack Updater.csproj +++ b/PrimeHack Updater/PrimeHack Updater.csproj @@ -108,7 +108,6 @@ - @@ -133,12 +132,12 @@ - ResXFileCodeGenerator Resources.Designer.cs + Designer UpdateUI.cs diff --git a/PrimeHack Updater/Properties/Resources.Designer.cs b/PrimeHack Updater/Properties/Resources.Designer.cs index a949391..183db9d 100644 --- a/PrimeHack Updater/Properties/Resources.Designer.cs +++ b/PrimeHack Updater/Properties/Resources.Designer.cs @@ -69,15 +69,5 @@ internal static byte[] Deface_Regular_v1 { return ((byte[])(obj)); } } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] InternalUpdater { - get { - object obj = ResourceManager.GetObject("InternalUpdater", resourceCulture); - return ((byte[])(obj)); - } - } } } diff --git a/PrimeHack Updater/Properties/Resources.resx b/PrimeHack Updater/Properties/Resources.resx index 6f376cc..b505c7b 100644 --- a/PrimeHack Updater/Properties/Resources.resx +++ b/PrimeHack Updater/Properties/Resources.resx @@ -121,7 +121,4 @@ ..\Resources\Deface_Regular_v1.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\InternalUpdater.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - \ No newline at end of file diff --git a/PrimeHack Updater/Resources/InternalUpdater.exe b/PrimeHack Updater/Resources/InternalUpdater.exe deleted file mode 100644 index 20d1dbc..0000000 Binary files a/PrimeHack Updater/Resources/InternalUpdater.exe and /dev/null differ diff --git a/PrimeHack Updater/Source/CfgManager.cs b/PrimeHack Updater/Source/CfgManager.cs index 628e0f6..fb25ff1 100644 --- a/PrimeHack Updater/Source/CfgManager.cs +++ b/PrimeHack Updater/Source/CfgManager.cs @@ -9,7 +9,7 @@ class CfgManager string isopath = ""; bool mainbranch = true; bool immersive_mode = false; - + public CfgManager() { loadCfg(); diff --git a/PrimeHack Updater/Source/InternalUpdater.cs b/PrimeHack Updater/Source/InternalUpdater.cs deleted file mode 100644 index c341f2b..0000000 --- a/PrimeHack Updater/Source/InternalUpdater.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; - -namespace PrimeHack_Updater -{ - class InternalUpdater - { - public static void update() - { - string html = VersionCheck.getJSONInfo(@"https://api.github.com/repos/SirMangler/PrimeHack-Updater/releases/latest"); - - dynamic j = JObject.Parse(html); - JArray ja = j.assets; - dynamic assets = ja[0]; - string url = assets.browser_download_url; - - string temp = Path.Combine(Path.GetTempPath(), "PrimeHack_InternalUpdater.exe"); - - if (!File.Exists(temp)) - File.WriteAllBytes(temp, PrimeHack_Updater.Properties.Resources.InternalUpdater); - - Process p = new Process(); - p.StartInfo.FileName = temp; - p.StartInfo.Arguments = url+" " +System.Reflection.Assembly.GetEntryAssembly().Location; - - p.Start(); - - Environment.Exit(1); - } - } -} diff --git a/PrimeHack Updater/Source/Updater.cs b/PrimeHack Updater/Source/Updater.cs index 6bf18f2..be179b5 100644 --- a/PrimeHack Updater/Source/Updater.cs +++ b/PrimeHack Updater/Source/Updater.cs @@ -11,23 +11,23 @@ using System.Security.Principal; using System.Reflection; using System.ComponentModel; -using System.Runtime.InteropServices; using PrimeHack_Updater.Source.WinForms; namespace PrimeHack_Updater { class Updater { - public static string sysversion = "1.6.0"; + public static string sysversion = "1.7.0"; public static readonly CfgManager cfg = new CfgManager(); public static UpdateUI ui; - static string[] arguments; + static string[] arguments = new string[0]; [STAThread] static void Main(string[] args) { - arguments = args; + if (args.Length != 0) + arguments = args; Application.SetCompatibleTextRenderingDefault(false); @@ -37,10 +37,15 @@ static void Main(string[] args) #if (!DEBUG) if (!remoteversion.Equals(sysversion)) { - DialogResult dialogResult = MessageBox.Show("PrimeHack Updater has a new update. Do you want it to update itself?", "PrimeHack Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + DialogResult dialogResult = MessageBox.Show("PrimeHack Updater has a new update. " + + "It is recommended you update as this may contain crucial bug fixes or migration tools for new PrimeHack versions.\n" + + "\nhttps://github.com/SirMangler/PrimeHack-Updater/releases" + + "\n\nOpen this link now?", "PrimeHack Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dialogResult == DialogResult.Yes) { - InternalUpdater.update(); + Process.Start("https://github.com/SirMangler/PrimeHack-Updater/releases"); + System.Environment.Exit(0); } } #endif @@ -96,7 +101,6 @@ public static void Update(string url) DownloadLatest(url); } - public static void DownloadLatest(string url) { ui.writeLine("New Update!\r\n\r\nDownloading: " + url); @@ -141,7 +145,6 @@ public static void InstallPrimeHack(object sender, AsyncCompletedEventArgs e) if (file.Name != "") { - //ui.writeLine("Transferring: " + completeFileName); file.ExtractToFile(completeFileName, true); } } @@ -172,12 +175,12 @@ public static void restartAsAdmin() { Process.Start(processInfo); } - catch (Win32Exception e) + catch (Win32Exception e) { MessageBox.Show("Failed to restart with administrator.\nError: " + e.Message, "PrimeHack Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); } - System.Environment.Exit(1); + System.Environment.Exit(0); } } @@ -301,28 +304,31 @@ public static void migrate(UpdateUI ui) } File.Delete(".\\hack_config.ini"); - } + } } public static void runPrimeHack(string path) { + if (!File.Exists(".\\Dolphin.exe")) { + MessageBox.Show("Unable to locate Dolphin.exe!\n\nRemove updater.cfg and try again.", + "PrimeHack Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); + + System.Environment.Exit(0); + } + Process p = new Process(); p.StartInfo.FileName = ".\\Dolphin.exe"; p.StartInfo.UseShellExecute = true; - if (path != null) + + if (path != null && !path.Equals("") && !path.Equals("NEVER")) { - if (!path.Equals("") && !path.Equals("NEVER")) - { - p.StartInfo.Arguments = "-e \"" + path + "\""; + p.StartInfo.Arguments = "-e \"" + path + "\""; - if (cfg.getImmersiveMode()) - p.StartInfo.Arguments += " -b"; - } else - { - p.StartInfo.Arguments = string.Join(" ", arguments); - } - } else + if (cfg.getImmersiveMode()) + p.StartInfo.Arguments += " -b"; + } + else { p.StartInfo.Arguments = string.Join(" ", arguments); } @@ -335,7 +341,7 @@ public static void runPrimeHack(string path) p.Start(); - System.Environment.Exit(1); + System.Environment.Exit(0); } public static bool IsPathValid(string path) diff --git a/PrimeHack Updater/Source/WinForms/UpdateUI.Designer.cs b/PrimeHack Updater/Source/WinForms/UpdateUI.Designer.cs index 1b9f283..fc0f170 100644 --- a/PrimeHack Updater/Source/WinForms/UpdateUI.Designer.cs +++ b/PrimeHack Updater/Source/WinForms/UpdateUI.Designer.cs @@ -28,200 +28,212 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdateUI)); - this.UpdatePanel = new System.Windows.Forms.SplitContainer(); - this.console = new System.Windows.Forms.TextBox(); - this.progressBar = new System.Windows.Forms.ProgressBar(); - this.SelectionPanel = new System.Windows.Forms.Panel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.browse_button = new System.Windows.Forms.Button(); - this.path_box = new System.Windows.Forms.TextBox(); - this.Never = new System.Windows.Forms.Button(); - this.Later = new System.Windows.Forms.Button(); - this.Yes = new System.Windows.Forms.Button(); - this.immersiveMode = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this.UpdatePanel)).BeginInit(); - this.UpdatePanel.Panel1.SuspendLayout(); - this.UpdatePanel.Panel2.SuspendLayout(); - this.UpdatePanel.SuspendLayout(); - this.SelectionPanel.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // UpdatePanel - // - this.UpdatePanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.UpdatePanel.Location = new System.Drawing.Point(0, 0); - this.UpdatePanel.Name = "UpdatePanel"; - this.UpdatePanel.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // UpdatePanel.Panel1 - // - this.UpdatePanel.Panel1.Controls.Add(this.console); - // - // UpdatePanel.Panel2 - // - this.UpdatePanel.Panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(39)))), ((int)(((byte)(39))))); - this.UpdatePanel.Panel2.Controls.Add(this.progressBar); - this.UpdatePanel.Size = new System.Drawing.Size(460, 150); - this.UpdatePanel.SplitterDistance = 104; - this.UpdatePanel.TabIndex = 0; - // - // console - // - this.console.BackColor = System.Drawing.Color.Black; - this.console.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.console.Dock = System.Windows.Forms.DockStyle.Fill; - this.console.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.console.Location = new System.Drawing.Point(0, 0); - this.console.Multiline = true; - this.console.Name = "console"; - this.console.ReadOnly = true; - this.console.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.console.Size = new System.Drawing.Size(460, 104); - this.console.TabIndex = 0; - // - // progressBar - // - this.progressBar.BackColor = System.Drawing.Color.Black; - this.progressBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); - this.progressBar.Location = new System.Drawing.Point(12, 11); - this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(436, 19); - this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.progressBar.TabIndex = 0; - // - // SelectionPanel - // - this.SelectionPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(39)))), ((int)(((byte)(39))))); - this.SelectionPanel.Controls.Add(this.groupBox1); - this.SelectionPanel.Controls.Add(this.Never); - this.SelectionPanel.Controls.Add(this.Later); - this.SelectionPanel.Controls.Add(this.Yes); - this.SelectionPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.SelectionPanel.Location = new System.Drawing.Point(0, 0); - this.SelectionPanel.Name = "SelectionPanel"; - this.SelectionPanel.Size = new System.Drawing.Size(460, 150); - this.SelectionPanel.TabIndex = 1; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.immersiveMode); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.browse_button); - this.groupBox1.Controls.Add(this.path_box); - this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.groupBox1.Location = new System.Drawing.Point(13, 3); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(435, 105); - this.groupBox1.TabIndex = 9; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "QuickLaunch (Optional)"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); - this.label1.Location = new System.Drawing.Point(12, 17); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(340, 26); - this.label1.TabIndex = 6; - this.label1.Text = "Do you want the PrimeHack Updater to automatically boot \r\ninto Metroid Prime: Tri" + - "logy?"; - // - // browse_button - // - this.browse_button.BackColor = System.Drawing.Color.DimGray; - this.browse_button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.browse_button.Location = new System.Drawing.Point(334, 51); - this.browse_button.Name = "browse_button"; - this.browse_button.Size = new System.Drawing.Size(87, 24); - this.browse_button.TabIndex = 4; - this.browse_button.Text = "Browse"; - this.browse_button.UseVisualStyleBackColor = false; - this.browse_button.Click += new System.EventHandler(this.browse_button_Click); - // - // path_box - // - this.path_box.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); - this.path_box.Font = new System.Drawing.Font("SansSerif", 9.749999F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); - this.path_box.Location = new System.Drawing.Point(14, 51); - this.path_box.Name = "path_box"; - this.path_box.ReadOnly = true; - this.path_box.Size = new System.Drawing.Size(314, 23); - this.path_box.TabIndex = 3; - // - // Never - // - this.Never.BackColor = System.Drawing.Color.DimGray; - this.Never.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.Never.Location = new System.Drawing.Point(169, 114); - this.Never.Name = "Never"; - this.Never.Size = new System.Drawing.Size(121, 27); - this.Never.TabIndex = 8; - this.Never.Text = "Never"; - this.Never.UseVisualStyleBackColor = false; - this.Never.Click += new System.EventHandler(this.Never_Click); - // - // Later - // - this.Later.BackColor = System.Drawing.Color.DimGray; - this.Later.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.Later.Location = new System.Drawing.Point(327, 114); - this.Later.Name = "Later"; - this.Later.Size = new System.Drawing.Size(121, 27); - this.Later.TabIndex = 7; - this.Later.Text = "Ask Later"; - this.Later.UseVisualStyleBackColor = false; - this.Later.Click += new System.EventHandler(this.Later_Click); - // - // Yes - // - this.Yes.BackColor = System.Drawing.Color.DimGray; - this.Yes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); - this.Yes.Location = new System.Drawing.Point(13, 114); - this.Yes.Name = "Yes"; - this.Yes.Size = new System.Drawing.Size(121, 27); - this.Yes.TabIndex = 6; - this.Yes.Text = "Yes"; - this.Yes.UseVisualStyleBackColor = false; - this.Yes.Click += new System.EventHandler(this.Yes_Click); - // - // immersiveMode - // - this.immersiveMode.AutoSize = true; - this.immersiveMode.Location = new System.Drawing.Point(14, 80); - this.immersiveMode.Name = "immersiveMode"; - this.immersiveMode.Size = new System.Drawing.Size(288, 17); - this.immersiveMode.TabIndex = 7; - this.immersiveMode.Text = "Run Game Immersively (Hide Dolphin Window)"; - this.immersiveMode.UseVisualStyleBackColor = true; - this.immersiveMode.CheckedChanged += new System.EventHandler(this.ImmersiveChecked); - // - // UpdateUI - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(460, 150); - this.Controls.Add(this.UpdatePanel); - this.Controls.Add(this.SelectionPanel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.Name = "UpdateUI"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.Text = "PrimeHack Updater"; - this.UpdatePanel.Panel1.ResumeLayout(false); - this.UpdatePanel.Panel1.PerformLayout(); - this.UpdatePanel.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.UpdatePanel)).EndInit(); - this.UpdatePanel.ResumeLayout(false); - this.SelectionPanel.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdateUI)); + this.UpdatePanel = new System.Windows.Forms.SplitContainer(); + this.console = new System.Windows.Forms.TextBox(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.SelectionPanel = new System.Windows.Forms.Panel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.portableMode = new System.Windows.Forms.CheckBox(); + this.immersiveMode = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.browse_button = new System.Windows.Forms.Button(); + this.path_box = new System.Windows.Forms.TextBox(); + this.Never = new System.Windows.Forms.Button(); + this.Later = new System.Windows.Forms.Button(); + this.Yes = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.UpdatePanel)).BeginInit(); + this.UpdatePanel.Panel1.SuspendLayout(); + this.UpdatePanel.Panel2.SuspendLayout(); + this.UpdatePanel.SuspendLayout(); + this.SelectionPanel.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // UpdatePanel + // + this.UpdatePanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.UpdatePanel.Location = new System.Drawing.Point(0, 0); + this.UpdatePanel.Name = "UpdatePanel"; + this.UpdatePanel.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // UpdatePanel.Panel1 + // + this.UpdatePanel.Panel1.Controls.Add(this.console); + // + // UpdatePanel.Panel2 + // + this.UpdatePanel.Panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(39)))), ((int)(((byte)(39))))); + this.UpdatePanel.Panel2.Controls.Add(this.progressBar); + this.UpdatePanel.Size = new System.Drawing.Size(460, 150); + this.UpdatePanel.SplitterDistance = 104; + this.UpdatePanel.TabIndex = 0; + // + // console + // + this.console.BackColor = System.Drawing.Color.Black; + this.console.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.console.Dock = System.Windows.Forms.DockStyle.Fill; + this.console.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.console.Location = new System.Drawing.Point(0, 0); + this.console.Multiline = true; + this.console.Name = "console"; + this.console.ReadOnly = true; + this.console.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.console.Size = new System.Drawing.Size(460, 104); + this.console.TabIndex = 0; + // + // progressBar + // + this.progressBar.BackColor = System.Drawing.Color.Black; + this.progressBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); + this.progressBar.Location = new System.Drawing.Point(12, 11); + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(436, 19); + this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; + this.progressBar.TabIndex = 0; + // + // SelectionPanel + // + this.SelectionPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(39)))), ((int)(((byte)(39))))); + this.SelectionPanel.Controls.Add(this.groupBox1); + this.SelectionPanel.Controls.Add(this.Never); + this.SelectionPanel.Controls.Add(this.Later); + this.SelectionPanel.Controls.Add(this.Yes); + this.SelectionPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.SelectionPanel.Location = new System.Drawing.Point(0, 0); + this.SelectionPanel.Name = "SelectionPanel"; + this.SelectionPanel.Size = new System.Drawing.Size(460, 150); + this.SelectionPanel.TabIndex = 1; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.portableMode); + this.groupBox1.Controls.Add(this.immersiveMode); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.browse_button); + this.groupBox1.Controls.Add(this.path_box); + this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.groupBox1.Location = new System.Drawing.Point(13, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(435, 105); + this.groupBox1.TabIndex = 9; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "QuickLaunch (Optional)"; + // + // portableMode + // + this.portableMode.AutoSize = true; + this.portableMode.Location = new System.Drawing.Point(318, 80); + this.portableMode.Name = "portableMode"; + this.portableMode.Size = new System.Drawing.Size(108, 17); + this.portableMode.TabIndex = 8; + this.portableMode.Text = "Portable Mode"; + this.portableMode.UseVisualStyleBackColor = true; + this.portableMode.CheckedChanged += new System.EventHandler(this.PortableChecked); + // + // immersiveMode + // + this.immersiveMode.AutoSize = true; + this.immersiveMode.Location = new System.Drawing.Point(14, 80); + this.immersiveMode.Name = "immersiveMode"; + this.immersiveMode.Size = new System.Drawing.Size(288, 17); + this.immersiveMode.TabIndex = 7; + this.immersiveMode.Text = "Run Game Immersively (Hide Dolphin Window)"; + this.immersiveMode.UseVisualStyleBackColor = true; + this.immersiveMode.CheckedChanged += new System.EventHandler(this.ImmersiveChecked); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); + this.label1.Location = new System.Drawing.Point(12, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(340, 26); + this.label1.TabIndex = 6; + this.label1.Text = "Do you want the PrimeHack Updater to automatically boot \r\ninto your game?"; + // + // browse_button + // + this.browse_button.BackColor = System.Drawing.Color.DimGray; + this.browse_button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.browse_button.Location = new System.Drawing.Point(334, 51); + this.browse_button.Name = "browse_button"; + this.browse_button.Size = new System.Drawing.Size(87, 24); + this.browse_button.TabIndex = 4; + this.browse_button.Text = "Browse"; + this.browse_button.UseVisualStyleBackColor = false; + this.browse_button.Click += new System.EventHandler(this.browse_button_Click); + // + // path_box + // + this.path_box.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(102)))), ((int)(((byte)(0))))); + this.path_box.Font = new System.Drawing.Font("SansSerif", 9.749999F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); + this.path_box.Location = new System.Drawing.Point(14, 51); + this.path_box.Name = "path_box"; + this.path_box.ReadOnly = true; + this.path_box.Size = new System.Drawing.Size(314, 23); + this.path_box.TabIndex = 3; + // + // Never + // + this.Never.BackColor = System.Drawing.Color.DimGray; + this.Never.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.Never.Location = new System.Drawing.Point(169, 114); + this.Never.Name = "Never"; + this.Never.Size = new System.Drawing.Size(121, 27); + this.Never.TabIndex = 8; + this.Never.Text = "Never"; + this.Never.UseVisualStyleBackColor = false; + this.Never.Click += new System.EventHandler(this.Never_Click); + // + // Later + // + this.Later.BackColor = System.Drawing.Color.DimGray; + this.Later.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.Later.Location = new System.Drawing.Point(327, 114); + this.Later.Name = "Later"; + this.Later.Size = new System.Drawing.Size(121, 27); + this.Later.TabIndex = 7; + this.Later.Text = "Ask Later"; + this.Later.UseVisualStyleBackColor = false; + this.Later.Click += new System.EventHandler(this.Later_Click); + // + // Yes + // + this.Yes.BackColor = System.Drawing.Color.DimGray; + this.Yes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(214)))), ((int)(((byte)(255))))); + this.Yes.Location = new System.Drawing.Point(13, 114); + this.Yes.Name = "Yes"; + this.Yes.Size = new System.Drawing.Size(121, 27); + this.Yes.TabIndex = 6; + this.Yes.Text = "Yes"; + this.Yes.UseVisualStyleBackColor = false; + this.Yes.Click += new System.EventHandler(this.Yes_Click); + // + // UpdateUI + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(460, 150); + this.Controls.Add(this.UpdatePanel); + this.Controls.Add(this.SelectionPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "UpdateUI"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "PrimeHack Updater"; + this.UpdatePanel.Panel1.ResumeLayout(false); + this.UpdatePanel.Panel1.PerformLayout(); + this.UpdatePanel.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.UpdatePanel)).EndInit(); + this.UpdatePanel.ResumeLayout(false); + this.SelectionPanel.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); } @@ -239,5 +251,6 @@ private void InitializeComponent() private System.Windows.Forms.Button Later; private System.Windows.Forms.Button Yes; private System.Windows.Forms.CheckBox immersiveMode; - } + private System.Windows.Forms.CheckBox portableMode; + } } \ No newline at end of file diff --git a/PrimeHack Updater/Source/WinForms/UpdateUI.cs b/PrimeHack Updater/Source/WinForms/UpdateUI.cs index fe3d1af..2a7b0ff 100644 --- a/PrimeHack Updater/Source/WinForms/UpdateUI.cs +++ b/PrimeHack Updater/Source/WinForms/UpdateUI.cs @@ -41,6 +41,7 @@ public void ISOSelection() writeLine("ISO selector"); immersiveMode.Checked = Updater.cfg.getImmersiveMode(); + portableMode.Checked = File.Exists("./portable.txt"); UpdatePanel.Hide(); SelectionPanel.Show(); @@ -83,6 +84,14 @@ private void ImmersiveChecked(object sender, EventArgs e) Updater.cfg.setImmersiveMode(immersiveMode.Checked); } + private void PortableChecked(object sender, EventArgs e) + { + if (portableMode.Checked && !File.Exists("./portable.txt")) + File.Create("./portable.txt").Close(); + else if (!portableMode.Checked && File.Exists("./portable.txt")) + File.Delete("./portable.txt"); + } + public void UpdateProgress(object sender, DownloadProgressChangedEventArgs e) { BeginInvoke((Action)(() => @@ -173,5 +182,5 @@ public void LoadFont() AddFontMemResourceEx(fontPtr, (uint)Properties.Resources.Deface_Regular_v1.Length, IntPtr.Zero, ref dummy); System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr); } - } + } }