Attempt at finalizing how the user interacts with database during load.

This commit is contained in:
givememystuffplease 2010-07-10 18:42:35 +00:00
parent 778a44e31b
commit f844482e71
5 changed files with 66 additions and 61 deletions

View File

@ -37,14 +37,9 @@ namespace NUS_Downloader
// Does it exist? // Does it exist?
if (!File.Exists(databaseFile)) if (!File.Exists(databaseFile))
throw new FileNotFoundException("I couldn't find the database file!", "database.xml"); throw new FileNotFoundException("I couldn't find the database file!", "database.xml");
// Load database.xml into MemoryStream
databaseString = File.ReadAllText(databaseFile);
/*System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] databasebytes = encoding.GetBytes(databasestr);
// Load the memory stream databaseString = File.ReadAllText(databaseFile);
databaseStream = new MemoryStream(databasebytes);
databaseStream.Seek(0, SeekOrigin.Begin);*/
} }
public string GetDatabaseVersion() public string GetDatabaseVersion()

View File

@ -48,7 +48,6 @@ namespace NUS_Downloader
this.IOSMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.IOSMenuList = 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.C64MenuListDrop = new System.Windows.Forms.ContextMenuStrip(this.components);
this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.MSXMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.MSXMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.N64MenuList = new System.Windows.Forms.ToolStripMenuItem(); this.N64MenuList = new System.Windows.Forms.ToolStripMenuItem();
@ -111,6 +110,10 @@ 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();
@ -183,16 +186,20 @@ namespace NUS_Downloader
// //
this.databaseStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.databaseStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SystemMenuList, this.SystemMenuList,
this.systemFakeMenuItem,
this.IOSMenuList, this.IOSMenuList,
this.iosFakeMenuItem,
this.VCMenuList, this.VCMenuList,
this.vcFakeMenuItem,
this.WiiWareMenuList, this.WiiWareMenuList,
this.wwFakeMenuItem,
this.toolStripSeparator1, this.toolStripSeparator1,
this.RegionCodesList, this.RegionCodesList,
this.toolStripSeparator4, this.toolStripSeparator4,
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, 148); this.databaseStrip.Size = new System.Drawing.Size(164, 258);
// //
// SystemMenuList // SystemMenuList
// //
@ -227,17 +234,10 @@ namespace NUS_Downloader
// //
// C64MenuList // C64MenuList
// //
this.C64MenuList.DropDown = this.C64MenuListDrop;
this.C64MenuList.Name = "C64MenuList"; this.C64MenuList.Name = "C64MenuList";
this.C64MenuList.Size = new System.Drawing.Size(194, 22); this.C64MenuList.Size = new System.Drawing.Size(194, 22);
this.C64MenuList.Text = "Commodore 64"; this.C64MenuList.Text = "Commodore 64";
// //
// C64MenuListDrop
//
this.C64MenuListDrop.Name = "C64MenuListDrop";
this.C64MenuListDrop.OwnerItem = this.C64MenuList;
this.C64MenuListDrop.Size = new System.Drawing.Size(61, 4);
//
// GenesisMenuList // GenesisMenuList
// //
this.GenesisMenuList.Name = "GenesisMenuList"; this.GenesisMenuList.Name = "GenesisMenuList";
@ -837,6 +837,38 @@ 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;
@ -932,7 +964,6 @@ namespace NUS_Downloader
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.ContextMenuStrip C64MenuListDrop;
private System.Windows.Forms.ComboBox consoleCBox; private System.Windows.Forms.ComboBox consoleCBox;
private wmgCMS.WaterMarkTextBox titleidbox; private wmgCMS.WaterMarkTextBox titleidbox;
private wmgCMS.WaterMarkTextBox titleversion; private wmgCMS.WaterMarkTextBox titleversion;
@ -960,6 +991,10 @@ namespace NUS_Downloader
private System.Windows.Forms.Button iosPatchGroupBoxOKbtn; private System.Windows.Forms.Button iosPatchGroupBoxOKbtn;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel richPanel; private System.Windows.Forms.Panel richPanel;
private System.Windows.Forms.ToolStripMenuItem systemFakeMenuItem;
private System.Windows.Forms.ToolStripMenuItem iosFakeMenuItem;
private System.Windows.Forms.ToolStripMenuItem vcFakeMenuItem;
private System.Windows.Forms.ToolStripMenuItem wwFakeMenuItem;
} }
} }

View File

