Database scripts now located and added.

This commit is contained in:
givememystuffplease 2010-07-10 03:32:53 +00:00
parent 15a7ad7893
commit 6ac6a30516
6 changed files with 198 additions and 408 deletions

View File

@ -19,6 +19,7 @@ namespace NUS_Downloader
private string IosTag = "IOS"; private string IosTag = "IOS";
private string VcTag = "VC"; private string VcTag = "VC";
private string WwTag = "WW"; private string WwTag = "WW";
private string UpdateTag = "UPD";
private string[] VcConsoles = new string[11] { "C64", "GEN", "MSX", "N64", "NEO", "NES", private string[] VcConsoles = new string[11] { "C64", "GEN", "MSX", "N64", "NEO", "NES",
"SMS", "SNES", "TG16", "TGCD", "ARC" }; "SMS", "SNES", "TG16", "TGCD", "ARC" };
@ -574,5 +575,47 @@ namespace NUS_Downloader
return regionItems; return regionItems;
} }
public ToolStripMenuItem[] LoadScripts()
{
if (databaseString.Length < 1)
{
throw new Exception("Load the database into a memory stream first!");
}
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(databaseString);
XmlNodeList ScriptXMLNodes = xDoc.GetElementsByTagName(UpdateTag);
ToolStripMenuItem[] scriptCollection = new ToolStripMenuItem[ScriptXMLNodes.Count];
for (int x = 0; x < ScriptXMLNodes.Count; x++)
{
ToolStripMenuItem XMLToolStripItem = new ToolStripMenuItem();
XmlAttributeCollection XMLAttributes = ScriptXMLNodes[x].Attributes;
XmlNodeList ChildrenOfTheNode = ScriptXMLNodes[x].ChildNodes;
for (int z = 0; z < ChildrenOfTheNode.Count; z++)
{
switch (ChildrenOfTheNode[z].Name)
{
case "name":
XMLToolStripItem.Text = ChildrenOfTheNode[z].InnerText;
break;
case "script":
XMLToolStripItem.ToolTipText = ChildrenOfTheNode[z].InnerText;
break;
default:
break;
}
XMLToolStripItem.Image = Properties.Resources.script_start;
}
scriptCollection[x] = XMLToolStripItem;
}
return scriptCollection;
}
} }
} }

View File

