From 16ab72564d8f9a0f8c381bfa81b578512fa482b5 Mon Sep 17 00:00:00 2001 From: "gb.luke" Date: Thu, 1 Jul 2010 21:35:12 +0000 Subject: [PATCH] Various changes: - changed Application.StartupPath to Directory.GetCurrentDirectory() - began work on IOS/channels/systemmenu download list thingy (inspired by berdsen.home) --- NUS Downloader/Form1.Designer.cs | 65 ++++++++++++++++++++++++------- NUS Downloader/Form1.cs | 66 ++++++++++++++++++++++++-------- 2 files changed, 100 insertions(+), 31 deletions(-) diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs index eaffb1d..379a26a 100644 --- a/NUS Downloader/Form1.Designer.cs +++ b/NUS Downloader/Form1.Designer.cs @@ -50,6 +50,7 @@ this.IOSMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.VCMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.C64MenuList = new System.Windows.Forms.ToolStripMenuItem(); + this.C64MenuListDrop = new System.Windows.Forms.ContextMenuStrip(this.components); this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.MSXMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.N64MenuList = new System.Windows.Forms.ToolStripMenuItem(); @@ -63,6 +64,7 @@ this.WiiWareMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.RegionCodesList = new System.Windows.Forms.ToolStripMenuItem(); + this.MassUpdateList = 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(); @@ -136,8 +138,10 @@ this.ProxyPwdBox = new System.Windows.Forms.TextBox(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.C64MenuListDrop = new System.Windows.Forms.ContextMenuStrip(this.components); this.dlprogress = new wyDay.Controls.Windows7ProgressBar(); + this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); this.databaseStrip.SuspendLayout(); this.tmdgpbox.SuspendLayout(); this.ticketgpbox.SuspendLayout(); @@ -311,10 +315,11 @@ this.VCMenuList, this.WiiWareMenuList, this.toolStripSeparator1, - this.RegionCodesList}); + this.RegionCodesList, + this.MassUpdateList}); this.databaseStrip.Name = "databaseStrip"; this.databaseStrip.ShowItemToolTips = false; - this.databaseStrip.Size = new System.Drawing.Size(155, 142); + this.databaseStrip.Size = new System.Drawing.Size(167, 164); // // SystemMenuList // @@ -326,7 +331,7 @@ // IOSMenuList // this.IOSMenuList.Name = "IOSMenuList"; - this.IOSMenuList.Size = new System.Drawing.Size(154, 22); + this.IOSMenuList.Size = new System.Drawing.Size(166, 22); this.IOSMenuList.Text = "IOS"; // // VCMenuList @@ -344,7 +349,7 @@ this.TurboGrafxCDMenuList, this.VCArcadeMenuList}); this.VCMenuList.Name = "VCMenuList"; - this.VCMenuList.Size = new System.Drawing.Size(154, 22); + this.VCMenuList.Size = new System.Drawing.Size(166, 22); this.VCMenuList.Text = "Virtual Console"; // // C64MenuList @@ -354,6 +359,12 @@ this.C64MenuList.Size = new System.Drawing.Size(194, 22); this.C64MenuList.Text = "Commodore 64"; // + // C64MenuListDrop + // + this.C64MenuListDrop.Name = "C64MenuListDrop"; + this.C64MenuListDrop.OwnerItem = this.C64MenuList; + this.C64MenuListDrop.Size = new System.Drawing.Size(61, 4); + // // GenesisMenuList // this.GenesisMenuList.Name = "GenesisMenuList"; @@ -417,21 +428,31 @@ // WiiWareMenuList // this.WiiWareMenuList.Name = "WiiWareMenuList"; - this.WiiWareMenuList.Size = new System.Drawing.Size(154, 22); + this.WiiWareMenuList.Size = new System.Drawing.Size(166, 22); this.WiiWareMenuList.Text = "WiiWare"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(163, 6); // // RegionCodesList // this.RegionCodesList.Name = "RegionCodesList"; - this.RegionCodesList.Size = new System.Drawing.Size(154, 22); + this.RegionCodesList.Size = new System.Drawing.Size(166, 22); this.RegionCodesList.Text = "Region Codes"; this.RegionCodesList.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.RegionCodesList_DropDownItemClicked); // + // MassUpdateList + // + this.MassUpdateList.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.PALMassUpdate, + this.NTSCMassUpdate, + this.KoreaMassUpdate}); + this.MassUpdateList.Name = "MassUpdateList"; + this.MassUpdateList.Size = new System.Drawing.Size(166, 22); + this.MassUpdateList.Text = "Download Scripts"; + // // truchabox // this.truchabox.AutoSize = true; @@ -1166,12 +1187,6 @@ this.radioButton2.UseVisualStyleBackColor = true; this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); // - // C64MenuListDrop - // - this.C64MenuListDrop.Name = "C64MenuListDrop"; - this.C64MenuListDrop.OwnerItem = this.C64MenuList; - this.C64MenuListDrop.Size = new System.Drawing.Size(153, 26); - // // dlprogress // this.dlprogress.ContainerControl = this; @@ -1180,6 +1195,24 @@ this.dlprogress.Size = new System.Drawing.Size(250, 15); this.dlprogress.TabIndex = 47; // + // PALMassUpdate + // + this.PALMassUpdate.Name = "PALMassUpdate"; + this.PALMassUpdate.Size = new System.Drawing.Size(152, 22); + this.PALMassUpdate.Text = "PAL"; + // + // NTSCMassUpdate + // + this.NTSCMassUpdate.Name = "NTSCMassUpdate"; + this.NTSCMassUpdate.Size = new System.Drawing.Size(152, 22); + this.NTSCMassUpdate.Text = "NTSC"; + // + // KoreaMassUpdate + // + this.KoreaMassUpdate.Name = "KoreaMassUpdate"; + this.KoreaMassUpdate.Size = new System.Drawing.Size(152, 22); + this.KoreaMassUpdate.Text = "Korea"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1352,6 +1385,10 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem updateDatabaseToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip C64MenuListDrop; + private System.Windows.Forms.ToolStripMenuItem MassUpdateList; + private System.Windows.Forms.ToolStripMenuItem PALMassUpdate; + private System.Windows.Forms.ToolStripMenuItem NTSCMassUpdate; + private System.Windows.Forms.ToolStripMenuItem KoreaMassUpdate; } } diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs index 2ab9956..7afe66c 100644 --- a/NUS Downloader/Form1.cs +++ b/NUS Downloader/Form1.cs @@ -220,7 +220,7 @@ namespace NUS_Downloader private void BootChecks() { // Directory stuff - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -244,7 +244,7 @@ namespace NUS_Downloader { WriteStatus(" - Converting your key.bin file to the correct format..."); // Directory stuff - string keydir = Application.StartupPath; + string keydir = Directory.GetCurrentDirectory(); if (!(keydir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(keydir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) keydir += Path.DirectorySeparatorChar.ToString(); TextReader ckreader = new StreamReader(currentdir + "key.bin"); @@ -831,7 +831,7 @@ namespace NUS_Downloader downloadstartbtn.Text = "Starting NUS Download!"; // Current directory... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1274,7 +1274,7 @@ namespace NUS_Downloader private void CreateTitleDirectory() { // Creates the directory for the downloaded title... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1304,7 +1304,7 @@ namespace NUS_Downloader /// private void DeleteTitleDirectory() { - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1364,7 +1364,7 @@ namespace NUS_Downloader WriteStatus("Beginning WAD Pack..."); // Obtain Current Directory - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1533,7 +1533,7 @@ namespace NUS_Downloader WriteStatus("This application created by WB3000"); WriteStatus("Various sections contributed by lukegb"); WriteStatus(""); - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false) currentdir += Path.DirectorySeparatorChar.ToString(); if (File.Exists(currentdir + "key.bin") == false) @@ -1703,7 +1703,7 @@ namespace NUS_Downloader public byte[] LoadCommonKey(string keyfile) { // Directory stuff - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1725,7 +1725,7 @@ namespace NUS_Downloader public bool WriteCommonKey(string keyfile, byte[] commonkey) { // Directory stuff - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -1786,7 +1786,7 @@ namespace NUS_Downloader xDoc.Load("database.xml"); // Variables - string[] XMLNodeTypes = new string[4] { "SYS", "IOS", "VC", "WW" }; + string[] XMLNodeTypes = new string[5] { "SYS", "IOS", "VC", "WW", "UPD" }; int totalLength = xDoc.SelectNodes("/database/*").Count; int rnt = 0; @@ -1801,6 +1801,7 @@ namespace NUS_Downloader XmlAttributeCollection XMLAttributes = XMLSpecificNodeTypeList[x].Attributes; string titleID = ""; + string updateScript; string descname = ""; bool dangerous = false; bool ticket = true; @@ -1823,6 +1824,9 @@ namespace NUS_Downloader case "titleID": titleID = ChildrenOfTheNode[z].InnerText; break; + case "titleIDs": + updateScript = ChildrenOfTheNode[z].InnerText; + break; case "version": string[] versions = ChildrenOfTheNode[z].InnerText.Split(','); // Add to region things? @@ -1875,8 +1879,15 @@ namespace NUS_Downloader break; } XMLToolStripItem.Image = SelectItemImage(ticket, dangerous); - - XMLToolStripItem.Text = String.Format("{0} - {1}", titleID, descname); + + if (titleID != "") + { + XMLToolStripItem.Text = String.Format("{0} - {1}", titleID, descname); + } + else + { + XMLToolStripItem.Text = descname; + } } AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes); } @@ -1943,7 +1954,28 @@ namespace NUS_Downloader default: break; } - // additionitem.DropDownItemClicked += new ToolStripItemClickedEventHandler(wwitem_regionclicked); + additionitem.DropDownItemClicked += new ToolStripItemClickedEventHandler(wwitem_regionclicked); + } + else if (type == 4) + { + // I am a brand new combine harvester + //MassUpdateList.DropDownItems.Add(additionitem); + switch (attributes[0].Value) + { + case "KOR": + KoreaMassUpdate.DropDownItems.Add(additionitem); + break; + case "PAL": + PALMassUpdate.DropDownItems.Add(additionitem); + break; + case "NTSC": + NTSCMassUpdate.DropDownItems.Add(additionitem); + break; + default: + Debug.WriteLine("Oops - database error"); + return; + } + additionitem.Click += new ToolStripItemClickedEventHandler(upditem_itemclicked); } else { @@ -3790,7 +3822,7 @@ namespace NUS_Downloader WriteStatus(" - Outputting results to NUS script..."); // Current directory... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -3981,7 +4013,7 @@ namespace NUS_Downloader private void SaveProxyBtn_Click(object sender, EventArgs e) { // Current directory... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -4031,7 +4063,7 @@ namespace NUS_Downloader private void proxySettingsToolStripMenuItem_Click(object sender, EventArgs e) { // Current directory... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString(); @@ -4078,7 +4110,7 @@ namespace NUS_Downloader private void loadNUSScriptToolStripMenuItem_Click(object sender, EventArgs e) { // Current directory... - string currentdir = Application.StartupPath; + string currentdir = Directory.GetCurrentDirectory(); if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString()))) currentdir += Path.DirectorySeparatorChar.ToString();