From e340033685a6b73fee07a0250fc0e6f707864cf7 Mon Sep 17 00:00:00 2001 From: SirMangler Date: Wed, 27 Jan 2021 05:24:57 +0000 Subject: [PATCH] Removed Internal Updater + Added Immersive and Portable --- InternalUpdater/App.config | 6 - InternalUpdater/InternalUpdater.csproj | 112 ----- InternalUpdater/Program.cs | 66 --- InternalUpdater/Properties/AssemblyInfo.cs | 36 -- InternalUpdater/Properties/app.manifest | 70 --- InternalUpdater/TimedWebClient.cs | 16 - PrimeHack Updater.sln | 18 +- PrimeHack Updater/PrimeHack Updater.csproj | 3 +- .../Properties/Resources.Designer.cs | 10 - PrimeHack Updater/Properties/Resources.resx | 3 - .../Resources/InternalUpdater.exe | Bin 6656 -> 0 bytes PrimeHack Updater/Source/CfgManager.cs | 2 +- PrimeHack Updater/Source/InternalUpdater.cs | 39 -- PrimeHack Updater/Source/Updater.cs | 52 ++- .../Source/WinForms/UpdateUI.Designer.cs | 403 +++++++++--------- PrimeHack Updater/Source/WinForms/UpdateUI.cs | 11 +- 16 files changed, 251 insertions(+), 596 deletions(-) delete mode 100644 InternalUpdater/App.config delete mode 100644 InternalUpdater/InternalUpdater.csproj delete mode 100644 InternalUpdater/Program.cs delete mode 100644 InternalUpdater/Properties/AssemblyInfo.cs delete mode 100644 InternalUpdater/Properties/app.manifest delete mode 100644 InternalUpdater/TimedWebClient.cs delete mode 100644 PrimeHack Updater/Resources/InternalUpdater.exe delete mode 100644 PrimeHack Updater/Source/InternalUpdater.cs 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 20d1dbcb8256afce084177ecde968447606081fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6656 zcmeHLdvH|M8UOCxWQiM%B=Sr^ZVX_|W1B!w5|uo8EG8jlH#{^*?(W`fuH4ns$FUuUwm!U~txh{SN+0z1oqc4pFz{#p z(6e*Cd(QWL=X>6B&Ud%#x;^9~qCE6dr-%;X$*o1evx8BPixxarL{FdhX8A#>^UdR>-HLnf+Tj#i>HF#g3ds}Lr&U_5xE&~8$}0x+lK_d2EHYPupAa9o|y+D=}O35 z$AcE4IUI!CHb8VfaCg=cEzhN$ZLVZY7hDCHugT)~I@+*<`MpH|pb6VxcXm^V2E3MS zg@6>cwP3)GmY`>~7Fh4KG{XcV+e!oIENc#WR%;<@%bJRz$#F$v+hocoryMpF5*1=5 zWrei>{*N-_Ia*m=9_2mDRbZ7kG#$RzA6qs1gD5SpR_}SqKpp*>hQ~ zHCLv%YZB|0U1li=6CQVs+ijL%c+6Ef508|8P{{gZQmC|vJRG)*<;wYBsA}`CZId`c zXq>NY4cPfjf}}B1MmeHRq+j&gw1&by~6KUdMsiy$0v9Pu3~zhpK8uazB(1F z`+OasU4{8ZrnMPnkeSgil~&J`2_&ME(o#Z{So?w`P3(WDAQ(r80`m(x3kQp<3UIrC%>oX{RW3J;f!{;dx?TnUayk8YEf- ze@@&Q&*FJLwD>!qc%7w}5DAFy5Eub~4N`vv}b z0Ymf#Fk9(UK$~Q_6x6)Ybc~Zvo1Q?FvJcc7lbaw1m(0#ozN+MlhnKm_3?~e21x4+U zX&HKuBATxNj-s~PIB7}=-GMx?@tkaIer-HeY|dSvK~ zq-b1?jZCiTO~f2MskO}sqTHa(>En0n0VQe$`e)N3$~Y>7^>JWr{B+<9U|C0x7^%Rrezrn~78`n0Pz=Fg0ms_c02jjX zhRUd-2fS0U3iUxl7(5PmEu!jk^LW8Ij83D6&dsbqA-iY6wHSVEXygn|gkUy1$`0u; zMnUI5h5$K$ye=WA9K@u-ld{&N)~Mhb!K$s`e^NA;c$%04UZzVG2ZZ+MOd^C?e}qym^C z%+n$UvU{4VsG!8>p}gY0qN3tW#hdd8tZtI#muN*i2B6}on_NX`5K)v*GDdmRq>`?D z(2Ga%6G3EVVHXl6s$K40- zeCOfk_KiRE#J0DM1<&{^n|A)Z^w{V3|NYpJTQ6z;@%N6f@$=am7+)ZzKAA3N%L4MO z4VD`3He;Ey3>O>D2nl@b3DFFRF3dfg?OZBScQS6g4diXNC`N3Z~mYkPc&|kqf*DG9*XEpH&lQr-4clbZ3le;HqpKsTm!xJ0c z9a_yUwKw(m*{BlwCo|FSHxpJ!>+jW2HT7pQS)0mae@?#p&ESpTH8j=Ma%tXpI7p$? zrz2Z)D~}Z(o!-))m`Tc(cGFrptceR)ly#cs4IBK)gLY~WDJ^3375INdKoWmL;464^ zs&+m~h_Lxi!!sZMcd)Sq->m7n9rG7l4S?(MWv~TsCBC!$_*z+q%YF-<-LxwCuM54H z_wj#|UkvGun0z*4H8-5FLbsTtK!?Ds$Gu}gPV(;Y;Z7RFoy2XSSQP-3Z#Nrv6JOT4 zxEBQjJ(V|4e98HN=L?>1*wZC_j*Te6>-4Vy1qEV&TW>M&?T{DEDpv@8@x9AMK@1v= zoI*hn_F32^=dJmh9j}b&o75dnR5VUB*FTQuV{NdZ%4__?m68sTyC*%A@ zex^fK+P@C0v&DKHbwPGq&Tc>FzaUG_df_RTSzK>$t4Ebmm+7o`2KaNOPI{3`nOaz7 ziYCY@ft*h0i@-BOL_Q9GIdc(|gZw`lXJaZ(p+^xBg_gjkdg8xUsvsp>PVx;2Lv9pu zE!05b7-mVF4`8<0ph#Exfr>@V< tKyLh(i#4tAimSw^D2MqiIoCQ7fUm%pBLYhDKgc~Rz8vm;<>k}}{0|JVPlx~j 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); } - } + } }