diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs
index bdc4d90..b6917f2 100644
--- a/NUS Downloader/Form1.Designer.cs
+++ b/NUS Downloader/Form1.Designer.cs
@@ -92,7 +92,10 @@
this.consoleCBox = new System.Windows.Forms.ComboBox();
this.scriptsbutton = new System.Windows.Forms.Button();
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.emulateUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.uSANTSCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.europePALToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -101,8 +104,6 @@
this.titleversion = new wmgCMS.WaterMarkTextBox();
this.titleidbox = new wmgCMS.WaterMarkTextBox();
this.dlprogress = new wyDay.Controls.Windows7ProgressBar();
- this.scriptsMainMenuEntry = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.databaseStrip.SuspendLayout();
this.extrasStrip.SuspendLayout();
this.proxyBox.SuspendLayout();
@@ -652,13 +653,30 @@
// scriptsStrip
//
this.scriptsStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.scriptsMainMenuEntry,
+ this.scriptsLocalMenuEntry,
+ this.scriptsDatabaseToolStripMenuItem,
this.loadNUSScriptToolStripMenuItem,
this.toolStripSeparator2,
this.emulateUpdate});
this.scriptsStrip.Name = "scriptsStrip";
this.scriptsStrip.ShowItemToolTips = false;
- this.scriptsStrip.Size = new System.Drawing.Size(220, 76);
+ this.scriptsStrip.Size = new System.Drawing.Size(220, 120);
+ //
+ // 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
//
@@ -668,6 +686,11 @@
this.loadNUSScriptToolStripMenuItem.Text = "Load NUS Script";
this.loadNUSScriptToolStripMenuItem.Click += new System.EventHandler(this.loadNUSScriptToolStripMenuItem_Click);
//
+ // toolStripSeparator2
+ //
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(216, 6);
+ //
// emulateUpdate
//
this.emulateUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -684,25 +707,25 @@
// uSANTSCToolStripMenuItem
//
this.uSANTSCToolStripMenuItem.Name = "uSANTSCToolStripMenuItem";
- this.uSANTSCToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ 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(152, 22);
+ 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(152, 22);
+ 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(152, 22);
+ this.koreaToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
this.koreaToolStripMenuItem.Text = "KOREA";
//
// titleversion
@@ -739,18 +762,6 @@
this.dlprogress.Size = new System.Drawing.Size(250, 15);
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -870,8 +881,9 @@
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.ToolStripMenuItem scriptsLocalMenuEntry;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
+ private System.Windows.Forms.ToolStripMenuItem scriptsDatabaseToolStripMenuItem;
}
}
diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs
index 73b1bca..35733e8 100644
--- a/NUS Downloader/Form1.cs
+++ b/NUS Downloader/Form1.cs
@@ -84,6 +84,9 @@ namespace NUS_Downloader
// Database thread
private BackgroundWorker fds;
+ // Scripts Thread
+ private BackgroundWorker scriptsWorker;
+
// Common Key hash
private byte[] wii_commonkey_sha1 = new byte[20]
{
@@ -132,11 +135,20 @@ namespace NUS_Downloader
KoreaMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);
NTSCMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);
PALMassUpdate.DropDownItemClicked += new ToolStripItemClickedEventHandler(upditem_itemclicked);
+
+ // Database BGLoader
this.fds = new BackgroundWorker();
this.fds.DoWork += new DoWorkEventHandler(DoAllDatabaseyStuff);
this.fds.RunWorkerCompleted += new RunWorkerCompletedEventHandler(DoAllDatabaseyStuff_Completed);
this.fds.ProgressChanged += new ProgressChangedEventHandler(DoAllDatabaseyStuff_ProgressChanged);
this.fds.WorkerReportsProgress = true;
+
+ // Scripts BGLoader
+ this.scriptsWorker = new BackgroundWorker();
+ this.scriptsWorker.DoWork += new DoWorkEventHandler(OrganizeScripts);
+ this.scriptsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(scriptsWorker_RunWorkerCompleted);
+ RunScriptOrganizer();
+
BootChecks();
}
@@ -169,22 +181,31 @@ namespace NUS_Downloader
consoleCBox.SelectedIndex = 0;
}
+ private bool NUSDFileExists(string filename)
+ {
+ if (File.Exists(Path.Combine(CURRENT_DIR, filename)))
+ return true;
+ else
+ return false;
+ }
+
///
/// Checks certain file existances, etc.
///
///
private void BootChecks()
{
- // Check if correct thread...
+ /* Check if correct thread...
if (this.InvokeRequired)
{
Debug.WriteLine("InvokeRequired...");
BootChecksCallback bcc = new BootChecksCallback(BootChecks);
this.Invoke(bcc);
return;
- }
+ }*/
+
// Check for Wii common key bin file...
- if (File.Exists(Path.Combine(CURRENT_DIR, "key.bin")) == false)
+ if (NUSDFileExists("key.bin") == false)
{
WriteStatus("Common Key (key.bin) missing! Decryption disabled!");
WriteStatus(" - Try: Extras -> Retrieve Key -> Common Key");
@@ -214,43 +235,43 @@ namespace NUS_Downloader
}
// Check for Wii KOR common key bin file...
- if (File.Exists(Path.Combine(CURRENT_DIR, "kkey.bin")) == true)
+ if (NUSDFileExists("kkey.bin") == true)
{
WriteStatus("Korean Common Key detected.");
}
// Check for DSi common key bin file...
- if (File.Exists(Path.Combine(CURRENT_DIR, "dsikey.bin")) == true)
+ if (NUSDFileExists("dsikey.bin") == true)
{
WriteStatus("DSi Common Key detected.");
dsidecrypt = true;
}
// Check for database.xml
- if (File.Exists(Path.Combine(CURRENT_DIR, "database.xml")) == false)
+ if (NUSDFileExists("database.xml") == false)
{
WriteStatus("Database.xml not found. Title database not usable!");
- //databaseButton.Visible = false;
- //Extrasbtn.Size = new System.Drawing.Size(134, 20);
- databaseButton.Click -= new System.EventHandler(this.button4_Click);
+ /*databaseButton.Click -= new System.EventHandler(this.button4_Click);
databaseButton.Click += new System.EventHandler(this.updateDatabaseToolStripMenuItem_Click);
- databaseButton.Text = "Download DB";
- //updateDatabaseToolStripMenuItem.Text = "Download Database";
+ databaseButton.Text = "Download DB"; */
+ DatabaseEnabled(false);
+ updateDatabaseToolStripMenuItem.Enabled = true;
+ updateDatabaseToolStripMenuItem.Text = "Download Database";
}
else
{
string version = GetDatabaseVersion("database.xml");
WriteStatus("Database.xml detected.");
WriteStatus(" - Version: " + version);
+ updateDatabaseToolStripMenuItem.Text = "Update Database";
databaseButton.Enabled = false;
databaseButton.Text = "DB Loading";
- updateDatabaseToolStripMenuItem.Text = "Update Database";
// Load it up...
this.fds.RunWorkerAsync();
}
// Check for Proxy Settings file...
- if (File.Exists(Path.Combine(CURRENT_DIR, "proxy.txt")) == true)
+ if (NUSDFileExists("proxy.txt") == true)
{
WriteStatus("Proxy settings detected.");
string[] proxy_file = File.ReadAllLines(Path.Combine(CURRENT_DIR, "proxy.txt"));
@@ -288,6 +309,12 @@ namespace NUS_Downloader
this.databaseButton.Text = "DB: " + e.ProgressPercentage + "%";
}
+ private void RunScriptOrganizer()
+ {
+ this.scriptsWorker.RunWorkerAsync();
+ scriptsLocalMenuEntry.Enabled = true;
+ }
+
private void SetAllEnabled(bool enabled)
{
for (int a = 0; a < this.Controls.Count; a++)
@@ -2447,7 +2474,6 @@ namespace NUS_Downloader
WriteStatus("Database successfully created!");
databaseButton.Visible = true;
databaseButton.Enabled = false;
- Extrasbtn.Size = new System.Drawing.Size(55, 20);
updateDatabaseToolStripMenuItem.Text = "Download Database";
}
else
@@ -3080,5 +3106,45 @@ namespace NUS_Downloader
// Show scripts menu
scriptsStrip.Show(scriptsbutton, 2, 2);
}
+
+ private void DatabaseEnabled(bool enabled)
+ {
+ for (int a = 0; a < databaseStrip.Items.Count; a++)
+ {
+ databaseStrip.Items[a].Enabled = false;
+ }
+ }
+
+ void scriptsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ //throw new NotImplementedException();
+ }
+
+ void OrganizeScripts(object sender, DoWorkEventArgs e)
+ {
+ //throw new NotImplementedException();
+ foreach (string directory in Directory.GetDirectories(Path.Combine(CURRENT_DIR, "scripts"), "*", SearchOption.TopDirectoryOnly))
+ {
+ if (Directory.GetFiles(directory, "*.nus", SearchOption.TopDirectoryOnly).Length > 0)
+ {
+ DirectoryInfo dinfo = new DirectoryInfo(directory);
+ ToolStripMenuItem folder_item = new ToolStripMenuItem();
+ folder_item.Text = dinfo.Name + Path.DirectorySeparatorChar;
+ folder_item.Image = Properties.Resources.folder_table;
+
+
+ foreach (string nusscript in Directory.GetFiles(directory, "*.nus", SearchOption.TopDirectoryOnly))
+ {
+ FileInfo finfo = new FileInfo(nusscript);
+ ToolStripMenuItem nus_script_item = new ToolStripMenuItem();
+ nus_script_item.Text = finfo.Name;
+ nus_script_item.Image = Properties.Resources.script_go;
+ folder_item.DropDownItems.Add(nus_script_item);
+ }
+
+ scriptsLocalMenuEntry.DropDownItems.Add(folder_item);
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/NUS Downloader/NUS Downloader.csproj b/NUS Downloader/NUS Downloader.csproj
index 594db8a..3e876e3 100644
--- a/NUS Downloader/NUS Downloader.csproj
+++ b/NUS Downloader/NUS Downloader.csproj
@@ -124,7 +124,10 @@
+
+
+
diff --git a/NUS Downloader/Properties/Resources.Designer.cs b/NUS Downloader/Properties/Resources.Designer.cs
index 1be059c..9ee5827 100644
--- a/NUS Downloader/Properties/Resources.Designer.cs
+++ b/NUS Downloader/Properties/Resources.Designer.cs
@@ -144,6 +144,13 @@ namespace NUS_Downloader.Properties {
}
}
+ internal static System.Drawing.Bitmap folder_table {
+ get {
+ object obj = ResourceManager.GetObject("folder_table", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap help {
get {
object obj = ResourceManager.GetObject("help", resourceCulture);
@@ -186,6 +193,20 @@ namespace NUS_Downloader.Properties {
}
}
+ internal static System.Drawing.Bitmap script_code {
+ get {
+ object obj = ResourceManager.GetObject("script_code", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap script_code_red {
+ get {
+ object obj = ResourceManager.GetObject("script_code_red", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap script_go {
get {
object obj = ResourceManager.GetObject("script_go", resourceCulture);
diff --git a/NUS Downloader/Properties/Resources.resx b/NUS Downloader/Properties/Resources.resx
index 164ba79..fa8873f 100644
--- a/NUS Downloader/Properties/Resources.resx
+++ b/NUS Downloader/Properties/Resources.resx
@@ -130,12 +130,18 @@
..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\script_code.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\bullet_redgreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\server_link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\server_connect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -145,12 +151,12 @@
..\Resources\bullet_green.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\bug_error.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\page_white_magnify.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\bug_error.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\script_go.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -163,8 +169,8 @@
..\Resources\link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\server_link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\script_code_red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\key.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -181,4 +187,8 @@
..\Resources\database_save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/NUS Downloader/Resources/folder_table.png b/NUS Downloader/Resources/folder_table.png
new file mode 100644
index 0000000..473cee3
Binary files /dev/null and b/NUS Downloader/Resources/folder_table.png differ
diff --git a/NUS Downloader/Resources/script_code.png b/NUS Downloader/Resources/script_code.png
new file mode 100644
index 0000000..63fe6ce
Binary files /dev/null and b/NUS Downloader/Resources/script_code.png differ
diff --git a/NUS Downloader/Resources/script_code_red.png b/NUS Downloader/Resources/script_code_red.png
new file mode 100644
index 0000000..8fcf0f0
Binary files /dev/null and b/NUS Downloader/Resources/script_code_red.png differ