Created method to take old folder structure and restructure it (UNFINISHED)

This commit is contained in:
givememystuffplease 2010-07-11 01:09:50 +00:00
parent f844482e71
commit 75de125e7f
4 changed files with 86 additions and 47 deletions

View File

@ -45,7 +45,9 @@ namespace NUS_Downloader
this.wadnamebox = new System.Windows.Forms.TextBox(); this.wadnamebox = new System.Windows.Forms.TextBox();
this.databaseStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.databaseStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.SystemMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.SystemMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.systemFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.IOSMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.IOSMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.iosFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.VCMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.VCMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.C64MenuList = new System.Windows.Forms.ToolStripMenuItem(); this.C64MenuList = new System.Windows.Forms.ToolStripMenuItem();
this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem();
@ -58,7 +60,9 @@ namespace NUS_Downloader
this.TurboGrafx16MenuList = new System.Windows.Forms.ToolStripMenuItem(); this.TurboGrafx16MenuList = new System.Windows.Forms.ToolStripMenuItem();
this.TurboGrafxCDMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.TurboGrafxCDMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.VCArcadeMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.VCArcadeMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.vcFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WiiWareMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.WiiWareMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.wwFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
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();
@ -110,10 +114,6 @@ namespace NUS_Downloader
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.systemFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.iosFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.vcFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.wwFakeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.databaseStrip.SuspendLayout(); this.databaseStrip.SuspendLayout();
this.extrasStrip.SuspendLayout(); this.extrasStrip.SuspendLayout();
this.proxyBox.SuspendLayout(); this.proxyBox.SuspendLayout();
@ -199,7 +199,7 @@ namespace NUS_Downloader
this.updateDatabaseToolStripMenuItem}); 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(164, 258); this.databaseStrip.Size = new System.Drawing.Size(164, 236);
// //
// SystemMenuList // SystemMenuList
// //
@ -208,12 +208,28 @@ namespace NUS_Downloader
this.SystemMenuList.Size = new System.Drawing.Size(154, 22); this.SystemMenuList.Size = new System.Drawing.Size(154, 22);
this.SystemMenuList.Text = "System"; this.SystemMenuList.Text = "System";
// //
// systemFakeMenuItem
//
this.systemFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.systemFakeMenuItem.Name = "systemFakeMenuItem";
this.systemFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.systemFakeMenuItem.Text = "System";
this.systemFakeMenuItem.Visible = false;
//
// IOSMenuList // IOSMenuList
// //
this.IOSMenuList.Name = "IOSMenuList"; this.IOSMenuList.Name = "IOSMenuList";
this.IOSMenuList.Size = new System.Drawing.Size(163, 22); this.IOSMenuList.Size = new System.Drawing.Size(163, 22);
this.IOSMenuList.Text = "IOS"; this.IOSMenuList.Text = "IOS";
// //
// iosFakeMenuItem
//
this.iosFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.iosFakeMenuItem.Name = "iosFakeMenuItem";
this.iosFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.iosFakeMenuItem.Text = "IOS";
this.iosFakeMenuItem.Visible = false;
//
// VCMenuList // VCMenuList
// //
this.VCMenuList.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.VCMenuList.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -298,12 +314,28 @@ namespace NUS_Downloader
this.VCArcadeMenuList.Size = new System.Drawing.Size(194, 22); this.VCArcadeMenuList.Size = new System.Drawing.Size(194, 22);
this.VCArcadeMenuList.Text = "Virtual Console Arcade"; this.VCArcadeMenuList.Text = "Virtual Console Arcade";
// //
// vcFakeMenuItem
//
this.vcFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.vcFakeMenuItem.Name = "vcFakeMenuItem";
this.vcFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.vcFakeMenuItem.Text = "Virtual Console";
this.vcFakeMenuItem.Visible = false;
//
// WiiWareMenuList // WiiWareMenuList
// //
this.WiiWareMenuList.Name = "WiiWareMenuList"; this.WiiWareMenuList.Name = "WiiWareMenuList";
this.WiiWareMenuList.Size = new System.Drawing.Size(163, 22); this.WiiWareMenuList.Size = new System.Drawing.Size(163, 22);
this.WiiWareMenuList.Text = "WiiWare"; this.WiiWareMenuList.Text = "WiiWare";
// //
// wwFakeMenuItem
//
this.wwFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.wwFakeMenuItem.Name = "wwFakeMenuItem";
this.wwFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.wwFakeMenuItem.Text = "WiiWare";
this.wwFakeMenuItem.Visible = false;
//
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -552,13 +584,14 @@ namespace NUS_Downloader
this.emulateUpdate}); 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(220, 98); this.scriptsStrip.Size = new System.Drawing.Size(220, 120);
// //
// scriptsLocalMenuEntry // scriptsLocalMenuEntry
// //
this.scriptsLocalMenuEntry.Enabled = false; this.scriptsLocalMenuEntry.Enabled = false;
this.scriptsLocalMenuEntry.Image = global::NUS_Downloader.Properties.Resources.script_code; this.scriptsLocalMenuEntry.Image = global::NUS_Downloader.Properties.Resources.script_code;
this.scriptsLocalMenuEntry.Name = "scriptsLocalMenuEntry"; this.scriptsLocalMenuEntry.Name = "scriptsLocalMenuEntry";
this.scriptsLocalMenuEntry.Overflow = System.Windows.Forms.ToolStripItemOverflow.AsNeeded;
this.scriptsLocalMenuEntry.Size = new System.Drawing.Size(219, 22); this.scriptsLocalMenuEntry.Size = new System.Drawing.Size(219, 22);
this.scriptsLocalMenuEntry.Text = "Scripts (Local)"; this.scriptsLocalMenuEntry.Text = "Scripts (Local)";
// //
@ -837,38 +870,6 @@ namespace NUS_Downloader
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;
// //
// systemFakeMenuItem
//
this.systemFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.systemFakeMenuItem.Name = "systemFakeMenuItem";
this.systemFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.systemFakeMenuItem.Text = "System";
this.systemFakeMenuItem.Visible = false;
//
// iosFakeMenuItem
//
this.iosFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.iosFakeMenuItem.Name = "iosFakeMenuItem";
this.iosFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.iosFakeMenuItem.Text = "IOS";
this.iosFakeMenuItem.Visible = false;
//
// vcFakeMenuItem
//
this.vcFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.vcFakeMenuItem.Name = "vcFakeMenuItem";
this.vcFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.vcFakeMenuItem.Text = "Virtual Console";
this.vcFakeMenuItem.Visible = false;
//
// wwFakeMenuItem
//
this.wwFakeMenuItem.Image = global::NUS_Downloader.Properties.Resources.arrow_ticker;
this.wwFakeMenuItem.Name = "wwFakeMenuItem";
this.wwFakeMenuItem.Size = new System.Drawing.Size(163, 22);
this.wwFakeMenuItem.Text = "WiiWare";
this.wwFakeMenuItem.Visible = false;
//
// Form1 // Form1
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;