@ -61,13 +61,6 @@ namespace NUS_Downloader
private delegate void SetPropertyThreadSafeCallback(System.ComponentModel.Component what, object setto, string property); private delegate void SetPropertyThreadSafeCallback(System.ComponentModel.Component what, object setto, string property);
private delegate string OfficialWADNamingCallback(string whut); private delegate string OfficialWADNamingCallback(string whut);
// Images do not compare unless globalized...
private Image green = Properties.Resources.bullet_green;
private Image orange = Properties.Resources.bullet_orange;
private Image redorb = Properties.Resources.bullet_red;
private Image redgreen = Properties.Resources.bullet_redgreen;
private Image redorange = Properties.Resources.bullet_redorange;
private string WAD_Saveas_Filename; private string WAD_Saveas_Filename;
// TODO: OOP scripting // TODO: OOP scripting
@ -807,9 +800,9 @@ namespace NUS_Downloader
{ {
if (tsmiclear.Name != "VCMenuList") // Don't clear the VC Menu... if (tsmiclear.Name != "VCMenuList") // Don't clear the VC Menu...
tsmiclear.DropDownItems.Clear(); tsmiclear.DropDownItems.Clear();
/*
if (tsmiclear.OwnerItem != VCMenuList) // and don't disable the VC menu subparts... if (tsmiclear.OwnerItem != VCMenuList) // and don't disable the VC menu subparts...
tsmiclear.Enabled = false; tsmiclear.Enabled = false;*/
} }
} }
@ -821,6 +814,17 @@ namespace NUS_Downloader
// Something needs to be done to remove this i guess // Something needs to be done to remove this i guess
//Control.CheckForIllegalCrossThreadCalls = false; //Control.CheckForIllegalCrossThreadCalls = false;
// Set fake items visible and real ones not. Only way to stop buggy enabled stuff.
SetPropertyThreadSafe(SystemMenuList, false, "Visible");
SetPropertyThreadSafe(IOSMenuList, false, "Visible");
SetPropertyThreadSafe(VCMenuList, false, "Visible");
SetPropertyThreadSafe(WiiWareMenuList, false, "Visible");
SetPropertyThreadSafe(systemFakeMenuItem, true, "Visible");
SetPropertyThreadSafe(iosFakeMenuItem, true, "Visible");
SetPropertyThreadSafe(vcFakeMenuItem, true, "Visible");
SetPropertyThreadSafe(wwFakeMenuItem, true, "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"));
@ -839,7 +843,7 @@ namespace NUS_Downloader
AddToolStripItemToStrip(SystemMenuList, systemItems[a]); AddToolStripItemToStrip(SystemMenuList, systemItems[a]);
//SystemMenuList.DropDownItems.Add(systemItems[a]); //SystemMenuList.DropDownItems.Add(systemItems[a]);
} }
SetPropertyThreadSafe(SystemMenuList, true, "Enabled"); SetPropertyThreadSafe(systemFakeMenuItem, false, "Visible");
SetPropertyThreadSafe(SystemMenuList, true, "Visible"); SetPropertyThreadSafe(SystemMenuList, true, "Visible");
worker.ReportProgress(25); worker.ReportProgress(25);
@ -851,7 +855,7 @@ namespace NUS_Downloader
AddToolStripItemToStrip(IOSMenuList, iosItems[a]); AddToolStripItemToStrip(IOSMenuList, iosItems[a]);
//IOSMenuList.DropDownItems.Add(iosItems[a]); //IOSMenuList.DropDownItems.Add(iosItems[a]);
} }
SetPropertyThreadSafe(IOSMenuList, true, "Enabled"); SetPropertyThreadSafe(iosFakeMenuItem, false, "Visible");
SetPropertyThreadSafe(IOSMenuList, true, "Visible"); SetPropertyThreadSafe(IOSMenuList, true, "Visible");
worker.ReportProgress(50); worker.ReportProgress(50);
@ -879,7 +883,7 @@ namespace NUS_Downloader
} }
} }
} }
SetPropertyThreadSafe(VCMenuList, true, "Enabled"); SetPropertyThreadSafe(vcFakeMenuItem, false, "Visible");
SetPropertyThreadSafe(VCMenuList, true, "Visible"); SetPropertyThreadSafe(VCMenuList, true, "Visible");
worker.ReportProgress(75); worker.ReportProgress(75);
@ -899,7 +903,7 @@ namespace NUS_Downloader
AddToolStripItemToStrip(WiiWareMenuList, wwItems[a]); AddToolStripItemToStrip(WiiWareMenuList, wwItems[a]);
//WiiWareMenuList.DropDownItems.Add(wwItems[a]); //WiiWareMenuList.DropDownItems.Add(wwItems[a]);
} }
SetPropertyThreadSafe(WiiWareMenuList, true, "Enabled"); SetPropertyThreadSafe(wwFakeMenuItem, false, "Visible");
SetPropertyThreadSafe(WiiWareMenuList, true, "Visible"); SetPropertyThreadSafe(WiiWareMenuList, true, "Visible");
worker.ReportProgress(100); worker.ReportProgress(100);
@ -1484,33 +1488,6 @@ namespace NUS_Downloader
} }
} }
/// <summary>
/// Selects the database item image.
/// </summary>
/// <param name="ticket">if set to <c>true</c> [ticket].</param>
/// <param name="danger">if set to <c>true</c> [danger].</param>
/// <returns>Correct Image</returns>
private System.Drawing.Image SelectItemImage(bool ticket, bool danger)
{
// All is good, go green...
if ((ticket) && (!danger))
return green;
// There's no ticket, but danger is clear...
if ((!ticket) && (!danger))
return orange;
// DANGER WILL ROBINSON...
if ((ticket) && (danger))
return redgreen;
// Double bad...
if ((!ticket) && (danger))
return redorange;
return null;
}
/// <summary> /// <summary>
/// Updates the name of the packed WAD in the textbox. /// Updates the name of the packed WAD in the textbox.
/// </summary> /// </summary>
@ -2433,6 +2410,7 @@ namespace NUS_Downloader
} }
public void ScriptItem_Clicked(object sender, ToolStripItemClickedEventArgs e) public void ScriptItem_Clicked(object sender, ToolStripItemClickedEventArgs e)
{ } { //TODO
}
} }
} }

View File

@ -123,9 +123,6 @@
<metadata name="databaseStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="databaseStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value> <value>159, 17</value>
</metadata> </metadata>
<metadata name="C64MenuListDrop.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>394, 17</value>
</metadata>
<metadata name="extrasStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="extrasStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value> <value>285, 17</value>
</metadata> </metadata>