From 80ef75f85881cc7241693b1dcd1f6090e6ca7e2e Mon Sep 17 00:00:00 2001 From: "gb.luke" Date: Tue, 29 Jun 2010 16:06:15 +0000 Subject: [PATCH] Even more threading! --- NUS Downloader/Form1.Designer.cs | 435 +++++++++--------- NUS Downloader/Form1.cs | 144 ++++-- NUS Downloader/NUS Downloader.csproj | 13 +- NUS Downloader/NUS.cs | 2 +- .../Properties/Resources.Designer.cs | 7 + NUS Downloader/Properties/Resources.resx | 17 +- NUS Downloader/TMD.cs | 2 +- 7 files changed, 344 insertions(+), 276 deletions(-) diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs index 0d0f277..a99946c 100644 --- a/NUS Downloader/Form1.Designer.cs +++ b/NUS Downloader/Form1.Designer.cs @@ -63,8 +63,6 @@ this.WiiWareMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.RegionCodesList = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.updateDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.truchabox = new System.Windows.Forms.CheckBox(); this.tmdgpbox = new System.Windows.Forms.GroupBox(); this.tmdversiontrucha = new System.Windows.Forms.TextBox(); @@ -95,15 +93,34 @@ this.button3 = new System.Windows.Forms.Button(); this.contentsEdit = new System.Windows.Forms.ListBox(); this.contentModBox = new System.Windows.Forms.GroupBox(); + this.button16 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); this.button15 = new System.Windows.Forms.Button(); this.button14 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); this.button17 = new System.Windows.Forms.Button(); this.extrasStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.emulateUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.uSANTSCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.europePALToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.japanNTSCJToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.koreaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.enableBETATruchaFeaturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this.loadNUSScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); + this.getCommonKeyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.updateDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveaswadbox = new System.Windows.Forms.CheckBox(); this.deletecontentsbox = new System.Windows.Forms.CheckBox(); this.proxyBox = new System.Windows.Forms.GroupBox(); @@ -111,32 +128,15 @@ this.label12 = new System.Windows.Forms.Label(); this.ProxyUser = new System.Windows.Forms.TextBox(); this.SaveProxyBtn = new System.Windows.Forms.Button(); + this.ProxyAssistBtn = new System.Windows.Forms.Button(); this.ProxyURL = new System.Windows.Forms.TextBox(); this.ProxyVerifyBox = new System.Windows.Forms.GroupBox(); this.SaveProxyPwdBtn = new System.Windows.Forms.Button(); this.label14 = new System.Windows.Forms.Label(); this.ProxyPwdBox = new System.Windows.Forms.TextBox(); - this.dlprogress = new wyDay.Controls.Windows7ProgressBar(); - this.ProxyAssistBtn = new System.Windows.Forms.Button(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.button16 = new System.Windows.Forms.Button(); - this.button13 = new System.Windows.Forms.Button(); - this.button12 = new System.Windows.Forms.Button(); - this.button8 = new System.Windows.Forms.Button(); - this.button11 = new System.Windows.Forms.Button(); - this.button9 = new System.Windows.Forms.Button(); - this.button10 = new System.Windows.Forms.Button(); - this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.emulateUpdate = new System.Windows.Forms.ToolStripMenuItem(); - this.uSANTSCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.europePALToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.japanNTSCJToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.koreaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.enableBETATruchaFeaturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.loadNUSScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.getCommonKeyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dlprogress = new wyDay.Controls.Windows7ProgressBar(); this.databaseStrip.SuspendLayout(); this.tmdgpbox.SuspendLayout(); this.ticketgpbox.SuspendLayout(); @@ -310,12 +310,10 @@ this.VCMenuList, this.WiiWareMenuList, this.toolStripSeparator1, - this.RegionCodesList, - this.toolStripSeparator2, - this.updateDatabaseToolStripMenuItem}); + this.RegionCodesList}); this.databaseStrip.Name = "databaseStrip"; this.databaseStrip.ShowItemToolTips = false; - this.databaseStrip.Size = new System.Drawing.Size(164, 148); + this.databaseStrip.Size = new System.Drawing.Size(155, 120); // // SystemMenuList // @@ -327,7 +325,7 @@ // IOSMenuList // this.IOSMenuList.Name = "IOSMenuList"; - this.IOSMenuList.Size = new System.Drawing.Size(163, 22); + this.IOSMenuList.Size = new System.Drawing.Size(154, 22); this.IOSMenuList.Text = "IOS"; // // VCMenuList @@ -345,7 +343,7 @@ this.TurboGrafxCDMenuList, this.VCArcadeMenuList}); this.VCMenuList.Name = "VCMenuList"; - this.VCMenuList.Size = new System.Drawing.Size(163, 22); + this.VCMenuList.Size = new System.Drawing.Size(154, 22); this.VCMenuList.Text = "Virtual Console"; // // C64MenuList @@ -417,33 +415,21 @@ // WiiWareMenuList // this.WiiWareMenuList.Name = "WiiWareMenuList"; - this.WiiWareMenuList.Size = new System.Drawing.Size(163, 22); + this.WiiWareMenuList.Size = new System.Drawing.Size(154, 22); this.WiiWareMenuList.Text = "WiiWare"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(160, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6); // // RegionCodesList // this.RegionCodesList.Name = "RegionCodesList"; - this.RegionCodesList.Size = new System.Drawing.Size(163, 22); + this.RegionCodesList.Size = new System.Drawing.Size(154, 22); this.RegionCodesList.Text = "Region Codes"; this.RegionCodesList.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.RegionCodesList_DropDownItemClicked); // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(160, 6); - // - // updateDatabaseToolStripMenuItem - // - this.updateDatabaseToolStripMenuItem.Name = "updateDatabaseToolStripMenuItem"; - this.updateDatabaseToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.updateDatabaseToolStripMenuItem.Text = "Update Database"; - this.updateDatabaseToolStripMenuItem.Click += new System.EventHandler(this.updateDatabaseToolStripMenuItem_Click); - // // truchabox // this.truchabox.AutoSize = true; @@ -769,6 +755,28 @@ this.contentModBox.Text = "Edit Title Contents"; this.contentModBox.Visible = false; // + // button16 + // + this.button16.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button16.Image = global::NUS_Downloader.Properties.Resources.bug_add; + this.button16.Location = new System.Drawing.Point(136, 198); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(26, 26); + this.button16.TabIndex = 44; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // + // button13 + // + this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button13.Image = global::NUS_Downloader.Properties.Resources.link; + this.button13.Location = new System.Drawing.Point(104, 198); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(26, 26); + this.button13.TabIndex = 43; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // // button15 // this.button15.FlatStyle = System.Windows.Forms.FlatStyle.Popup; @@ -791,6 +799,61 @@ this.button14.UseVisualStyleBackColor = true; this.button14.Click += new System.EventHandler(this.button14_Click); // + // button12 + // + this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image"))); + this.button12.Location = new System.Drawing.Point(72, 198); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(26, 26); + this.button12.TabIndex = 40; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // button8 + // + this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image"))); + this.button8.Location = new System.Drawing.Point(213, 19); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(26, 26); + this.button8.TabIndex = 33; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // button11 + // + this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image"))); + this.button11.Location = new System.Drawing.Point(9, 198); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(26, 26); + this.button11.TabIndex = 36; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button9 + // + this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image"))); + this.button9.Location = new System.Drawing.Point(213, 53); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(26, 26); + this.button9.TabIndex = 34; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // button10 + // + this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image"))); + this.button10.Location = new System.Drawing.Point(41, 198); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(26, 26); + this.button10.TabIndex = 35; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // // button17 // this.button17.FlatStyle = System.Windows.Forms.FlatStyle.Popup; @@ -816,35 +879,127 @@ this.toolStripSeparator6, this.loadNUSScriptToolStripMenuItem, this.toolStripSeparator7, - this.getCommonKeyMenuItem}); + this.getCommonKeyMenuItem, + this.toolStripSeparator2, + this.updateDatabaseToolStripMenuItem}); this.extrasStrip.Name = "extrasStrip"; - this.extrasStrip.Size = new System.Drawing.Size(242, 188); + this.extrasStrip.Size = new System.Drawing.Size(242, 216); + // + // loadInfoFromTMDToolStripMenuItem + // + this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify; + this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem"; + this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD"; + this.loadInfoFromTMDToolStripMenuItem.Click += new System.EventHandler(this.loadInfoFromTMDToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(238, 6); // + // emulateUpdate + // + this.emulateUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.uSANTSCToolStripMenuItem, + this.europePALToolStripMenuItem, + this.japanNTSCJToolStripMenuItem, + this.koreaToolStripMenuItem}); + this.emulateUpdate.Image = global::NUS_Downloader.Properties.Resources.server_connect; + this.emulateUpdate.Name = "emulateUpdate"; + this.emulateUpdate.Size = new System.Drawing.Size(241, 22); + this.emulateUpdate.Text = "Emulate Wii System Update"; + this.emulateUpdate.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.emulateUpdate_DropDownItemClicked); + // + // uSANTSCToolStripMenuItem + // + this.uSANTSCToolStripMenuItem.Name = "uSANTSCToolStripMenuItem"; + this.uSANTSCToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.uSANTSCToolStripMenuItem.Text = "USA"; + // + // europePALToolStripMenuItem + // + this.europePALToolStripMenuItem.Name = "europePALToolStripMenuItem"; + this.europePALToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.europePALToolStripMenuItem.Text = "EUROPE"; + // + // japanNTSCJToolStripMenuItem + // + this.japanNTSCJToolStripMenuItem.Name = "japanNTSCJToolStripMenuItem"; + this.japanNTSCJToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.japanNTSCJToolStripMenuItem.Text = "JAPAN"; + // + // koreaToolStripMenuItem + // + this.koreaToolStripMenuItem.Name = "koreaToolStripMenuItem"; + this.koreaToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.koreaToolStripMenuItem.Text = "KOREA"; + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Size = new System.Drawing.Size(238, 6); // + // proxySettingsToolStripMenuItem + // + this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link; + this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem"; + this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.proxySettingsToolStripMenuItem.Text = "Proxy Settings"; + this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click); + // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new System.Drawing.Size(238, 6); // + // enableBETATruchaFeaturesToolStripMenuItem + // + this.enableBETATruchaFeaturesToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.bug_error; + this.enableBETATruchaFeaturesToolStripMenuItem.Name = "enableBETATruchaFeaturesToolStripMenuItem"; + this.enableBETATruchaFeaturesToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.enableBETATruchaFeaturesToolStripMenuItem.Text = "Enable BETA Trucha Features"; + this.enableBETATruchaFeaturesToolStripMenuItem.Click += new System.EventHandler(this.enableBETATruchaFeaturesToolStripMenuItem_Click); + // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Size = new System.Drawing.Size(238, 6); // + // loadNUSScriptToolStripMenuItem + // + this.loadNUSScriptToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_go; + this.loadNUSScriptToolStripMenuItem.Name = "loadNUSScriptToolStripMenuItem"; + this.loadNUSScriptToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.loadNUSScriptToolStripMenuItem.Text = "Load NUS Script"; + this.loadNUSScriptToolStripMenuItem.Click += new System.EventHandler(this.loadNUSScriptToolStripMenuItem_Click); + // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Size = new System.Drawing.Size(238, 6); // + // getCommonKeyMenuItem + // + this.getCommonKeyMenuItem.Image = global::NUS_Downloader.Properties.Resources.key; + this.getCommonKeyMenuItem.Name = "getCommonKeyMenuItem"; + this.getCommonKeyMenuItem.Size = new System.Drawing.Size(241, 22); + this.getCommonKeyMenuItem.Text = "Retrieve Common Key (key.bin)"; + this.getCommonKeyMenuItem.Click += new System.EventHandler(this.getCommonKeyMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(238, 6); + // + // updateDatabaseToolStripMenuItem + // + this.updateDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.database_save; + this.updateDatabaseToolStripMenuItem.Name = "updateDatabaseToolStripMenuItem"; + this.updateDatabaseToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.updateDatabaseToolStripMenuItem.Text = "Update Database"; + this.updateDatabaseToolStripMenuItem.Click += new System.EventHandler(this.updateDatabaseToolStripMenuItem_Click); + // // saveaswadbox // this.saveaswadbox.AutoSize = true; @@ -922,6 +1077,17 @@ this.SaveProxyBtn.UseVisualStyleBackColor = true; this.SaveProxyBtn.Click += new System.EventHandler(this.SaveProxyBtn_Click); // + // ProxyAssistBtn + // + this.ProxyAssistBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.ProxyAssistBtn.Image = global::NUS_Downloader.Properties.Resources.help; + this.ProxyAssistBtn.Location = new System.Drawing.Point(177, 79); + this.ProxyAssistBtn.Name = "ProxyAssistBtn"; + this.ProxyAssistBtn.Size = new System.Drawing.Size(29, 26); + this.ProxyAssistBtn.TabIndex = 28; + this.ProxyAssistBtn.UseVisualStyleBackColor = true; + this.ProxyAssistBtn.Click += new System.EventHandler(this.ProxyAssistBtn_Click); + // // ProxyURL // this.ProxyURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -974,25 +1140,6 @@ this.ProxyPwdBox.UseSystemPasswordChar = true; this.ProxyPwdBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ProxyPwdBox_KeyPress); // - // dlprogress - // - this.dlprogress.ContainerControl = this; - this.dlprogress.Location = new System.Drawing.Point(12, 95); - this.dlprogress.Name = "dlprogress"; - this.dlprogress.Size = new System.Drawing.Size(250, 15); - this.dlprogress.TabIndex = 47; - // - // ProxyAssistBtn - // - this.ProxyAssistBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.ProxyAssistBtn.Image = global::NUS_Downloader.Properties.Resources.help; - this.ProxyAssistBtn.Location = new System.Drawing.Point(177, 79); - this.ProxyAssistBtn.Name = "ProxyAssistBtn"; - this.ProxyAssistBtn.Size = new System.Drawing.Size(29, 26); - this.ProxyAssistBtn.TabIndex = 28; - this.ProxyAssistBtn.UseVisualStyleBackColor = true; - this.ProxyAssistBtn.Click += new System.EventHandler(this.ProxyAssistBtn_Click); - // // radioButton1 // this.radioButton1.BackColor = System.Drawing.Color.Transparent; @@ -1017,159 +1164,13 @@ this.radioButton2.UseVisualStyleBackColor = true; this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); // - // button16 + // dlprogress // - this.button16.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button16.Image = global::NUS_Downloader.Properties.Resources.bug_add; - this.button16.Location = new System.Drawing.Point(136, 198); - this.button16.Name = "button16"; - this.button16.Size = new System.Drawing.Size(26, 26); - this.button16.TabIndex = 44; - this.button16.UseVisualStyleBackColor = true; - this.button16.Click += new System.EventHandler(this.button16_Click); - // - // button13 - // - this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button13.Image = global::NUS_Downloader.Properties.Resources.link; - this.button13.Location = new System.Drawing.Point(104, 198); - this.button13.Name = "button13"; - this.button13.Size = new System.Drawing.Size(26, 26); - this.button13.TabIndex = 43; - this.button13.UseVisualStyleBackColor = true; - this.button13.Click += new System.EventHandler(this.button13_Click); - // - // button12 - // - this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image"))); - this.button12.Location = new System.Drawing.Point(72, 198); - this.button12.Name = "button12"; - this.button12.Size = new System.Drawing.Size(26, 26); - this.button12.TabIndex = 40; - this.button12.UseVisualStyleBackColor = true; - this.button12.Click += new System.EventHandler(this.button12_Click); - // - // button8 - // - this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image"))); - this.button8.Location = new System.Drawing.Point(213, 19); - this.button8.Name = "button8"; - this.button8.Size = new System.Drawing.Size(26, 26); - this.button8.TabIndex = 33; - this.button8.UseVisualStyleBackColor = true; - this.button8.Click += new System.EventHandler(this.button8_Click); - // - // button11 - // - this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image"))); - this.button11.Location = new System.Drawing.Point(9, 198); - this.button11.Name = "button11"; - this.button11.Size = new System.Drawing.Size(26, 26); - this.button11.TabIndex = 36; - this.button11.UseVisualStyleBackColor = true; - this.button11.Click += new System.EventHandler(this.button11_Click); - // - // button9 - // - this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image"))); - this.button9.Location = new System.Drawing.Point(213, 53); - this.button9.Name = "button9"; - this.button9.Size = new System.Drawing.Size(26, 26); - this.button9.TabIndex = 34; - this.button9.UseVisualStyleBackColor = true; - this.button9.Click += new System.EventHandler(this.button9_Click); - // - // button10 - // - this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image"))); - this.button10.Location = new System.Drawing.Point(41, 198); - this.button10.Name = "button10"; - this.button10.Size = new System.Drawing.Size(26, 26); - this.button10.TabIndex = 35; - this.button10.UseVisualStyleBackColor = true; - this.button10.Click += new System.EventHandler(this.button10_Click); - // - // loadInfoFromTMDToolStripMenuItem - // - this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify; - this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem"; - this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD"; - this.loadInfoFromTMDToolStripMenuItem.Click += new System.EventHandler(this.loadInfoFromTMDToolStripMenuItem_Click); - // - // emulateUpdate - // - this.emulateUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.uSANTSCToolStripMenuItem, - this.europePALToolStripMenuItem, - this.japanNTSCJToolStripMenuItem, - this.koreaToolStripMenuItem}); - this.emulateUpdate.Image = global::NUS_Downloader.Properties.Resources.server_connect; - this.emulateUpdate.Name = "emulateUpdate"; - this.emulateUpdate.Size = new System.Drawing.Size(241, 22); - this.emulateUpdate.Text = "Emulate Wii System Update"; - this.emulateUpdate.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.emulateUpdate_DropDownItemClicked); - // - // uSANTSCToolStripMenuItem - // - this.uSANTSCToolStripMenuItem.Name = "uSANTSCToolStripMenuItem"; - this.uSANTSCToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.uSANTSCToolStripMenuItem.Text = "USA"; - // - // europePALToolStripMenuItem - // - this.europePALToolStripMenuItem.Name = "europePALToolStripMenuItem"; - this.europePALToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.europePALToolStripMenuItem.Text = "EUROPE"; - // - // japanNTSCJToolStripMenuItem - // - this.japanNTSCJToolStripMenuItem.Name = "japanNTSCJToolStripMenuItem"; - this.japanNTSCJToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.japanNTSCJToolStripMenuItem.Text = "JAPAN"; - // - // koreaToolStripMenuItem - // - this.koreaToolStripMenuItem.Name = "koreaToolStripMenuItem"; - this.koreaToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.koreaToolStripMenuItem.Text = "KOREA"; - // - // proxySettingsToolStripMenuItem - // - this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link; - this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem"; - this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.proxySettingsToolStripMenuItem.Text = "Proxy Settings"; - this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click); - // - // enableBETATruchaFeaturesToolStripMenuItem - // - this.enableBETATruchaFeaturesToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.bug_error; - this.enableBETATruchaFeaturesToolStripMenuItem.Name = "enableBETATruchaFeaturesToolStripMenuItem"; - this.enableBETATruchaFeaturesToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.enableBETATruchaFeaturesToolStripMenuItem.Text = "Enable BETA Trucha Features"; - this.enableBETATruchaFeaturesToolStripMenuItem.Click += new System.EventHandler(this.enableBETATruchaFeaturesToolStripMenuItem_Click); - // - // loadNUSScriptToolStripMenuItem - // - this.loadNUSScriptToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_go; - this.loadNUSScriptToolStripMenuItem.Name = "loadNUSScriptToolStripMenuItem"; - this.loadNUSScriptToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.loadNUSScriptToolStripMenuItem.Text = "Load NUS Script"; - this.loadNUSScriptToolStripMenuItem.Click += new System.EventHandler(this.loadNUSScriptToolStripMenuItem_Click); - // - // getCommonKeyMenuItem - // - this.getCommonKeyMenuItem.Image = global::NUS_Downloader.Properties.Resources.key; - this.getCommonKeyMenuItem.Name = "getCommonKeyMenuItem"; - this.getCommonKeyMenuItem.Size = new System.Drawing.Size(241, 22); - this.getCommonKeyMenuItem.Text = "Retrieve Common Key (key.bin)"; - this.getCommonKeyMenuItem.Click += new System.EventHandler(this.getCommonKeyMenuItem_Click); + this.dlprogress.ContainerControl = this; + this.dlprogress.Location = new System.Drawing.Point(12, 95); + this.dlprogress.Name = "dlprogress"; + this.dlprogress.Size = new System.Drawing.Size(250, 15); + this.dlprogress.TabIndex = 47; // // Form1 // @@ -1310,8 +1311,6 @@ private System.Windows.Forms.Button button13; private System.Windows.Forms.Button button16; private System.Windows.Forms.Button button17; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem updateDatabaseToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip extrasStrip; private System.Windows.Forms.ToolStripMenuItem loadInfoFromTMDToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; @@ -1342,6 +1341,8 @@ private System.Windows.Forms.ToolStripMenuItem loadNUSScriptToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; private System.Windows.Forms.ToolStripMenuItem getCommonKeyMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem updateDatabaseToolStripMenuItem; } } diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs index ea3ba43..e61abdb 100644 --- a/NUS Downloader/Form1.cs +++ b/NUS Downloader/Form1.cs @@ -54,6 +54,9 @@ namespace NUS_Downloader string proxy_usr; string proxy_pwd; + // Database thread + private BackgroundWorker fds; + // Common Key hash byte[] wii_commonkey_sha1 = new byte[20] { 0xEB, 0xEA, 0xE6, 0xD2, 0x76, 0x2D, 0x4D, 0x3E, 0xA1, 0x60, 0xA6, 0xD8, 0x32, 0x7F, 0xAC, 0x9A, 0x25, 0xF8, 0x06, 0x2B }; byte[] wii_commonkey_sha1_asstring = new byte[20] { 0x56, 0xdd, 0x4e, 0xb3, 0x59, 0x75, 0xc2, 0xfd, 0x5a, 0xe8, 0xba, 0x8c, 0x7d, 0x89, 0x9a, 0xc5, 0xe6, 0x17, 0x54, 0x19 }; @@ -87,16 +90,12 @@ namespace NUS_Downloader public Form1() { InitializeComponent(); - Thread th = new Thread(new ThreadStart(DoSplash)); - th.Start(); + this.fds = new BackgroundWorker(); + this.fds.DoWork += new DoWorkEventHandler(DoAllDatabaseyStuff); + this.fds.RunWorkerCompleted += new RunWorkerCompletedEventHandler(DoAllDatabaseyStuff_Completed); + this.fds.ProgressChanged += new ProgressChangedEventHandler(DoAllDatabaseyStuff_ProgressChanged); + this.fds.WorkerReportsProgress = true; BootChecks(); - th.Abort(); - } - - public void DoSplash() - { - Splash sp = new Splash(); - sp.ShowDialog(); } // CLI Mode @@ -271,19 +270,17 @@ namespace NUS_Downloader WriteStatus("Database.xml not found. Title database not usable!"); databaseButton.Visible = false; Extrasbtn.Size = new System.Drawing.Size(134, 20); - Extrasbtn.Anchor = AnchorStyles.Right; + updateDatabaseToolStripMenuItem.Text = "Download Database"; } else { string version = GetDatabaseVersion("database.xml"); WriteStatus("Database.xml detected."); WriteStatus(" - Version: " + version); - + databaseButton.Enabled = false; + databaseButton.Text = "DB Loading"; // Load it up... - ClearDatabaseStrip(); - FillDatabaseStrip(); - LoadRegionCodes(); - ShowInnerToolTips(false); + this.fds.RunWorkerAsync(); } // Check for Proxy Settings file... @@ -303,6 +300,26 @@ namespace NUS_Downloader } } + private void DoAllDatabaseyStuff(object sender, System.ComponentModel.DoWorkEventArgs e) + { + BackgroundWorker worker = sender as BackgroundWorker; + ClearDatabaseStrip(); + FillDatabaseStrip(worker); + LoadRegionCodes(); + ShowInnerToolTips(false); + } + + private void DoAllDatabaseyStuff_Completed(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) + { + this.databaseButton.Enabled = true; + this.databaseButton.Text = "Database..."; + } + + private void DoAllDatabaseyStuff_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e) + { + this.databaseButton.Text = "DB: " + e.ProgressPercentage + "%"; + } + private void SetAllEnabled(bool enabled) { for (int a = 0; a < this.Controls.Count; a++) @@ -330,7 +347,16 @@ namespace NUS_Downloader if (file.Contains("<")) xDoc.LoadXml(file); else - xDoc.Load(file); + { + if (File.Exists(file)) + { + xDoc.Load(file); + } + else + { + return "None Found"; + } + } XmlNodeList DatabaseList = xDoc.GetElementsByTagName("database"); XmlAttributeCollection Attributes = DatabaseList[0].Attributes; return Attributes[0].Value; @@ -1711,7 +1737,7 @@ namespace NUS_Downloader } catch (IOException e) { - WriteStatus("Error: couldn't write key.bin"); + WriteStatus("Error: couldn't write key.bin: " + e.Message); } return false; } @@ -1748,7 +1774,7 @@ namespace NUS_Downloader /// /// Fills the database strip. /// - private void FillDatabaseStrip() + private void FillDatabaseStrip(BackgroundWorker worker) { XmlDocument xDoc = new XmlDocument(); xDoc.Load("database.xml"); @@ -1756,6 +1782,8 @@ namespace NUS_Downloader // Variables string[] XMLNodeTypes = new string[4] { "SYS", "IOS", "VC", "WW" }; + int totalLength = xDoc.SelectNodes("/database/*").Count; + int rnt = 0; // Loop through XMLNodeTypes for (int i = 0; i < XMLNodeTypes.Length; i++) { @@ -1770,6 +1798,11 @@ namespace NUS_Downloader string descname = ""; bool dangerous = false; bool ticket = true; + + // Okay, so now report the progress... + rnt = rnt + 1; + float currentProgress = ((float)rnt / (float)totalLength) * (float)100; + worker.ReportProgress(Convert.ToInt16(Math.Round(currentProgress))); // Lol. XmlNodeList ChildrenOfTheNode = XMLSpecificNodeTypeList[x].ChildNodes; @@ -3459,11 +3492,11 @@ namespace NUS_Downloader /// Retrieves the new database via WiiBrew. /// /// Database as a String - private string RetrieveNewDatabase() + private void RetrieveNewDatabase(object sender, DoWorkEventArgs e) { // Retrieve Wiibrew database page source code WebClient databasedl = new WebClient(); - statusbox.Refresh(); + //statusbox.Refresh(); // Proxy if (!(String.IsNullOrEmpty(proxy_url))) @@ -3492,7 +3525,7 @@ namespace NUS_Downloader } string wiibrewsource = databasedl.DownloadString("http://www.wiibrew.org/wiki/NUS_Downloader/database?cachesmash=" + System.DateTime.Now.ToString()); - statusbox.Refresh(); + //statusbox.Refresh(); // Strip out HTML wiibrewsource = Regex.Replace(wiibrewsource, @"<(.|\n)*?>", ""); @@ -3510,15 +3543,13 @@ namespace NUS_Downloader wiibrewsource = wiibrewsource.Replace(" "," "); // Shouldn't occur, but they happen... // Return parsed xml database... - return wiibrewsource; + e.Result = wiibrewsource; } - private void updateDatabaseToolStripMenuItem_Click(object sender, EventArgs e) + private void RetrieveNewDatabase_Completed(object sender, RunWorkerCompletedEventArgs e) { - statusbox.Text = ""; - WriteStatus("Updating your database.xml from Wiibrew.org"); - string database = RetrieveNewDatabase(); + string database = e.Result.ToString(); string currentversion = GetDatabaseVersion("database.xml"); string onlineversion = GetDatabaseVersion(database); WriteStatus(" - Database successfully parsed!"); @@ -3531,21 +3562,54 @@ namespace NUS_Downloader return; } - WriteStatus(" - Overwriting your current database.xml..."); - WriteStatus(" - The old database will become 'olddatabase.xml' in case the new one is faulty."); + bool isCreation = false; + if (File.Exists("database.xml")) + { + WriteStatus(" - Overwriting your current database.xml..."); + WriteStatus(" - The old database will become 'olddatabase.xml' in case the new one is faulty."); - string olddatabase = File.ReadAllText("database.xml"); - File.WriteAllText("olddatabase.xml", olddatabase); - File.Delete("database.xml"); - File.WriteAllText("database.xml", database); + string olddatabase = File.ReadAllText("database.xml"); + File.WriteAllText("olddatabase.xml", olddatabase); + File.Delete("database.xml"); + File.WriteAllText("database.xml", database); + } + else + { + WriteStatus(" - database.xml has been created."); + File.WriteAllText("database.xml", database); + isCreation = true; + } // Load it up... - ClearDatabaseStrip(); - FillDatabaseStrip(); - LoadRegionCodes(); - ShowInnerToolTips(false); + this.fds.RunWorkerAsync(); - WriteStatus("Database successfully updated!"); + if (isCreation) + { + WriteStatus("Database successfully created!"); + } + else + { + WriteStatus("Database successfully updated!"); + databaseButton.Visible = false; + Extrasbtn.Size = new System.Drawing.Size(55, 20); + updateDatabaseToolStripMenuItem.Text = "Download Database"; + } + + } + + private void updateDatabaseToolStripMenuItem_Click(object sender, EventArgs e) + { + statusbox.Text = ""; + WriteStatus("Updating your database.xml from Wiibrew.org"); + + BackgroundWorker dbFetcher = new BackgroundWorker(); + dbFetcher.DoWork += new DoWorkEventHandler(RetrieveNewDatabase); + dbFetcher.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RetrieveNewDatabase_Completed); + dbFetcher.RunWorkerAsync(); + while (dbFetcher.IsBusy) + { + statusbox.Text += "."; + } } private void loadInfoFromTMDToolStripMenuItem_Click(object sender, EventArgs e) @@ -4122,8 +4186,8 @@ namespace NUS_Downloader public static byte[] HexStringToByteArray(string Hex) { byte[] Bytes = new byte[Hex.Length / 2]; - int[] HexValue = new int[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, + int[] HexValue = new int[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; for (int x = 0, i = 0; i < Hex.Length; i += 2, x += 1) @@ -4133,7 +4197,7 @@ namespace NUS_Downloader } return Bytes; - } + } diff --git a/NUS Downloader/NUS Downloader.csproj b/NUS Downloader/NUS Downloader.csproj index 9fcd404..631447f 100644 --- a/NUS Downloader/NUS Downloader.csproj +++ b/NUS Downloader/NUS Downloader.csproj @@ -25,7 +25,7 @@ 3.5 - publish\ + C:\Users\Luke\Desktop\NUSD\build\ true Disk false @@ -38,6 +38,7 @@ 11 1.0.0.%2a false + true true @@ -93,9 +94,6 @@ Resources.resx True - - Splash.cs - SettingsSingleFileGenerator Settings.Designer.cs @@ -105,12 +103,6 @@ Settings.settings True - - Form - - - Splash.cs - @@ -127,6 +119,7 @@ + diff --git a/NUS Downloader/NUS.cs b/NUS Downloader/NUS.cs index 6d5aa5f..3091fd1 100644 --- a/NUS Downloader/NUS.cs +++ b/NUS Downloader/NUS.cs @@ -16,6 +16,6 @@ namespace NUS_Downloader // Report Status back in EventHandler public delegate void StatusChangedEventHandler(string status); - public event StatusChangedEventHandler StatusChanged; + //public event StatusChangedEventHandler StatusChanged; } } diff --git a/NUS Downloader/Properties/Resources.Designer.cs b/NUS Downloader/Properties/Resources.Designer.cs index 35861b6..20372dd 100644 --- a/NUS Downloader/Properties/Resources.Designer.cs +++ b/NUS Downloader/Properties/Resources.Designer.cs @@ -130,6 +130,13 @@ namespace NUS_Downloader.Properties { } } + internal static System.Drawing.Bitmap database_save { + get { + object obj = ResourceManager.GetObject("database_save", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap direction_down { get { object obj = ResourceManager.GetObject("direction_down", resourceCulture); diff --git a/NUS Downloader/Properties/Resources.resx b/NUS Downloader/Properties/Resources.resx index abcb073..2c1b34b 100644 --- a/NUS Downloader/Properties/Resources.resx +++ b/NUS Downloader/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\direction_down.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\package_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -136,9 +139,6 @@ ..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\package_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\dsi.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -166,6 +166,9 @@ ..\Resources\bullet_orange.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\server_link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -175,13 +178,13 @@ ..\Resources\bullet_redorange.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\package_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\direction_down.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\database_save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/NUS Downloader/TMD.cs b/NUS Downloader/TMD.cs index a80ec57..2e85c70 100644 --- a/NUS Downloader/TMD.cs +++ b/NUS Downloader/TMD.cs @@ -7,7 +7,7 @@ namespace NUS_Downloader class TMD { // TMD Variables - public byte[] SignatureType; + //public byte[] SignatureType;