View File

@ -142,6 +142,16 @@ namespace NUS_Downloader
while (String.IsNullOrEmpty(proxy_pwd)) while (String.IsNullOrEmpty(proxy_pwd))
Thread.Sleep(1000); Thread.Sleep(1000);
if ((args.Length == 1) && (args[0] == "folderfix"))
{
// Organizing folders from past NUSD releases...
BackgroundWorker folder_fixer = new BackgroundWorker();
folder_fixer.DoWork += new DoWorkEventHandler(ReorganizePreviousFolderStructure);
folder_fixer.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ReorganizePreviousFolderStructure_Completed);
WriteStatus("Organizing your old folder structure...");
folder_fixer.RunWorkerAsync();
}
if ((args.Length == 1) && (File.Exists(args[0]))) if ((args.Length == 1) && (File.Exists(args[0])))
{ {
script_filename = args[0]; script_filename = args[0];
@ -151,6 +161,8 @@ namespace NUS_Downloader
} }
} }
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
this.Text = String.Format("NUSD - {0}", version); ; this.Text = String.Format("NUSD - {0}", version); ;
@ -1060,11 +1072,11 @@ namespace NUS_Downloader
/// <param name="attributes">The attributes.</param> /// <param name="attributes">The attributes.</param>
private void AddToolStripItemToStrip(ToolStripMenuItem menulist, ToolStripMenuItem additionitem) private void AddToolStripItemToStrip(ToolStripMenuItem menulist, ToolStripMenuItem additionitem)
{ {
Debug.WriteLine(String.Format("Adding item")); //Debug.WriteLine(String.Format("Adding item"));
if (this.InvokeRequired) if (this.InvokeRequired)
{ {
Debug.WriteLine("InvokeRequired..."); //Debug.WriteLine("InvokeRequired...");
AddToolStripItemToStripCallback atsitsc = new AddToolStripItemToStripCallback(AddToolStripItemToStrip); AddToolStripItemToStripCallback atsitsc = new AddToolStripItemToStripCallback(AddToolStripItemToStrip);
this.Invoke(atsitsc, new object[] {menulist, additionitem}); this.Invoke(atsitsc, new object[] {menulist, additionitem});
return; return;
@ -2376,10 +2388,6 @@ namespace NUS_Downloader
iosPatchesListBox.Enabled = true; iosPatchesListBox.Enabled = true;
iosPatchGroupBoxOKbtn.Enabled = true; iosPatchGroupBoxOKbtn.Enabled = true;
} }
else
{
//packbox.Enabled = true;
}
} }
private void iosPatchGroupBoxOKbtn_Click(object sender, EventArgs e) private void iosPatchGroupBoxOKbtn_Click(object sender, EventArgs e)
@ -2389,11 +2397,11 @@ namespace NUS_Downloader
if (iosPatchesListBox.CheckedIndices.Count == 0) if (iosPatchesListBox.CheckedIndices.Count == 0)
// Uncheck the checkbox to indicate no patches // Uncheck the checkbox to indicate no patches
iosPatchCheckbox.Checked = false; iosPatchCheckbox.Checked = false;
//packbox.Enabled = false;
} }
private void FillDatabaseScripts() private void FillDatabaseScripts()
{ {
SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, false, "Visible");
Database databaseObj = new Database(); Database databaseObj = new Database();
databaseObj.LoadDatabaseToStream(Path.Combine(CURRENT_DIR, "database.xml")); databaseObj.LoadDatabaseToStream(Path.Combine(CURRENT_DIR, "database.xml"));
@ -2405,12 +2413,42 @@ namespace NUS_Downloader
AddToolStripItemToStrip(scriptsDatabaseToolStripMenuItem, scriptItems[a]); AddToolStripItemToStrip(scriptsDatabaseToolStripMenuItem, scriptItems[a]);
//SystemMenuList.DropDownItems.Add(systemItems[a]); //SystemMenuList.DropDownItems.Add(systemItems[a]);
} }
SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Enabled"); SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Enabled");
SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Visible"); SetPropertyThreadSafe(scriptsDatabaseToolStripMenuItem, true, "Visible");
} }
public void ScriptItem_Clicked(object sender, ToolStripItemClickedEventArgs e) public void ScriptItem_Clicked(object sender, ToolStripItemClickedEventArgs e)
{ //TODO {// STILL TODO
ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
string folderpath = "\000";
script_filename = folderpath;
BackgroundWorker scripter = new BackgroundWorker();
scripter.DoWork += new DoWorkEventHandler(RunScript);
scripter.RunWorkerAsync();
}
void ReorganizePreviousFolderStructure(object sender, DoWorkEventArgs e)
{
// 0000000000000000v000\* become titles\0000000000000000\v000\*
Regex TitleDirectoryRegex = new Regex(@"[a-zA-Z0-9]{16}v?([0-9]*)?");
if (Directory.Exists(Path.Combine(CURRENT_DIR, "titles")) == false)
Directory.CreateDirectory(Path.Combine(CURRENT_DIR, "titles"));
string[] directories = Directory.GetDirectories(CURRENT_DIR, "*", SearchOption.TopDirectoryOnly);
foreach (string directory in directories)
{
DirectoryInfo dinfo = new DirectoryInfo(directory);
if (TitleDirectoryRegex.IsMatch(dinfo.Name.ToString()) == false)
break;
}
}
void ReorganizePreviousFolderStructure_Completed(object sender, RunWorkerCompletedEventArgs e)
{
} }
} }
} }

View File

@ -127,7 +127,7 @@
<value>285, 17</value> <value>285, 17</value>
</metadata> </metadata>
<metadata name="scriptsStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="scriptsStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>544, 17</value> <value>386, 21</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">