Various Path.Combine, etc. additions. Must be tested.

This commit is contained in:
givememystuffplease 2010-07-04 17:18:50 +00:00
parent cc774c93d7
commit 1712c720e0
5 changed files with 182 additions and 370 deletions

View File

@ -65,25 +65,17 @@
this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.updateDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
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.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 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.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); 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.getCommonKeyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.commonKeykeybinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.commonKeykeybinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.koreanKeykkeybinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.koreanKeykkeybinToolStripMenuItem = 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.saveaswadbox = new System.Windows.Forms.CheckBox();
this.deletecontentsbox = new System.Windows.Forms.CheckBox(); this.deletecontentsbox = new System.Windows.Forms.CheckBox();
this.proxyBox = new System.Windows.Forms.GroupBox(); this.proxyBox = new System.Windows.Forms.GroupBox();
@ -100,13 +92,22 @@
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.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();
this.scriptsMainMenuEntry = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.databaseStrip.SuspendLayout(); this.databaseStrip.SuspendLayout();
this.extrasStrip.SuspendLayout(); this.extrasStrip.SuspendLayout();
this.proxyBox.SuspendLayout(); this.proxyBox.SuspendLayout();
this.ProxyVerifyBox.SuspendLayout(); this.ProxyVerifyBox.SuspendLayout();
this.scriptsStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// Extrasbtn // Extrasbtn
@ -242,10 +243,12 @@
this.WiiWareMenuList, this.WiiWareMenuList,
this.toolStripSeparator1, this.toolStripSeparator1,
this.RegionCodesList, this.RegionCodesList,
this.MassUpdateList}); this.MassUpdateList,
this.toolStripSeparator4,
this.updateDatabaseToolStripMenuItem});
this.databaseStrip.Name = "databaseStrip"; this.databaseStrip.Name = "databaseStrip";
this.databaseStrip.ShowItemToolTips = false; this.databaseStrip.ShowItemToolTips = false;
this.databaseStrip.Size = new System.Drawing.Size(167, 142); this.databaseStrip.Size = new System.Drawing.Size(167, 170);
// //
// SystemMenuList // SystemMenuList
// //
@ -397,6 +400,19 @@
this.KoreaMassUpdate.Size = new System.Drawing.Size(104, 22); this.KoreaMassUpdate.Size = new System.Drawing.Size(104, 22);
this.KoreaMassUpdate.Text = "Korea"; this.KoreaMassUpdate.Text = "Korea";
// //
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(163, 6);
//
// updateDatabaseToolStripMenuItem
//
this.updateDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.database_save;
this.updateDatabaseToolStripMenuItem.Name = "updateDatabaseToolStripMenuItem";
this.updateDatabaseToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.updateDatabaseToolStripMenuItem.Text = "Update Database";
this.updateDatabaseToolStripMenuItem.Click += new System.EventHandler(this.updateDatabaseToolStripMenuItem_Click);
//
// button3 // button3
// //
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
@ -414,98 +430,37 @@
this.extrasStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.extrasStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.loadInfoFromTMDToolStripMenuItem, this.loadInfoFromTMDToolStripMenuItem,
this.toolStripSeparator3, this.toolStripSeparator3,
this.emulateUpdate,
this.toolStripSeparator4,
this.proxySettingsToolStripMenuItem, this.proxySettingsToolStripMenuItem,
this.toolStripSeparator6, this.toolStripSeparator6,
this.loadNUSScriptToolStripMenuItem, this.getCommonKeyMenuItem});
this.toolStripSeparator7,
this.getCommonKeyMenuItem,
this.toolStripSeparator2,
this.updateDatabaseToolStripMenuItem});
this.extrasStrip.Name = "extrasStrip"; this.extrasStrip.Name = "extrasStrip";
this.extrasStrip.Size = new System.Drawing.Size(220, 166); this.extrasStrip.Size = new System.Drawing.Size(183, 82);
// //
// loadInfoFromTMDToolStripMenuItem // loadInfoFromTMDToolStripMenuItem
// //
this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify; this.loadInfoFromTMDToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.page_white_magnify;
this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem"; this.loadInfoFromTMDToolStripMenuItem.Name = "loadInfoFromTMDToolStripMenuItem";
this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(219, 22); this.loadInfoFromTMDToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD"; this.loadInfoFromTMDToolStripMenuItem.Text = "Load Info from TMD";
this.loadInfoFromTMDToolStripMenuItem.Click += new System.EventHandler(this.loadInfoFromTMDToolStripMenuItem_Click); 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(216, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(179, 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";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(216, 6);
// //
// proxySettingsToolStripMenuItem // proxySettingsToolStripMenuItem
// //
this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link; this.proxySettingsToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.server_link;
this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem"; this.proxySettingsToolStripMenuItem.Name = "proxySettingsToolStripMenuItem";
this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(219, 22); this.proxySettingsToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.proxySettingsToolStripMenuItem.Text = "Proxy Settings"; this.proxySettingsToolStripMenuItem.Text = "Proxy Settings";
this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click); 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(216, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(179, 6);
//
// 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);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(216, 6);
// //
// getCommonKeyMenuItem // getCommonKeyMenuItem
// //
@ -514,7 +469,7 @@
this.koreanKeykkeybinToolStripMenuItem}); this.koreanKeykkeybinToolStripMenuItem});
this.getCommonKeyMenuItem.Image = global::NUS_Downloader.Properties.Resources.key; this.getCommonKeyMenuItem.Image = global::NUS_Downloader.Properties.Resources.key;
this.getCommonKeyMenuItem.Name = "getCommonKeyMenuItem"; this.getCommonKeyMenuItem.Name = "getCommonKeyMenuItem";
this.getCommonKeyMenuItem.Size = new System.Drawing.Size(219, 22); this.getCommonKeyMenuItem.Size = new System.Drawing.Size(182, 22);
this.getCommonKeyMenuItem.Text = "Retrieve Key"; this.getCommonKeyMenuItem.Text = "Retrieve Key";
// //
// commonKeykeybinToolStripMenuItem // commonKeykeybinToolStripMenuItem
@ -531,19 +486,6 @@
this.koreanKeykkeybinToolStripMenuItem.Text = "Korean Key (kkey.bin)"; this.koreanKeykkeybinToolStripMenuItem.Text = "Korean Key (kkey.bin)";
this.koreanKeykkeybinToolStripMenuItem.Click += new System.EventHandler(this.koreanKeykkeybinToolStripMenuItem_Click); this.koreanKeykkeybinToolStripMenuItem.Click += new System.EventHandler(this.koreanKeykkeybinToolStripMenuItem_Click);
// //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(216, 6);
//
// updateDatabaseToolStripMenuItem
//
this.updateDatabaseToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.database_save;
this.updateDatabaseToolStripMenuItem.Name = "updateDatabaseToolStripMenuItem";
this.updateDatabaseToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.updateDatabaseToolStripMenuItem.Text = "Update Database";
this.updateDatabaseToolStripMenuItem.Click += new System.EventHandler(this.updateDatabaseToolStripMenuItem_Click);
//
// saveaswadbox // saveaswadbox
// //
this.saveaswadbox.AutoSize = true; this.saveaswadbox.AutoSize = true;
@ -709,9 +651,59 @@
// //
// scriptsStrip // scriptsStrip
// //
this.scriptsStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.scriptsMainMenuEntry,
this.loadNUSScriptToolStripMenuItem,
this.toolStripSeparator2,
this.emulateUpdate});
this.scriptsStrip.Name = "scriptsStrip"; this.scriptsStrip.Name = "scriptsStrip";
this.scriptsStrip.ShowItemToolTips = false; this.scriptsStrip.ShowItemToolTips = false;
this.scriptsStrip.Size = new System.Drawing.Size(61, 4); this.scriptsStrip.Size = new System.Drawing.Size(220, 76);
//
// 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(152, 22);
this.uSANTSCToolStripMenuItem.Text = "USA";
//
// europePALToolStripMenuItem
//
this.europePALToolStripMenuItem.Name = "europePALToolStripMenuItem";
this.europePALToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.europePALToolStripMenuItem.Text = "EUROPE";
//
// japanNTSCJToolStripMenuItem
//
this.japanNTSCJToolStripMenuItem.Name = "japanNTSCJToolStripMenuItem";
this.japanNTSCJToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.japanNTSCJToolStripMenuItem.Text = "JAPAN";
//
// koreaToolStripMenuItem
//
this.koreaToolStripMenuItem.Name = "koreaToolStripMenuItem";
this.koreaToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.koreaToolStripMenuItem.Text = "KOREA";
// //
// titleversion // titleversion
// //
@ -747,6 +739,18 @@
this.dlprogress.Size = new System.Drawing.Size(250, 15); this.dlprogress.Size = new System.Drawing.Size(250, 15);
this.dlprogress.TabIndex = 47; this.dlprogress.TabIndex = 47;
// //
// scriptsMainMenuEntry
//
this.scriptsMainMenuEntry.Enabled = false;
this.scriptsMainMenuEntry.Name = "scriptsMainMenuEntry";
this.scriptsMainMenuEntry.Size = new System.Drawing.Size(219, 22);
this.scriptsMainMenuEntry.Text = "Scripts\\";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(216, 6);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -787,6 +791,7 @@
this.proxyBox.PerformLayout(); this.proxyBox.PerformLayout();
this.ProxyVerifyBox.ResumeLayout(false); this.ProxyVerifyBox.ResumeLayout(false);
this.ProxyVerifyBox.PerformLayout(); this.ProxyVerifyBox.PerformLayout();
this.scriptsStrip.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -828,14 +833,8 @@
private System.Windows.Forms.ContextMenuStrip extrasStrip; private System.Windows.Forms.ContextMenuStrip extrasStrip;
private System.Windows.Forms.ToolStripMenuItem loadInfoFromTMDToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadInfoFromTMDToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem emulateUpdate;
private System.Windows.Forms.ToolStripMenuItem uSANTSCToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem europePALToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem japanNTSCJToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem koreaToolStripMenuItem;
private System.Windows.Forms.CheckBox saveaswadbox; private System.Windows.Forms.CheckBox saveaswadbox;
private System.Windows.Forms.CheckBox deletecontentsbox; private System.Windows.Forms.CheckBox deletecontentsbox;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem proxySettingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem proxySettingsToolStripMenuItem;
private System.Windows.Forms.GroupBox proxyBox; private System.Windows.Forms.GroupBox proxyBox;
private System.Windows.Forms.TextBox ProxyUser; private System.Windows.Forms.TextBox ProxyUser;
@ -850,11 +849,7 @@
private System.Windows.Forms.TextBox ProxyPwdBox; private System.Windows.Forms.TextBox ProxyPwdBox;
private wyDay.Controls.Windows7ProgressBar dlprogress; private wyDay.Controls.Windows7ProgressBar dlprogress;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripMenuItem loadNUSScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
private System.Windows.Forms.ToolStripMenuItem getCommonKeyMenuItem; private System.Windows.Forms.ToolStripMenuItem getCommonKeyMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem updateDatabaseToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip C64MenuListDrop; private System.Windows.Forms.ContextMenuStrip C64MenuListDrop;
private System.Windows.Forms.ToolStripMenuItem MassUpdateList; private System.Windows.Forms.ToolStripMenuItem MassUpdateList;
private System.Windows.Forms.ToolStripMenuItem PALMassUpdate; private System.Windows.Forms.ToolStripMenuItem PALMassUpdate;
@ -867,6 +862,16 @@
private wmgCMS.WaterMarkTextBox titleversion; private wmgCMS.WaterMarkTextBox titleversion;
private System.Windows.Forms.Button scriptsbutton; private System.Windows.Forms.Button scriptsbutton;
private System.Windows.Forms.ContextMenuStrip scriptsStrip; private System.Windows.Forms.ContextMenuStrip scriptsStrip;
private System.Windows.Forms.ToolStripMenuItem loadNUSScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem emulateUpdate;
private System.Windows.Forms.ToolStripMenuItem uSANTSCToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem europePALToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem japanNTSCJToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem koreaToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem updateDatabaseToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem scriptsMainMenuEntry;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
} }
} }