@ -63,14 +63,19 @@ namespace NUS_Downloader
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.RegionCodesList = new System.Windows.Forms.ToolStripMenuItem(); this.RegionCodesList = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.updateDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extrasStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.extrasStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.aboutNUSDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.proxyBox = new System.Windows.Forms.GroupBox(); this.proxyBox = new System.Windows.Forms.GroupBox();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.ProxyUser = new System.Windows.Forms.TextBox(); this.ProxyUser = new System.Windows.Forms.TextBox();
this.SaveProxyBtn = new System.Windows.Forms.Button(); this.SaveProxyBtn = new System.Windows.Forms.Button();
this.ProxyAssistBtn = new System.Windows.Forms.Button();
this.ProxyURL = new System.Windows.Forms.TextBox(); this.ProxyURL = new System.Windows.Forms.TextBox();
this.ProxyVerifyBox = new System.Windows.Forms.GroupBox(); this.ProxyVerifyBox = new System.Windows.Forms.GroupBox();
this.SaveProxyPwdPermanentBtn = new System.Windows.Forms.Button(); this.SaveProxyPwdPermanentBtn = new System.Windows.Forms.Button();
@ -81,7 +86,15 @@ namespace NUS_Downloader
this.consoleCBox = new System.Windows.Forms.ComboBox(); this.consoleCBox = new System.Windows.Forms.ComboBox();
this.scriptsbutton = new System.Windows.Forms.Button(); this.scriptsbutton = new System.Windows.Forms.Button();
this.scriptsStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.scriptsStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.scriptsLocalMenuEntry = new System.Windows.Forms.ToolStripMenuItem();
this.scriptsDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadNUSScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = 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.iosPatchGroupBox = new System.Windows.Forms.GroupBox(); this.iosPatchGroupBox = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.iosPatchesListBox = new System.Windows.Forms.CheckedListBox(); this.iosPatchesListBox = new System.Windows.Forms.CheckedListBox();
@ -89,28 +102,12 @@ namespace NUS_Downloader
this.richPanel = new System.Windows.Forms.Panel(); this.richPanel = new System.Windows.Forms.Panel();
this.saveaswadbtn = new System.Windows.Forms.Button(); this.saveaswadbtn = new System.Windows.Forms.Button();
this.iosPatchCheckbox = new System.Windows.Forms.CheckBox(); this.iosPatchCheckbox = new System.Windows.Forms.CheckBox();
this.ProxyAssistBtn = new System.Windows.Forms.Button();
this.databaseButton = new System.Windows.Forms.Button(); this.databaseButton = new System.Windows.Forms.Button();
this.keepenccontents = new System.Windows.Forms.CheckBox(); this.keepenccontents = new System.Windows.Forms.CheckBox();
this.clearButton = new System.Windows.Forms.Button(); this.clearButton = new System.Windows.Forms.Button();
this.packbox = new System.Windows.Forms.CheckBox(); this.packbox = new System.Windows.Forms.CheckBox();
this.decryptbox = new System.Windows.Forms.CheckBox(); this.decryptbox = new System.Windows.Forms.CheckBox();
this.localuse = new System.Windows.Forms.CheckBox(); this.localuse = new System.Windows.Forms.CheckBox();
this.updateDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutNUSDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scriptsLocalMenuEntry = new System.Windows.Forms.ToolStripMenuItem();
this.scriptsDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.loadNUSScriptToolStripMenuItem = 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.titleversion = new wmgCMS.WaterMarkTextBox(); this.titleversion = new wmgCMS.WaterMarkTextBox();
this.titleidbox = new wmgCMS.WaterMarkTextBox(); this.titleidbox = new wmgCMS.WaterMarkTextBox();
this.dlprogress = new wyDay.Controls.Windows7ProgressBar(); this.dlprogress = new wyDay.Controls.Windows7ProgressBar();
@ -324,6 +321,14 @@ namespace NUS_Downloader
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(160, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(160, 6);
// //
// updateDatabaseToolStripMenuItem
//
this.updateDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.database_save;
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);
//
// extrasStrip // extrasStrip
// //
this.extrasStrip.AllowMerge = false; this.extrasStrip.AllowMerge = false;
@ -336,16 +341,40 @@ namespace NUS_Downloader
this.extrasStrip.Name = "extrasStrip"; this.extrasStrip.Name = "extrasStrip";
this.extrasStrip.Size = new System.Drawing.Size(183, 82); this.extrasStrip.Size = new System.Drawing.Size(183, 82);
// //
// loadInfoFromTMDToolStripMenuItem
//
this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify;
this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem";
this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD";
this.loadInfoFromTMDToolStripMenuItem.Click += new System.EventHandler(this.loadInfoFromTMDToolStripMenuItem_Click);
//
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(179, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(179, 6);
// //
// proxySettingsToolStripMenuItem
//
this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link;
this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem";
this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.proxySettingsToolStripMenuItem.Text = "Proxy Settings";
this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click);
//
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(179, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(179, 6);
// //
// aboutNUSDToolStripMenuItem
//
this.aboutNUSDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.information;
this.aboutNUSDToolStripMenuItem.Name = "aboutNUSDToolStripMenuItem";
this.aboutNUSDToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.aboutNUSDToolStripMenuItem.Text = "About NUSD";
this.aboutNUSDToolStripMenuItem.Click += new System.EventHandler(this.aboutNUSDToolStripMenuItem_Click);
//
// proxyBox // proxyBox
// //
this.proxyBox.BackColor = System.Drawing.Color.White; this.proxyBox.BackColor = System.Drawing.Color.White;
@ -400,6 +429,17 @@ namespace NUS_Downloader
this.SaveProxyBtn.UseVisualStyleBackColor = true; this.SaveProxyBtn.UseVisualStyleBackColor = true;
this.SaveProxyBtn.Click += new System.EventHandler(this.SaveProxyBtn_Click); 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 // ProxyURL
// //
this.ProxyURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ProxyURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@ -514,11 +554,72 @@ namespace NUS_Downloader
this.scriptsStrip.ShowItemToolTips = false; this.scriptsStrip.ShowItemToolTips = false;
this.scriptsStrip.Size = new System.Drawing.Size(220, 98); this.scriptsStrip.Size = new System.Drawing.Size(220, 98);
// //
// scriptsLocalMenuEntry
//
this.scriptsLocalMenuEntry.Enabled = false;
this.scriptsLocalMenuEntry.Image = global::NUS_Downloader.Properties.Resources.script_code;
this.scriptsLocalMenuEntry.Name = "scriptsLocalMenuEntry";
this.scriptsLocalMenuEntry.Size = new System.Drawing.Size(219, 22);
this.scriptsLocalMenuEntry.Text = "Scripts (Local)";
//
// scriptsDatabaseToolStripMenuItem
//
this.scriptsDatabaseToolStripMenuItem.Enabled = false;
this.scriptsDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_code_red;
this.scriptsDatabaseToolStripMenuItem.Name = "scriptsDatabaseToolStripMenuItem";
this.scriptsDatabaseToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.scriptsDatabaseToolStripMenuItem.Text = "Scripts (Database)";
//
// loadNUSScriptToolStripMenuItem
//
this.loadNUSScriptToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_go;
this.loadNUSScriptToolStripMenuItem.Name = "loadNUSScriptToolStripMenuItem";
this.loadNUSScriptToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.loadNUSScriptToolStripMenuItem.Text = "Load NUS Script";
this.loadNUSScriptToolStripMenuItem.Click += new System.EventHandler(this.loadNUSScriptToolStripMenuItem_Click);
//
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(216, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(216, 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(219, 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";
//
// iosPatchGroupBox // iosPatchGroupBox
// //
this.iosPatchGroupBox.Controls.Add(this.label2); this.iosPatchGroupBox.Controls.Add(this.label2);
@ -612,17 +713,6 @@ namespace NUS_Downloader
this.iosPatchCheckbox.UseVisualStyleBackColor = true; this.iosPatchCheckbox.UseVisualStyleBackColor = true;
this.iosPatchCheckbox.CheckedChanged += new System.EventHandler(this.iosPatchCheckbox_CheckedChanged); this.iosPatchCheckbox.CheckedChanged += new System.EventHandler(this.iosPatchCheckbox_CheckedChanged);
// //
// 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);
//
// databaseButton // databaseButton
// //
this.databaseButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.databaseButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
@ -713,124 +803,6 @@ namespace NUS_Downloader
this.localuse.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.localuse.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.localuse.UseVisualStyleBackColor = true; this.localuse.UseVisualStyleBackColor = true;
// //
// updateDatabaseToolStripMenuItem
//
this.updateDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.database_save;
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);
//
// loadInfoFromTMDToolStripMenuItem
//
this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify;
this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem";
this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD";
this.loadInfoFromTMDToolStripMenuItem.Click += new System.EventHandler(this.loadInfoFromTMDToolStripMenuItem_Click);
//
// proxySettingsToolStripMenuItem
//
this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link;
this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem";
this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.proxySettingsToolStripMenuItem.Text = "Proxy Settings";
this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click);
//
// aboutNUSDToolStripMenuItem
//
this.aboutNUSDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.information;
this.aboutNUSDToolStripMenuItem.Name = "aboutNUSDToolStripMenuItem";
this.aboutNUSDToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.aboutNUSDToolStripMenuItem.Text = "About NUSD";
this.aboutNUSDToolStripMenuItem.Click += new System.EventHandler(this.aboutNUSDToolStripMenuItem_Click);
//
// scriptsLocalMenuEntry
//
this.scriptsLocalMenuEntry.Enabled = false;
this.scriptsLocalMenuEntry.Image = global::NUS_Downloader.Properties.Resources.script_code;
this.scriptsLocalMenuEntry.Name = "scriptsLocalMenuEntry";
this.scriptsLocalMenuEntry.Size = new System.Drawing.Size(219, 22);
this.scriptsLocalMenuEntry.Text = "Scripts (Local)";
//
// scriptsDatabaseToolStripMenuItem
//
this.scriptsDatabaseToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.PALMassUpdate,
this.NTSCMassUpdate,
this.KoreaMassUpdate});
this.scriptsDatabaseToolStripMenuItem.Enabled = false;
this.scriptsDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_code_red;
this.scriptsDatabaseToolStripMenuItem.Name = "scriptsDatabaseToolStripMenuItem";
this.scriptsDatabaseToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.scriptsDatabaseToolStripMenuItem.Text = "Scripts (Database)";
//
// PALMassUpdate
//
this.PALMassUpdate.Enabled = false;
this.PALMassUpdate.Name = "PALMassUpdate";
this.PALMassUpdate.Size = new System.Drawing.Size(104, 22);
this.PALMassUpdate.Text = "PAL";
//
// NTSCMassUpdate
//
this.NTSCMassUpdate.Enabled = false;
this.NTSCMassUpdate.Name = "NTSCMassUpdate";
this.NTSCMassUpdate.Size = new System.Drawing.Size(104, 22);
this.NTSCMassUpdate.Text = "NTSC";
//
// KoreaMassUpdate
//
this.KoreaMassUpdate.Enabled = false;
this.KoreaMassUpdate.Name = "KoreaMassUpdate";
this.KoreaMassUpdate.Size = new System.Drawing.Size(104, 22);
this.KoreaMassUpdate.Text = "Korea";
//
// loadNUSScriptToolStripMenuItem
//
this.loadNUSScriptToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.script_go;
this.loadNUSScriptToolStripMenuItem.Name = "loadNUSScriptToolStripMenuItem";
this.loadNUSScriptToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.loadNUSScriptToolStripMenuItem.Text = "Load NUS Script";
this.loadNUSScriptToolStripMenuItem.Click += new System.EventHandler(this.loadNUSScriptToolStripMenuItem_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(219, 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";
//
// titleversion // titleversion
// //
this.titleversion.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.titleversion.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -977,9 +949,6 @@ namespace NUS_Downloader
private System.Windows.Forms.ToolStripMenuItem scriptsLocalMenuEntry; private System.Windows.Forms.ToolStripMenuItem scriptsLocalMenuEntry;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem scriptsDatabaseToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem scriptsDatabaseToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem PALMassUpdate;
private System.Windows.Forms.ToolStripMenuItem NTSCMassUpdate;
private System.Windows.Forms.ToolStripMenuItem KoreaMassUpdate;
private System.Windows.Forms.ToolStripMenuItem aboutNUSDToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem aboutNUSDToolStripMenuItem;
private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button SaveProxyPwdPermanentBtn; private System.Windows.Forms.Button SaveProxyPwdPermanentBtn;

View File

@ -38,7 +38,7 @@ using System.Diagnostics;
namespace NUS_Downloader namespace NUS_Downloader
{ {
public partial class Form1 : Form partial class Form1 : Form
{ {
private readonly string CURRENT_DIR = Directory.GetCurrentDirectory(); private readonly string CURRENT_DIR = Directory.GetCurrentDirectory();
@ -115,9 +115,10 @@ namespace NUS_Downloader
WriteStatus("REMEMBER TO CHANGE TO THE RELEASE CONFIGURATION AND CHANGE VERSION NUMBER BEFORE BUILDING!", warningcolor); WriteStatus("REMEMBER TO CHANGE TO THE RELEASE CONFIGURATION AND CHANGE VERSION NUMBER BEFORE BUILDING!", warningcolor);
WriteStatus("\r\n"); WriteStatus("\r\n");
} }
/*
KoreaMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked); KoreaMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);
NTSCMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked); NTSCMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);
PALMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked); PALMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);*/
// Database BGLoader // Database BGLoader
this.fds = new BackgroundWorker(); this.fds = new BackgroundWorker();
@ -251,6 +252,7 @@ namespace NUS_Downloader
ClearDatabaseStrip(); ClearDatabaseStrip();
FillDatabaseStrip(worker); FillDatabaseStrip(worker);
LoadRegionCodes(); LoadRegionCodes();
FillDatabaseScripts();
ShowInnerToolTips(false); ShowInnerToolTips(false);
} }
@ -259,10 +261,11 @@ namespace NUS_Downloader
//this.databaseButton.Enabled = true; //this.databaseButton.Enabled = true;
this.databaseButton.Text = "Database..."; this.databaseButton.Text = "Database...";
this.databaseButton.Image = null; this.databaseButton.Image = null;
/*
if (this.KoreaMassUpdate.HasDropDownItems || this.PALMassUpdate.HasDropDownItems || this.NTSCMassUpdate.HasDropDownItems) if (this.KoreaMassUpdate.HasDropDownItems || this.PALMassUpdate.HasDropDownItems || this.NTSCMassUpdate.HasDropDownItems)
{ {
this.scriptsbutton.Enabled = true; this.scriptsbutton.Enabled = true;
} }*/
} }
private void DoAllDatabaseyStuff_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e) private void DoAllDatabaseyStuff_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
@ -1375,7 +1378,6 @@ namespace NUS_Downloader
// TODO: make this check InvokeRequired... // TODO: make this check InvokeRequired...
if (this.InvokeRequired) if (this.InvokeRequired)
{ {
Debug.Write("TOLDYOUSO!");
BootChecksCallback bcc = new BootChecksCallback(LoadRegionCodes); BootChecksCallback bcc = new BootChecksCallback(LoadRegionCodes);
this.Invoke(bcc); this.Invoke(bcc);
return; return;
@ -1468,6 +1470,18 @@ namespace NUS_Downloader
// Do nothing, some objects will not cast. // Do nothing, some objects will not cast.
} }
} }
foreach (ToolStripItem item in scriptsStrip.Items)
{
try
{
ToolStripMenuItem menuitem = (ToolStripMenuItem)item;
menuitem.DropDown.ShowItemToolTips = false;
}
catch (Exception)
{
// Do nothing, some objects will not cast.
}
}
} }
/// <summary> /// <summary>
@ -1561,36 +1575,6 @@ namespace NUS_Downloader
return resultArray; return resultArray;
} }
/*
/// <summary>
/// Does byte[] contain byte[]?
/// </summary>
/// <param name="bigboy">The large byte[].</param>
/// <param name="littleman">Small byte[] which may be in large one.</param>
/// <returns>messed up int[] with offsets.</returns>
private int[] ByteArrayContainsByteArray(byte[] bigboy, byte[] littleman)
{
// bigboy.Contains(littleman);
// returns offset { cnt , ofst };
int[] offset = new int[5];
for (int a = 0; a < (bigboy.Length - littleman.Length); a++)
{
int matches = 0;
for (int b = 0; b < littleman.Length; b++)
{
if (bigboy[a + b] == littleman[b])
matches += 1;
}
if (matches == littleman.Length)
{
offset[offset[0] + 1] = a;
offset[0] += 1;
}
}
return offset;
}*/
private WebClient ConfigureWithProxy(WebClient client) private WebClient ConfigureWithProxy(WebClient client)
{ {
// Proxy // Proxy
@ -2422,5 +2406,25 @@ namespace NUS_Downloader
iosPatchCheckbox.Checked = false; iosPatchCheckbox.Checked = false;
//packbox.Enabled = false; //packbox.Enabled = false;
} }
private void FillDatabaseScripts()
{
Database databaseObj = new Database();
databaseObj.LoadDatabaseToStream(Path.Combine(CURRENT_DIR, "database.xml"));
ToolStripMenuItem[] scriptItems = databaseObj.LoadScripts();
for (int a = 0; a < scriptItems.Length; a++)
{
scriptItems[a].DropDownItemClicked += new ToolStripItemClickedEventHandler(ScriptItem_Clicked);
AddToolStripItemToStrip(scriptsDatabaseToolStripMenuItem, scriptItems[a]);
//SystemMenuList.DropDownItems.Add(systemItems[a]);
}
SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Enabled");
SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Visible");
}
public void ScriptItem_Clicked(object sender, ToolStripItemClickedEventArgs e)
{ }
} }
} }