View File

@ -9,7 +9,6 @@ using System.Text.RegularExpressions;
using System.ComponentModel; using System.ComponentModel;
using System.Threading; using System.Threading;
using System.Text; using System.Text;
using wyDay.Controls;
using System.Diagnostics; using System.Diagnostics;
@ -20,6 +19,8 @@ namespace NUS_Downloader
private const string WII_NUS_URL = "http://nus.cdn.shop.wii.com/ccs/download/"; private const string WII_NUS_URL = "http://nus.cdn.shop.wii.com/ccs/download/";
private const string DSI_NUS_URL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/"; private const string DSI_NUS_URL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/";
private readonly string CURRENT_DIR = Directory.GetCurrentDirectory();
// TODO: Always remember to change version! // TODO: Always remember to change version!
private string version = "v1.5a Beta"; private string version = "v1.5a Beta";
private WebClient generalWC = new WebClient(); private WebClient generalWC = new WebClient();
@ -158,93 +159,11 @@ namespace NUS_Downloader
scripter.DoWork += new DoWorkEventHandler(RunScript); scripter.DoWork += new DoWorkEventHandler(RunScript);
scripter.RunWorkerAsync(); scripter.RunWorkerAsync();
} }
/* CLI MODE DEPRECATED...
// Vars
bool startnow = false;
bool endafter = false;
// Fix'd
localuse.Checked = false;
// Switch through arguments
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-t":
if (args[i + 1].Length == 16)
titleidbox.Text = args[i + 1];
else
{
WriteStatus("Title ID: Your Doing It Wrong (c)");
WriteStatus("ex: -t 0000000100000002");
}
break;
case "-v":
titleversion.Text = args[i + 1];
break;
case "-s":
startnow = true;
break;
case "-close":
endafter = true;
break;
case "-d":
decryptbox.Checked = true;
break;
case "-ticket":
ignoreticket.Checked = true;
break;
case "-local":
localuse.Checked = true;
break;
case "-p":
packbox.Checked = true;
wadnamebox.Text = args[i + 1];
break;
case "-dsi":
radioButton2.Checked = true;
break;
default:
break;
}
}
// Start doing stuff...
if ((startnow) && (titleidbox.Text.Length != 0))
{
// Prevent mass deletion
if ((titleidbox.Text == "") && (titleversion.Text == ""))
{
WriteStatus("Please enter SOME info...");
return;
}
else
{
if (!statusbox.Lines[0].StartsWith(" ---"))
statusbox.Text = " --- " + titleidbox.Text + " ---";
}
// Running Downloads in background so no form freezing
NUSDownloader.RunWorkerAsync();
}
// Close if specified
while (NUSDownloader.IsBusy)
{
Thread.Sleep(1000);
}
if ((NUSDownloader.IsBusy == false) && (endafter == true))
{
Application.Exit();
} */
} }
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
this.Text = "NUSD - " + version + " - WB3000"; this.Text = String.Format("NUSD - {0} - WB3000", version); ;
this.Size = this.MinimumSize; this.Size = this.MinimumSize;
consoleCBox.SelectedIndex = 0; consoleCBox.SelectedIndex = 0;
} }
@ -255,14 +174,8 @@ namespace NUS_Downloader
/// <returns></returns> /// <returns></returns>
private void BootChecks() private void BootChecks()
{ {
// Directory stuff
string currentdir = Directory.GetCurrentDirectory();
//if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
//currentdir += Path.DirectorySeparatorChar.ToString();
// Check for Wii common key bin file... // Check for Wii common key bin file...
if (File.Exists(Path.Combine(currentdir, "key.bin")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "key.bin")) == false)
{ {
WriteStatus("Common Key (key.bin) missing! Decryption disabled!"); WriteStatus("Common Key (key.bin) missing! Decryption disabled!");
WriteStatus(" - Try: Extras -> Retrieve Key -> Common Key"); WriteStatus(" - Try: Extras -> Retrieve Key -> Common Key");
@ -282,34 +195,30 @@ namespace NUS_Downloader
else else
{ {
WriteStatus(" - Converting your key.bin file to the correct format..."); WriteStatus(" - Converting your key.bin file to the correct format...");
// Directory stuff TextReader ckreader = new StreamReader(Path.Combine(CURRENT_DIR, "key.bin"));
//string keydir = Directory.GetCurrentDirectory();
//if (!(keydir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(keydir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
//keydir += Path.DirectorySeparatorChar.ToString();
TextReader ckreader = new StreamReader(Path.Combine(currentdir, "key.bin"));
String ckashex = ckreader.ReadLine(); String ckashex = ckreader.ReadLine();
ckreader.Close(); ckreader.Close();
File.Delete(Path.Combine(currentdir, "key.bin")); File.Delete(Path.Combine(CURRENT_DIR, "key.bin"));
WriteCommonKey("key.bin", HexStringToByteArray(ckashex)); WriteCommonKey("key.bin", HexStringToByteArray(ckashex));
} }
} }
} }
// Check for Wii KOR common key bin file... // Check for Wii KOR common key bin file...
if (File.Exists(Path.Combine(currentdir, "kkey.bin")) == true) if (File.Exists(Path.Combine(CURRENT_DIR, "kkey.bin")) == true)
{ {
WriteStatus("Korean Common Key detected."); WriteStatus("Korean Common Key detected.");
} }
// Check for DSi common key bin file... // Check for DSi common key bin file...
if (File.Exists(Path.Combine(currentdir, "dsikey.bin")) == true) if (File.Exists(Path.Combine(CURRENT_DIR, "dsikey.bin")) == true)
{ {
WriteStatus("DSi Common Key detected."); WriteStatus("DSi Common Key detected.");
dsidecrypt = true; dsidecrypt = true;
} }
// Check for database.xml // Check for database.xml
if (File.Exists(Path.Combine(currentdir, "database.xml")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "database.xml")) == false)
{ {
WriteStatus("Database.xml not found. Title database not usable!"); WriteStatus("Database.xml not found. Title database not usable!");
databaseButton.Visible = false; databaseButton.Visible = false;
@ -329,10 +238,10 @@ namespace NUS_Downloader
} }
// Check for Proxy Settings file... // Check for Proxy Settings file...
if (File.Exists(Path.Combine(currentdir, "proxy.txt")) == true) if (File.Exists(Path.Combine(CURRENT_DIR, "proxy.txt")) == true)
{ {
WriteStatus("Proxy settings detected."); WriteStatus("Proxy settings detected.");
string[] proxy_file = File.ReadAllLines(Path.Combine(currentdir, "proxy.txt")); string[] proxy_file = File.ReadAllLines(Path.Combine(CURRENT_DIR, "proxy.txt"));
proxy_url = proxy_file[0]; proxy_url = proxy_file[0];
if (proxy_file.Length > 1) if (proxy_file.Length > 1)
{ {
@ -880,13 +789,6 @@ namespace NUS_Downloader
SetEnableforDownload(false); SetEnableforDownload(false);
downloadstartbtn.Text = "Starting NUS Download!"; downloadstartbtn.Text = "Starting NUS Download!";
// Current directory...
string currentdir = Directory.GetCurrentDirectory();
if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) ||
!(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
currentdir += Path.DirectorySeparatorChar.ToString();
// Prevent crossthread issues // Prevent crossthread issues
string titleid = titleidbox.Text; string titleid = titleidbox.Text;
@ -905,9 +807,9 @@ namespace NUS_Downloader
// Get placement directory early... // Get placement directory early...
string titledirectory; string titledirectory;
if (titleversion.Text == "") if (titleversion.Text == "")
titledirectory = currentdir + titleid + Path.DirectorySeparatorChar.ToString(); titledirectory = Path.Combine(CURRENT_DIR, titleid);
else else
titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString(); titledirectory = Path.Combine(CURRENT_DIR, (titleid + "v" + titleversion.Text));
downloadstartbtn.Text = "Prerequisites: (0/2)"; downloadstartbtn.Text = "Prerequisites: (0/2)";
@ -975,7 +877,7 @@ namespace NUS_Downloader
if (ticket_exists) if (ticket_exists)
{ {
// Create ticket file holder // Create ticket file holder
cetkbuf = FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + @"cetk"); cetkbuf = FileLocationToByteArray(Path.Combine(titledirectory, "cetk"));
// Obtain TitleKey // Obtain TitleKey
titlekey = new byte[16]; titlekey = new byte[16];
@ -1004,15 +906,15 @@ namespace NUS_Downloader
if (cetkbuf[0x01F1] == 0x01) if (cetkbuf[0x01F1] == 0x01)
{ {
WriteStatus("Key Type: Korean"); WriteStatus("Key Type: Korean");
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"kkey.bin"); keyBytes = LoadCommonKey("kkey.bin");
} }
else else
{ {
WriteStatus("Key Type: Standard"); WriteStatus("Key Type: Standard");
if (wiimode) if (wiimode)
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin"); keyBytes = LoadCommonKey("key.bin");
else else
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"dsikey.bin"); keyBytes = LoadCommonKey("dsikey.bin");
} }
initCrypt(iv, keyBytes); initCrypt(iv, keyBytes);
@ -1023,7 +925,7 @@ namespace NUS_Downloader
} }
// Read the tmd as a stream... // Read the tmd as a stream...
byte[] tmd = FileLocationToByteArray(titledirectory + tmdfull); byte[] tmd = FileLocationToByteArray(Path.Combine(titledirectory, tmdfull));
if (ticket_exists == true) if (ticket_exists == true)
{ {
@ -1053,10 +955,10 @@ namespace NUS_Downloader
WriteStatus("Requires: IOS" + sysversion); WriteStatus("Requires: IOS" + sysversion);
// Renaming would be ideal, but gives too many permission errors... // Renaming would be ideal, but gives too many permission errors...
/*if ((currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString()) != titledirectory) /*if ((CURRENT_DIR + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString()) != titledirectory)
{ {
Directory.Move(titledirectory, currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString()); Directory.Move(titledirectory, CURRENT_DIR + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString());
titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString(); titledirectory = CURRENT_DIR + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString();
} */ } */
// Read Content #... // Read Content #...
@ -1089,7 +991,7 @@ namespace NUS_Downloader
try try
{ {
// If it exists we leave it... // If it exists we leave it...
if ((localuse.Checked) && (File.Exists(titledirectory + tmdcontents[i]))) if ((localuse.Checked) && (File.Exists(Path.Combine(titledirectory, tmdcontents[i]))))
{ {
WriteStatus("Leaving local " + tmdcontents[i] + "."); WriteStatus("Leaving local " + tmdcontents[i] + ".");
} }
@ -1112,8 +1014,7 @@ namespace NUS_Downloader
} }
// Progress reporting advances... // Progress reporting advances...
downloadstartbtn.Text = "Content: (" + (i + 1) + Path.AltDirectorySeparatorChar.ToString() + downloadstartbtn.Text = String.Format("Content: ({0} / {1})", (i + 1), contentstrnum);
contentstrnum + ")";
currentcontentlocation += int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber); currentcontentlocation += int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber);
// Decrypt stuff... // Decrypt stuff...
@ -1121,7 +1022,7 @@ namespace NUS_Downloader
{ {
// Create content file holder // Create content file holder
byte[] contbuf = byte[] contbuf =
FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + tmdcontents[i]); FileLocationToByteArray(Path.Combine(titledirectory, tmdcontents[i]));
// IV (00+IDX+more000) // IV (00+IDX+more000)
byte[] iv = new byte[16]; byte[] iv = new byte[16];
@ -1142,7 +1043,7 @@ namespace NUS_Downloader
FileStream decfs = FileStream decfs =
new FileStream( new FileStream(
titledirectory + Path.DirectorySeparatorChar.ToString() + tmdcontents[i] + ".app", Path.Combine(titledirectory, (tmdcontents[i] + ".app")),
FileMode.Create); FileMode.Create);
decfs.Write(Decrypt(contbuf), 0, int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber)); decfs.Write(Decrypt(contbuf), 0, int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber));
decfs.Close(); decfs.Close();
@ -1194,19 +1095,12 @@ namespace NUS_Downloader
/// </summary> /// </summary>
private void CreateTitleDirectory() private void CreateTitleDirectory()
{ {
// Creates the directory for the downloaded title...
string currentdir = Directory.GetCurrentDirectory();
if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
currentdir += Path.DirectorySeparatorChar.ToString();
// Get placement directory early... // Get placement directory early...
string titledirectory; string titledirectory;
if (titleversion.Text == "") if (titleversion.Text == "")
titledirectory = Path.Combine(currentdir, titleidbox.Text + Path.DirectorySeparatorChar.ToString()); titledirectory = Path.Combine(CURRENT_DIR, titleidbox.Text);
else else
titledirectory = Path.Combine(currentdir, titledirectory = Path.Combine(CURRENT_DIR, (titleidbox.Text + "v" + titleversion.Text));
titleidbox.Text + "v" + titleversion.Text +
Path.DirectorySeparatorChar.ToString());
// Keep local directory if present and checked out... // Keep local directory if present and checked out...
if ((localuse.Checked) && (Directory.Exists(titledirectory))) if ((localuse.Checked) && (Directory.Exists(titledirectory)))
@ -1227,23 +1121,15 @@ namespace NUS_Downloader
/// </summary> /// </summary>
private void DeleteTitleDirectory() private void DeleteTitleDirectory()
{ {
string currentdir = Directory.GetCurrentDirectory();
if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
currentdir += Path.DirectorySeparatorChar.ToString();
// Get placement directory early... // Get placement directory early...
string titledirectory; string titledirectory;
if (titleversion.Text == "") if (titleversion.Text == "")
titledirectory = Path.Combine(currentdir, titleidbox.Text + Path.DirectorySeparatorChar.ToString()); titledirectory = Path.Combine(CURRENT_DIR, titleidbox.Text);
else else
titledirectory = Path.Combine(currentdir, titledirectory = Path.Combine(CURRENT_DIR, (titleidbox.Text + "v" + titleversion.Text));
titleidbox.Text + "v" + titleversion.Text +
Path.DirectorySeparatorChar.ToString());
if (Directory.Exists(titledirectory)) if (Directory.Exists(titledirectory))
Directory.Delete(titledirectory, true); Directory.Delete(titledirectory, true);
//Directory.CreateDirectory(currentdir + titleidbox.Text);
} }
/// <summary> /// <summary>
@ -1260,9 +1146,9 @@ namespace NUS_Downloader
// Create NUS URL... // Create NUS URL...
string nusfileurl; string nusfileurl;
if (iswiititle) if (iswiititle)
nusfileurl = WII_NUS_URL + titleid + Path.AltDirectorySeparatorChar.ToString() + filename; nusfileurl = CombinePaths(WII_NUS_URL, titleid, filename);
else else
nusfileurl = DSI_NUS_URL + titleid + Path.AltDirectorySeparatorChar.ToString() + filename; nusfileurl = CombinePaths(DSI_NUS_URL, titleid, filename);
WriteStatus("Grabbing " + filename + "..."); WriteStatus("Grabbing " + filename + "...");
@ -1271,7 +1157,7 @@ namespace NUS_Downloader
statusbox.Text += " (" + Convert.ToString(sizeinbytes) + " bytes)"; statusbox.Text += " (" + Convert.ToString(sizeinbytes) + " bytes)";
// Download NUS file... // Download NUS file...
generalWC.DownloadFile(nusfileurl, placementdir + filename); generalWC.DownloadFile(nusfileurl, Path.Combine(placementdir, filename));
} }
private void StatusChange(string status) private void StatusChange(string status)
@ -1289,12 +1175,6 @@ namespace NUS_Downloader
{ {
WriteStatus("Beginning WAD Pack..."); WriteStatus("Beginning WAD Pack...");
// Obtain Current Directory
string currentdir = Directory.GetCurrentDirectory();
if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) ||
!(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
currentdir += Path.DirectorySeparatorChar.ToString();
// Create instance of WAD Packing class // Create instance of WAD Packing class
WADPacker packer = new WADPacker(); WADPacker packer = new WADPacker();
packer.StatusChanged += WriteStatus; packer.StatusChanged += WriteStatus;
@ -1320,8 +1200,8 @@ namespace NUS_Downloader
packer.Certs = certsbuf; packer.Certs = certsbuf;
// Read TMD/TIK into Packer. // Read TMD/TIK into Packer.
packer.Ticket = FileLocationToByteArray(totaldirectory + Path.DirectorySeparatorChar.ToString() + @"cetk"); packer.Ticket = FileLocationToByteArray(Path.Combine(totaldirectory, "cetk"));
packer.TMD = FileLocationToByteArray(totaldirectory + Path.DirectorySeparatorChar.ToString() + tmdfilename); packer.TMD = FileLocationToByteArray(Path.Combine(totaldirectory, tmdfilename));
// Get the TMD variables in here instead... // Get the TMD variables in here instead...
int contentcount = ContentCount(packer.TMD); int contentcount = ContentCount(packer.TMD);
@ -1340,8 +1220,7 @@ namespace NUS_Downloader
} }
else else
{ {
string wad_filename = totaldirectory + Path.DirectorySeparatorChar.ToString() + string wad_filename = Path.Combine(totaldirectory, RemoveIllegalCharacters(wadnamebox.Text));
RemoveIllegalCharacters(wadnamebox.Text);
packer.Directory = totaldirectory; packer.Directory = totaldirectory;
packer.FileName = System.IO.Path.GetFileName(wad_filename); packer.FileName = System.IO.Path.GetFileName(wad_filename);
} }
@ -1350,7 +1229,7 @@ namespace NUS_Downloader
byte[][] contents_array = new byte[contentcount][]; byte[][] contents_array = new byte[contentcount][];
for (int a = 0; a < contentcount; a++) for (int a = 0; a < contentcount; a++)
{ {
contents_array[a] = FileLocationToByteArray(totaldirectory + contentnames[a]); contents_array[a] = FileLocationToByteArray(Path.Combine(totaldirectory, contentnames[a]));
} }
packer.Contents = contents_array; packer.Contents = contents_array;
@ -1361,10 +1240,10 @@ namespace NUS_Downloader
if (deletecontentsbox.Checked) if (deletecontentsbox.Checked)
{ {
WriteStatus("Deleting contents..."); WriteStatus("Deleting contents...");
File.Delete(totaldirectory + Path.DirectorySeparatorChar.ToString() + tmdfilename); File.Delete(Path.Combine(totaldirectory, tmdfilename));
File.Delete(totaldirectory + Path.DirectorySeparatorChar.ToString() + @"cetk"); File.Delete(Path.Combine(totaldirectory, "cetk"));
for (int a = 0; a < contentnames.Length; a++) for (int a = 0; a < contentnames.Length; a++)
File.Delete(totaldirectory + Path.DirectorySeparatorChar.ToString() + contentnames[a]); File.Delete(Path.Combine(totaldirectory, contentnames[a]));
WriteStatus(" - Contents have been deleted."); WriteStatus(" - Contents have been deleted.");
string[] leftovers = Directory.GetFiles(totaldirectory); string[] leftovers = Directory.GetFiles(totaldirectory);
if (leftovers.Length <= 0) if (leftovers.Length <= 0)
@ -1376,48 +1255,6 @@ namespace NUS_Downloader
} }
} }
/*
/// <summary>
/// Returns next 0x40 padded length.
/// </summary>
/// <param name="currentlength">The currentlength.</param>
/// <returns></returns>
private long ByteBoundary(int currentlength)
{
// Gets the next 0x40 offset.
long thelength = currentlength - 1;
long remainder = 1;
while (remainder != 0)
{
thelength += 1;
remainder = thelength%0x40;
}
//WriteStatus("Initial Size: " + currentlength);
//WriteStatus("0x40 Size: " + thelength);
return (long) thelength;
}
/// <summary>
/// Int -> Byte[] (OLD)
/// </summary>
/// <param name="inte">The int.</param>
/// <param name="arraysize">The array length.</param>
/// <returns></returns>
private byte[] InttoByteArray(int inte, int arraysize)
{
// Take integer and make into byte array
byte[] b = new byte[arraysize];
b = BitConverter.GetBytes(inte);
if (BitConverter.IsLittleEndian)
Array.Reverse(b);
return b;
}*/
private void consoleCBox_SelectedIndexChanged(object sender, EventArgs e) private void consoleCBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (consoleCBox.SelectedIndex == 0) if (consoleCBox.SelectedIndex == 0)
@ -1453,25 +1290,23 @@ namespace NUS_Downloader
WriteStatus("This application created by WB3000"); WriteStatus("This application created by WB3000");
WriteStatus("Various sections contributed by lukegb"); WriteStatus("Various sections contributed by lukegb");
WriteStatus(""); WriteStatus("");
string currentdir = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(currentdir, "key.bin")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "key.bin")) == false)
WriteStatus("Wii Decryption: Need (key.bin)"); WriteStatus("Wii Decryption: Need (key.bin)");
else else
WriteStatus("Wii Decryption: OK"); WriteStatus("Wii Decryption: OK");
if (File.Exists(Path.Combine(currentdir, "kkey.bin")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "kkey.bin")) == false)
WriteStatus("Wii Korea Decryption: Need (kkey.bin)"); WriteStatus("Wii Korea Decryption: Need (kkey.bin)");
else else
WriteStatus("Wii Korea Decryption: OK"); WriteStatus("Wii Korea Decryption: OK");
if (File.Exists(Path.Combine(currentdir, "dsikey.bin")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "dsikey.bin")) == false)
WriteStatus("DSi Decryption: Need (dsikey.bin)"); WriteStatus("DSi Decryption: Need (dsikey.bin)");
else else
WriteStatus("DSi Decryption: OK"); WriteStatus("DSi Decryption: OK");
if (File.Exists(Path.Combine(currentdir, "database.xml")) == false) if (File.Exists(Path.Combine(CURRENT_DIR, "database.xml")) == false)
WriteStatus("Database: Need (database.xml)"); WriteStatus("Database: Need (database.xml)");
else else
WriteStatus("Database: OK"); WriteStatus("Database: OK");
@ -1621,13 +1456,10 @@ namespace NUS_Downloader
/// <returns></returns> /// <returns></returns>
public byte[] LoadCommonKey(string keyfile) public byte[] LoadCommonKey(string keyfile)
{ {
// Directory stuff if (File.Exists(Path.Combine(CURRENT_DIR, keyfile)) == true)
string currentdir = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(currentdir, keyfile)) == true)
{ {
// Read common key byte[] // Read common key byte[]
return FileLocationToByteArray(Path.Combine(currentdir, keyfile)); return FileLocationToByteArray(Path.Combine(CURRENT_DIR, keyfile));
} }
else else
return null; return null;
@ -1641,16 +1473,13 @@ namespace NUS_Downloader
/// <returns></returns> /// <returns></returns>
public bool WriteCommonKey(string keyfile, byte[] commonkey) public bool WriteCommonKey(string keyfile, byte[] commonkey)
{ {
// Directory stuff if (File.Exists(Path.Combine(CURRENT_DIR, keyfile)) == true)
string currentdir = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(currentdir, keyfile)) == true)
{ {
WriteStatus(String.Format("Overwriting old {0}...", keyfile)); WriteStatus(String.Format("Overwriting old {0}...", keyfile));
} }
try try
{ {
FileStream fs = File.OpenWrite(Path.Combine(currentdir, keyfile)); FileStream fs = File.OpenWrite(Path.Combine(CURRENT_DIR, keyfile));
fs.Write(commonkey, 0, commonkey.Length); fs.Write(commonkey, 0, commonkey.Length);
fs.Close(); fs.Close();
WriteStatus(String.Format("{0} written - Reloading...", keyfile)); WriteStatus(String.Format("{0} written - Reloading...", keyfile));
@ -1698,8 +1527,7 @@ namespace NUS_Downloader
private void FillDatabaseStrip(BackgroundWorker worker) private void FillDatabaseStrip(BackgroundWorker worker)
{ {
// Load database.xml into memorystream to perhaps reduce disk reads? // Load database.xml into memorystream to perhaps reduce disk reads?
string currentdir = Directory.GetCurrentDirectory(); string databasestr = File.ReadAllText(Path.Combine(CURRENT_DIR, "database.xml"));
string databasestr = File.ReadAllText(Path.Combine(currentdir, "database.xml"));
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] databasebytes = encoding.GetBytes(databasestr); byte[] databasebytes = encoding.GetBytes(databasestr);
@ -2711,7 +2539,7 @@ namespace NUS_Downloader
statusbox.Text = ""; statusbox.Text = "";
WriteStatus("Starting Wii System Update..."); WriteStatus("Starting Wii System Update...");
extrasStrip.Close(); scriptsStrip.Close();
string deviceID = "4362227770"; string deviceID = "4362227770";
string messageID = "13198105123219138"; string messageID = "13198105123219138";
@ -2790,17 +2618,14 @@ namespace NUS_Downloader
WriteStatus(" - Outputting results to NUS script..."); WriteStatus(" - Outputting results to NUS script...");
// Current directory... if (!(Directory.Exists(Path.Combine(CURRENT_DIR, "scripts"))))
string currentdir = Directory.GetCurrentDirectory();
if (!(Directory.Exists(Path.Combine(currentdir, "scripts"))))
{ {
Directory.CreateDirectory(Path.Combine(currentdir, "scripts")); Directory.CreateDirectory(Path.Combine(CURRENT_DIR, "scripts"));
WriteStatus(" - Created 'scripts\' directory."); WriteStatus(" - Created 'scripts\' directory.");
} }
string time = RemoveIllegalCharacters(DateTime.Now.ToShortTimeString()); string time = RemoveIllegalCharacters(DateTime.Now.ToShortTimeString());
File.WriteAllText( File.WriteAllText(
String.Format(Path.Combine(currentdir, "scripts\\{0}_Update_{1}_{2}_{3} {4}.nus"), RegionID, String.Format(Path.Combine(CURRENT_DIR, "scripts\\{0}_Update_{1}_{2}_{3} {4}.nus"), RegionID,
DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year, time), script_text); DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year, time), script_text);
WriteStatus(" - Script written!"); WriteStatus(" - Script written!");
WriteStatus(" - Run this script if you feel like downloading the update!"); WriteStatus(" - Run this script if you feel like downloading the update!");
@ -2974,13 +2799,10 @@ namespace NUS_Downloader
private void SaveProxyBtn_Click(object sender, EventArgs e) private void SaveProxyBtn_Click(object sender, EventArgs e)
{ {
// Current directory...
string currentdir = Directory.GetCurrentDirectory();
if ((String.IsNullOrEmpty(ProxyURL.Text)) && (String.IsNullOrEmpty(ProxyUser.Text)) && if ((String.IsNullOrEmpty(ProxyURL.Text)) && (String.IsNullOrEmpty(ProxyUser.Text)) &&
((File.Exists(Path.Combine(currentdir, "proxy.txt"))))) ((File.Exists(Path.Combine(CURRENT_DIR, "proxy.txt")))))
{ {
File.Delete(Path.Combine(currentdir, "proxy.txt")); File.Delete(Path.Combine(CURRENT_DIR, "proxy.txt"));
proxyBox.Visible = false; proxyBox.Visible = false;
proxy_usr = ""; proxy_usr = "";
proxy_url = ""; proxy_url = "";
@ -2989,7 +2811,7 @@ namespace NUS_Downloader
return; return;
} }
else if ((String.IsNullOrEmpty(ProxyURL.Text)) && (String.IsNullOrEmpty(ProxyUser.Text)) && else if ((String.IsNullOrEmpty(ProxyURL.Text)) && (String.IsNullOrEmpty(ProxyUser.Text)) &&
((!(File.Exists(Path.Combine(currentdir, "proxy.txt")))))) ((!(File.Exists(Path.Combine(CURRENT_DIR, "proxy.txt"))))))
{ {
proxyBox.Visible = false; proxyBox.Visible = false;
WriteStatus("No proxy settings saved!"); WriteStatus("No proxy settings saved!");
@ -3012,7 +2834,7 @@ namespace NUS_Downloader
if (!(String.IsNullOrEmpty(proxy_file))) if (!(String.IsNullOrEmpty(proxy_file)))
{ {
File.WriteAllText(Path.Combine(currentdir, "proxy.txt"), proxy_file); File.WriteAllText(Path.Combine(CURRENT_DIR, "proxy.txt"), proxy_file);
WriteStatus("Proxy settings saved!"); WriteStatus("Proxy settings saved!");
} }
@ -3028,13 +2850,10 @@ namespace NUS_Downloader
private void proxySettingsToolStripMenuItem_Click(object sender, EventArgs e) private void proxySettingsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
// Current directory...
string currentdir = Directory.GetCurrentDirectory();
// Check for Proxy Settings file... // Check for Proxy Settings file...
if (File.Exists(Path.Combine(currentdir, "proxy.txt")) == true) if (File.Exists(Path.Combine(CURRENT_DIR, "proxy.txt")) == true)
{ {
string[] proxy_file = File.ReadAllLines(Path.Combine(currentdir, "proxy.txt")); string[] proxy_file = File.ReadAllLines(Path.Combine(CURRENT_DIR, "proxy.txt"));
ProxyURL.Text = proxy_file[0]; ProxyURL.Text = proxy_file[0];
if (proxy_file.Length > 1) if (proxy_file.Length > 1)
@ -3068,15 +2887,12 @@ namespace NUS_Downloader
private void loadNUSScriptToolStripMenuItem_Click(object sender, EventArgs e) private void loadNUSScriptToolStripMenuItem_Click(object sender, EventArgs e)
{ {
// Current directory...
string currentdir = Directory.GetCurrentDirectory();
// Open a NUS script. // Open a NUS script.
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = false; ofd.Multiselect = false;
ofd.Filter = "NUS Scripts|*.nus|All Files|*.*"; ofd.Filter = "NUS Scripts|*.nus|All Files|*.*";
if (Directory.Exists(Path.Combine(currentdir, "scripts"))) if (Directory.Exists(Path.Combine(CURRENT_DIR, "scripts")))
ofd.InitialDirectory = Path.Combine(currentdir, "scripts"); ofd.InitialDirectory = Path.Combine(CURRENT_DIR, "scripts");
ofd.Title = "Load a NUS/Wiimpersonator script."; ofd.Title = "Load a NUS/Wiimpersonator script.";
if (ofd.ShowDialog() != DialogResult.Cancel) if (ofd.ShowDialog() != DialogResult.Cancel)
@ -3235,6 +3051,17 @@ namespace NUS_Downloader
} }
} }
string CombinePaths(params string[] parts)
{
string result = String.Empty;
foreach (string s in parts)
{
result = Path.Combine(result, s);
}
return result;
}
private void scriptsbutton_Click(object sender, EventArgs e) private void scriptsbutton_Click(object sender, EventArgs e)
{ {
// Show scripts menu // Show scripts menu

View File

@ -144,13 +144,6 @@ namespace NUS_Downloader.Properties {
} }
} }
internal static System.Drawing.Bitmap dsi {
get {
object obj = ResourceManager.GetObject("dsi", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap help { internal static System.Drawing.Bitmap help {
get { get {
object obj = ResourceManager.GetObject("help", resourceCulture); object obj = ResourceManager.GetObject("help", resourceCulture);
@ -213,12 +206,5 @@ namespace NUS_Downloader.Properties {
return ((System.Drawing.Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
internal static System.Drawing.Bitmap wilolgoi {
get {
object obj = ResourceManager.GetObject("wilolgoi", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }

View File

@ -117,7 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="direction_down" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="direction_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\direction_down.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\direction_down.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -130,18 +130,12 @@
<data name="arrow_up" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="arrow_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="wilolgoi" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wilolgoi.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bullet_redgreen" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="bullet_redgreen" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bullet_redgreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\bullet_redgreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="arrow_down" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="arrow_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="dsi" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\dsi.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="server_connect" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="server_connect" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\server_connect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\server_connect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>

View File

@ -129,7 +129,7 @@ namespace NUS_Downloader
return; return;
} }
FileStream wadfs = new FileStream((Directory + FileName), FileMode.Create); FileStream wadfs = new FileStream(Path.Combine(Directory, FileName), FileMode.Create);
// Seek the beginning of the WAD... // Seek the beginning of the WAD...
wadfs.Seek(0, SeekOrigin.Begin); wadfs.Seek(0, SeekOrigin.Begin);