View File

@ -121,7 +121,6 @@
<Compile Include="TMD.cs" /> <Compile Include="TMD.cs" />
<Compile Include="U8.cs" /> <Compile Include="U8.cs" />
<Compile Include="WAD.cs" /> <Compile Include="WAD.cs" />
<Compile Include="WADPacker.cs" />
<Compile Include="WaterMarkTextBox.cs"> <Compile Include="WaterMarkTextBox.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>

View File

@ -1,225 +0,0 @@
///////////////////////////////////////////
// NUS Downloader: WADPacker.cs //
// $Rev:: $ //
// $Author:: $ //
// $Date:: $ //
///////////////////////////////////////////
///////////////////////////////////////
// Copyright (C) 2010
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
///////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace NUS_Downloader
{
/// <summary>
/// Class for handling WAD Packaging.
/// </summary>
class WADPacker
{
// WAD Component Variables
private byte[] Certsys;
public byte[] Certs { get { return Certsys;} set { Certsys = value; CertChainSize = Certsys.Length; } }
private byte[] tmd;
public byte[] TMD { get { return tmd; }
set
{
tmd = value;
TMDContentCount = ContentCount(TMD);
TMDSize = 484 + (TMDContentCount * 36);
} }
public byte[] Ticket;
private int TMDContentCount;
// WAD Contents
private byte[][] TMDContents;
public byte[][] Contents { get { return TMDContents; }
set {
TMDContents = value;
for (int a = 0; a < TMDContents.Length; a++)
{
DataSize += TMDContents[a].Length;
}
} }
// WAD Saving Variables
public string Directory;
public string FileName;
// TMD Informations
public string[] tmdnames;
public string[] tmdsizes;
// WAD Header Variables
private const int HeaderSize = 0x20;
private int CertChainSize;
private const int TicketSize = 0x2A4;
private int TMDSize;
private int DataSize;
private byte[] WADMagic = new byte[8] { 0x00, 0x00, 0x00, 0x20, 0x49, 0x73, 0x00, 0x00 };
private byte[] RESERVED_CONST = new byte[4] { 0x00, 0x00, 0x00, 0x00 };
private byte[] TIKSIZE_CONST = new byte[4] { 0x00, 0x00, 0x02, 0xA4 };
// Report Status back in EventHandler
public delegate void StatusChangedEventHandler(string status);
public event StatusChangedEventHandler StatusChanged;
/// <summary>
/// Pads byte[].
/// </summary>
/// <param name="src">The byte[] or binary to be padded.</param>
/// <param name="pad">How much to pad by.</param>
/// <returns>Padded byte[]</returns>
private long PadToMultipleOf(long src, int pad)
{
long len = (src + pad - 1) / pad * pad;
return len;
}
/// <summary>
/// Converts an integer into its equivilant byte array.
/// </summary>
/// <param name="theInt">The integer</param>
/// <param name="arrayLen">Length you desire the byte[] to be.</param>
/// <returns></returns>
private byte[] ConvertInttoByteArray(int theInt, int arrayLen)
{
byte[] resultArray = new byte[arrayLen];
for (int i = arrayLen - 1; i >= 0; i--)
{
resultArray[i] = (byte)((theInt >> (8 * i)) & 0xFF);
}
Array.Reverse(resultArray);
// Fix duplication, rewrite extra to 0x00;
if (arrayLen > 4)
{
for (int i = 0; i < (arrayLen - 4); i++)
resultArray[i] = 0x00;
}
return resultArray;
}
/// <summary>
/// Handles the size mismatch.
/// </summary>
/// <param name="contentsize">The contentsize.</param>
/// <param name="actualsize">The actualsize.</param>
void HandleMismatch(int contentsize, int actualsize)
{
if (contentsize != actualsize)
if ((contentsize - actualsize) > 16)
StatusChanged(String.Format(" (BAD Mismatch) (Dif: {0}", (contentsize - actualsize)));
//else
//statusbox.Text += " (Safe Mismatch)";
}
/// <summary>
/// Returns content count of TMD
/// </summary>
/// <param name="tmd">The TMD.</param>
/// <returns>int Count of Contents</returns>
private int ContentCount(byte[] tmd)
{
return (tmd[0x1DE] * 256) + tmd[0x1DF];
}
/// <summary>
/// Packs the WAD file, saves it to specified location.
/// </summary>
public void PackWAD()
{
if ((String.IsNullOrEmpty(Directory)) || (String.IsNullOrEmpty(FileName)))
{
StatusChanged("ERROR: No Directory/FileName provided!");
return;
}
FileStream wadfs = new FileStream(Path.Combine(Directory, FileName), FileMode.Create);
// Seek the beginning of the WAD...
wadfs.Seek(0, SeekOrigin.Begin);
// Write initial part of header (WADType)
wadfs.Write(WADMagic, 0, WADMagic.Length);
// Write CertChainLength
wadfs.Seek(0x08, SeekOrigin.Begin);
byte[] chainsize = ConvertInttoByteArray(CertChainSize, 4);
wadfs.Write(chainsize, 0, chainsize.Length);
// Write res
wadfs.Seek(0x0C, SeekOrigin.Begin);
wadfs.Write(RESERVED_CONST, 0, RESERVED_CONST.Length);
// Write ticketsize
wadfs.Seek(0x10, SeekOrigin.Begin);
wadfs.Write(TIKSIZE_CONST, 0, TIKSIZE_CONST.Length);
// Write tmdsize
wadfs.Seek(0x14, SeekOrigin.Begin);
byte[] tmdsize = ConvertInttoByteArray(TMDSize, 4);
wadfs.Write(tmdsize, 0, tmdsize.Length);
// Write data size
wadfs.Seek(0x18, SeekOrigin.Begin);
wadfs.Write(ConvertInttoByteArray(DataSize, 4), 0, 4);
StatusChanged(" - Header wrote (0x00)");
// Write cert[] to 0x40.
wadfs.Seek(0x40, SeekOrigin.Begin);
wadfs.Write(Certsys, 0, Certsys.Length);
StatusChanged(String.Format(" - Certs wrote (0x{0})", Convert.ToString(64, 16)));
// Pad to next 64 byte boundary.
wadfs.Seek(2624, SeekOrigin.Begin);
// Write ticket at this point...
wadfs.Write(Ticket, 0, TicketSize);
StatusChanged(String.Format(" - Ticket wrote (0x{0})", Convert.ToString((wadfs.Length - 0x2A4), 16)));
// Pad to next 64 byte boundary.
wadfs.Seek(PadToMultipleOf(wadfs.Length, 64), SeekOrigin.Begin);
// Write TMD at this point...
wadfs.Write(tmd, 0, TMDSize);
StatusChanged(String.Format(" - TMD wrote (0x{0})", Convert.ToString((wadfs.Length - TMDSize), 16)));
// Add the individual contents
for (int a = 0; a < TMDContentCount; a++)
{
// Pad to next 64 byte boundary...
wadfs.Seek(PadToMultipleOf(wadfs.Length, 64), SeekOrigin.Begin);
wadfs.Write(TMDContents[a], 0, Contents[a].Length);
StatusChanged(String.Format(" - {0} wrote (0x{1})", tmdnames[a], Convert.ToString((wadfs.Length - TMDContents[a].Length), 16)));
HandleMismatch(int.Parse(tmdsizes[a], System.Globalization.NumberStyles.HexNumber), TMDContents[a].Length);
}
// Close filesystem...
wadfs.Close();
// Finished.
StatusChanged("WAD Created: " + FileName);
}
}
}