Initial structure of contents editor added. Overwriting is not yet implemented, however manipulating the contents is. Also bugfixes...

This commit is contained in:
givememystuffplease 2009-07-14 19:38:18 +00:00
parent dadf1e185f
commit 55a96ca677
22 changed files with 2163 additions and 69 deletions

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestRunConfiguration name="Local Test Run" id="913cc7e8-5ef9-4d00-9a8b-e0e799870251" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<Description>This is a default test run configuration for a local test run.</Description>
<TestTypeSpecific />
</TestRunConfiguration>

6
NUS Downloader.vsmdi Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
<RunConfiguration id="913cc7e8-5ef9-4d00-9a8b-e0e799870251" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
</TestList>
</TestLists>

View File

@ -52,16 +52,16 @@
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.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.MSXMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.N64MenuList = new System.Windows.Forms.ToolStripMenuItem();
this.NeoGeoMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.NeoGeoMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.NESMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.NESMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.SNESMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.N64MenuList = new System.Windows.Forms.ToolStripMenuItem();
this.MSXMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.TurboGrafx16MenuList = new System.Windows.Forms.ToolStripMenuItem();
this.SegaMSMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.SegaMSMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.GenesisMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.SNESMenuList = new System.Windows.Forms.ToolStripMenuItem();
this.VCArcadeMenuList = 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.WiiWareMenuList = new System.Windows.Forms.ToolStripMenuItem(); this.WiiWareMenuList = 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();
@ -94,11 +94,22 @@
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.shamelessvariablelabel = new System.Windows.Forms.Label(); this.shamelessvariablelabel = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.contentsEdit = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button13 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.radioButton1 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton();
this.databaseStrip.SuspendLayout(); this.databaseStrip.SuspendLayout();
this.tmdgpbox.SuspendLayout(); this.tmdgpbox.SuspendLayout();
this.ticketgpbox.SuspendLayout(); this.ticketgpbox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// TMDButton // TMDButton
@ -286,7 +297,7 @@
this.RegionCodesList}); this.RegionCodesList});
this.databaseStrip.Name = "databaseStrip"; this.databaseStrip.Name = "databaseStrip";
this.databaseStrip.ShowItemToolTips = false; this.databaseStrip.ShowItemToolTips = false;
this.databaseStrip.Size = new System.Drawing.Size(155, 142); this.databaseStrip.Size = new System.Drawing.Size(155, 120);
// //
// SystemMenuList // SystemMenuList
// //
@ -325,6 +336,24 @@
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";
// //
// GenesisMenuList
//
this.GenesisMenuList.Name = "GenesisMenuList";
this.GenesisMenuList.Size = new System.Drawing.Size(194, 22);
this.GenesisMenuList.Text = "Mega Drive/Genesis";
//
// MSXMenuList
//
this.MSXMenuList.Name = "MSXMenuList";
this.MSXMenuList.Size = new System.Drawing.Size(194, 22);
this.MSXMenuList.Text = "MSX";
//
// N64MenuList
//
this.N64MenuList.Name = "N64MenuList";
this.N64MenuList.Size = new System.Drawing.Size(194, 22);
this.N64MenuList.Text = "Nintendo 64";
//
// NeoGeoMenuList // NeoGeoMenuList
// //
this.NeoGeoMenuList.Name = "NeoGeoMenuList"; this.NeoGeoMenuList.Name = "NeoGeoMenuList";
@ -337,41 +366,29 @@
this.NESMenuList.Size = new System.Drawing.Size(194, 22); this.NESMenuList.Size = new System.Drawing.Size(194, 22);
this.NESMenuList.Text = "NES"; this.NESMenuList.Text = "NES";
// //
// SegaMSMenuList
//
this.SegaMSMenuList.Name = "SegaMSMenuList";
this.SegaMSMenuList.Size = new System.Drawing.Size(194, 22);
this.SegaMSMenuList.Text = "Sega Master System";
//
// SNESMenuList // SNESMenuList
// //
this.SNESMenuList.Name = "SNESMenuList"; this.SNESMenuList.Name = "SNESMenuList";
this.SNESMenuList.Size = new System.Drawing.Size(194, 22); this.SNESMenuList.Size = new System.Drawing.Size(194, 22);
this.SNESMenuList.Text = "SNES"; this.SNESMenuList.Text = "SNES";
// //
// N64MenuList
//
this.N64MenuList.Name = "N64MenuList";
this.N64MenuList.Size = new System.Drawing.Size(194, 22);
this.N64MenuList.Text = "Nintendo 64";
//
// MSXMenuList
//
this.MSXMenuList.Name = "MSXMenuList";
this.MSXMenuList.Size = new System.Drawing.Size(194, 22);
this.MSXMenuList.Text = "MSX";
//
// TurboGrafx16MenuList // TurboGrafx16MenuList
// //
this.TurboGrafx16MenuList.Name = "TurboGrafx16MenuList"; this.TurboGrafx16MenuList.Name = "TurboGrafx16MenuList";
this.TurboGrafx16MenuList.Size = new System.Drawing.Size(194, 22); this.TurboGrafx16MenuList.Size = new System.Drawing.Size(194, 22);
this.TurboGrafx16MenuList.Text = "TruboGrafx-16"; this.TurboGrafx16MenuList.Text = "TruboGrafx-16";
// //
// SegaMSMenuList // TurboGrafxCDMenuList
// //
this.SegaMSMenuList.Name = "SegaMSMenuList"; this.TurboGrafxCDMenuList.Name = "TurboGrafxCDMenuList";
this.SegaMSMenuList.Size = new System.Drawing.Size(194, 22); this.TurboGrafxCDMenuList.Size = new System.Drawing.Size(194, 22);
this.SegaMSMenuList.Text = "Sega Master System"; this.TurboGrafxCDMenuList.Text = "TurboGrafx-CD";
//
// GenesisMenuList
//
this.GenesisMenuList.Name = "GenesisMenuList";
this.GenesisMenuList.Size = new System.Drawing.Size(194, 22);
this.GenesisMenuList.Text = "Mega Drive/Genesis";
// //
// VCArcadeMenuList // VCArcadeMenuList
// //
@ -379,12 +396,6 @@
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";
// //
// TurboGrafxCDMenuList
//
this.TurboGrafxCDMenuList.Name = "TurboGrafxCDMenuList";
this.TurboGrafxCDMenuList.Size = new System.Drawing.Size(194, 22);
this.TurboGrafxCDMenuList.Text = "TurboGrafx-CD";
//
// WiiWareMenuList // WiiWareMenuList
// //
this.WiiWareMenuList.Name = "WiiWareMenuList"; this.WiiWareMenuList.Name = "WiiWareMenuList";
@ -674,7 +685,7 @@
// //
this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button7.Location = new System.Drawing.Point(278, 290); this.button7.Location = new System.Drawing.Point(278, 459);
this.button7.Name = "button7"; this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(249, 27); this.button7.Size = new System.Drawing.Size(249, 27);
this.button7.TabIndex = 28; this.button7.TabIndex = 28;
@ -685,9 +696,9 @@
// label12 // label12
// //
this.label12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.label12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label12.Location = new System.Drawing.Point(278, 335); this.label12.Location = new System.Drawing.Point(239, 465);
this.label12.Name = "label12"; this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(249, 148); this.label12.Size = new System.Drawing.Size(23, 15);
this.label12.TabIndex = 29; this.label12.TabIndex = 29;
this.label12.Text = resources.GetString("label12.Text"); this.label12.Text = resources.GetString("label12.Text");
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -712,6 +723,118 @@
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click_1); this.button3.Click += new System.EventHandler(this.button3_Click_1);
// //
// contentsEdit
//
this.contentsEdit.FormattingEnabled = true;
this.contentsEdit.Location = new System.Drawing.Point(9, 19);
this.contentsEdit.Name = "contentsEdit";
this.contentsEdit.Size = new System.Drawing.Size(138, 134);
this.contentsEdit.TabIndex = 32;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button13);
this.groupBox1.Controls.Add(this.button15);
this.groupBox1.Controls.Add(this.button14);
this.groupBox1.Controls.Add(this.button12);
this.groupBox1.Controls.Add(this.contentsEdit);
this.groupBox1.Controls.Add(this.button8);
this.groupBox1.Controls.Add(this.button11);
this.groupBox1.Controls.Add(this.button9);
this.groupBox1.Controls.Add(this.button10);
this.groupBox1.Location = new System.Drawing.Point(278, 290);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(249, 160);
this.groupBox1.TabIndex = 41;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Edit Title Contents";
//
// button13
//
this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button13.Image = global::NUS_Downloader.Properties.Resources.bug_add;
this.button13.Location = new System.Drawing.Point(217, 53);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(26, 26);
this.button13.TabIndex = 43;
this.button13.UseVisualStyleBackColor = true;
//
// button15
//
this.button15.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button15.Location = new System.Drawing.Point(153, 95);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(90, 26);
this.button15.TabIndex = 42;
this.button15.Text = "Revert";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click);
//
// button14
//
this.button14.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button14.Location = new System.Drawing.Point(153, 127);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(90, 26);
this.button14.TabIndex = 41;
this.button14.Text = "Overwrite";
this.button14.UseVisualStyleBackColor = true;
//
// button12
//
this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button12.Image = global::NUS_Downloader.Properties.Resources.connect;
this.button12.Location = new System.Drawing.Point(217, 19);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(26, 26);
this.button12.TabIndex = 40;
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// button8
//
this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button8.Image = global::NUS_Downloader.Properties.Resources.arrow_up;
this.button8.Location = new System.Drawing.Point(153, 19);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(26, 26);
this.button8.TabIndex = 33;
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button11
//
this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button11.Image = global::NUS_Downloader.Properties.Resources.package_add;
this.button11.Location = new System.Drawing.Point(185, 19);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(26, 26);
this.button11.TabIndex = 36;
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button9
//
this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button9.Image = global::NUS_Downloader.Properties.Resources.arrow_down;
this.button9.Location = new System.Drawing.Point(153, 53);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(26, 26);
this.button9.TabIndex = 34;
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button10
//
this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button10.Image = global::NUS_Downloader.Properties.Resources.package_delete;
this.button10.Location = new System.Drawing.Point(185, 53);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(26, 26);
this.button10.TabIndex = 35;
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// radioButton1 // radioButton1
// //
this.radioButton1.BackColor = System.Drawing.Color.Transparent; this.radioButton1.BackColor = System.Drawing.Color.Transparent;
@ -741,18 +864,19 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(539, 492); this.ClientSize = new System.Drawing.Size(539, 492);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.shamelessvariablelabel); this.Controls.Add(this.shamelessvariablelabel);
this.Controls.Add(this.label12); this.Controls.Add(this.label12);
this.Controls.Add(this.button6); this.Controls.Add(this.button6);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.button7);
this.Controls.Add(this.ticketgpbox); this.Controls.Add(this.ticketgpbox);
this.Controls.Add(this.button5); this.Controls.Add(this.button5);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.tmdgpbox); this.Controls.Add(this.tmdgpbox);
this.Controls.Add(this.truchabox); this.Controls.Add(this.truchabox);
this.Controls.Add(this.databaseButton); this.Controls.Add(this.databaseButton);
this.Controls.Add(this.button7);
this.Controls.Add(this.decryptbox); this.Controls.Add(this.decryptbox);
this.Controls.Add(this.ignoreticket); this.Controls.Add(this.ignoreticket);
this.Controls.Add(this.wadnamebox); this.Controls.Add(this.wadnamebox);
@ -783,6 +907,7 @@
this.tmdgpbox.PerformLayout(); this.tmdgpbox.PerformLayout();
this.ticketgpbox.ResumeLayout(false); this.ticketgpbox.ResumeLayout(false);
this.ticketgpbox.PerformLayout(); this.ticketgpbox.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -856,6 +981,16 @@
private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label shamelessvariablelabel; private System.Windows.Forms.Label shamelessvariablelabel;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.ListBox contentsEdit;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button13;
} }
} }

View File

@ -18,6 +18,8 @@ namespace NUS_Downloader
static RijndaelManaged rijndaelCipher; static RijndaelManaged rijndaelCipher;
static bool dsidecrypt = false; static bool dsidecrypt = false;
const string certs_MD5 = "7677AD47BAA5D6E3E313E72661FBDC16"; const string certs_MD5 = "7677AD47BAA5D6E3E313E72661FBDC16";
// Images do not compare unless globalized... // Images do not compare unless globalized...
Image green = Properties.Resources.bullet_green; Image green = Properties.Resources.bullet_green;
@ -270,30 +272,26 @@ namespace NUS_Downloader
titleversion.Text = Convert.ToString(int.Parse(tmdversion, System.Globalization.NumberStyles.HexNumber)); titleversion.Text = Convert.ToString(int.Parse(tmdversion, System.Globalization.NumberStyles.HexNumber));
// Read System Version (Needed IOS) // Read System Version (Needed IOS)
string sysversion = ""; string sysversion = IOSNeededFromTMD(tmd);
for (int i = 0; i < 8; i++)
{
sysversion += MakeProperLength(ConvertToHex(Convert.ToString(tmd[0x184 + i])));
}
sysversion = Convert.ToString(int.Parse(sysversion.Substring(14, 2), System.Globalization.NumberStyles.HexNumber));
if (sysversion != "0") if (sysversion != "0")
WriteStatus("Requires: IOS" + sysversion); WriteStatus("Requires: IOS" + sysversion);
// Read Content #... // Read Content #...
string contentstrnum = ""; int nbr_cont = ContentCount(tmd);
/*string contentstrnum = "";
for (int x = 478; x < 480; x++) for (int x = 478; x < 480; x++)
{ {
contentstrnum += TrimLeadingZeros(Convert.ToString(tmd[x])); contentstrnum += TrimLeadingZeros(Convert.ToString(tmd[x]));
} }*/
WriteStatus("Content Count: " + contentstrnum); WriteStatus("Content Count: " + nbr_cont);
string[] tmdcontents = GetContentNames(tmd, Convert.ToInt32(contentstrnum)); string[] tmdcontents = GetContentNames(tmd, nbr_cont);
string[] tmdsizes = GetContentSizes(tmd, Convert.ToInt32(contentstrnum)); string[] tmdsizes = GetContentSizes(tmd, nbr_cont);
byte[] tmdhashes = GetContentHashes(tmd, Convert.ToInt32(contentstrnum)); byte[] tmdhashes = GetContentHashes(tmd, nbr_cont);
byte[] tmdindices = GetContentIndices(tmd, Convert.ToInt32(contentstrnum)); byte[] tmdindices = GetContentIndices(tmd, nbr_cont);
// Loop through each content and display name, hash, index // Loop through each content and display name, hash, index
for (int i = 0; i < Convert.ToInt32(contentstrnum); i++) for (int i = 0; i < nbr_cont; i++)
{ {
WriteStatus(" Content " + (i + 1) + ": " + tmdcontents[i] + " (" + Convert.ToString(int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber)) + " bytes)"); WriteStatus(" Content " + (i + 1) + ": " + tmdcontents[i] + " (" + Convert.ToString(int.Parse(tmdsizes[i], System.Globalization.NumberStyles.HexNumber)) + " bytes)");
byte[] hash = new byte[20]; byte[] hash = new byte[20];
@ -308,6 +306,33 @@ namespace NUS_Downloader
} }
} }
private string IOSNeededFromTMD(byte[] tmd)
{
string sysversion = "";
for (int i = 0; i < 8; i++)
{
sysversion += MakeProperLength(ConvertToHex(Convert.ToString(tmd[0x184 + i])));
}
sysversion = Convert.ToString(int.Parse(sysversion.Substring(14, 2), System.Globalization.NumberStyles.HexNumber));
return sysversion;
}
private int ContentCount(byte[] tmd)
{
// nbr_cont (0xDE) len=0x02
int nbr_cont = 0;
nbr_cont = (tmd[0x1DE] * 256) + tmd[0x1DF];
return nbr_cont;
}
private int BootIndex(byte[] tmd)
{
// nbr_cont (0xE0) len=0x02
int bootidx = 0;
bootidx = (tmd[0x1E0] * 256) + tmd[0x1E1];
return bootidx;
}
private void WriteStatus(string Update) private void WriteStatus(string Update)
{ {
// Small function for writing text to the statusbox... // Small function for writing text to the statusbox...
@ -545,8 +570,15 @@ namespace NUS_Downloader
} }
else else
{ {
if (!statusbox.Lines[0].StartsWith(" ---")) try
{
if (!statusbox.Lines[0].StartsWith(" ---"))
statusbox.Text = " --- " + titleidbox.Text + " ---";
}
catch // No lines present...
{
statusbox.Text = " --- " + titleidbox.Text + " ---"; statusbox.Text = " --- " + titleidbox.Text + " ---";
}
} }
// Running Downloads in background so no form freezing // Running Downloads in background so no form freezing
@ -695,13 +727,8 @@ namespace NUS_Downloader
} }
titleversion.Text = Convert.ToString(int.Parse(tmdversion, System.Globalization.NumberStyles.HexNumber)); titleversion.Text = Convert.ToString(int.Parse(tmdversion, System.Globalization.NumberStyles.HexNumber));
// Read System Version (Needed IOS) //Read System Version (Needed IOS)
string sysversion = ""; string sysversion = IOSNeededFromTMD(tmd);
for (int i = 0; i < 8; i++)
{
sysversion += MakeProperLength(ConvertToHex(Convert.ToString(tmd[0x184 + i])));
}
sysversion = Convert.ToString(int.Parse(sysversion.Substring(14, 2), System.Globalization.NumberStyles.HexNumber));
if (sysversion != "0") if (sysversion != "0")
WriteStatus("Requires: IOS" + sysversion); WriteStatus("Requires: IOS" + sysversion);
@ -792,7 +819,7 @@ namespace NUS_Downloader
// Create decrypted file // Create decrypted file
string zeros = "000000"; string zeros = "000000";
FileStream decfs = new FileStream(titledirectory + @"\" + zeros + i.ToString("X2") + ".app", FileMode.Create); FileStream decfs = new FileStream(RemoveIllegalCharacters(titledirectory + @"\" + zeros + i.ToString("X2") + ".app"), 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();
WriteStatus(" - Decrypted: " + zeros + i.ToString("X2") + ".app"); WriteStatus(" - Decrypted: " + zeros + i.ToString("X2") + ".app");
@ -830,6 +857,9 @@ namespace NUS_Downloader
tmdversiontrucha.Text = Convert.ToString((tmd[0x1DC]*256) + tmd[0x1DD]); tmdversiontrucha.Text = Convert.ToString((tmd[0x1DC]*256) + tmd[0x1DD]);
newtitleidbox.Text = titleid; newtitleidbox.Text = titleid;
// Add contents to contentEdit...
FillContentInfo(tmd);
// Setup for NO IOS // Setup for NO IOS
if (requiredIOSbox.Text == "0") if (requiredIOSbox.Text == "0")
requiredIOSbox.Enabled = false; requiredIOSbox.Enabled = false;
@ -1030,7 +1060,7 @@ namespace NUS_Downloader
wadnamebox.Text = wadnamebox.Text.Replace("[v]", "v" + titleversion.Text); wadnamebox.Text = wadnamebox.Text.Replace("[v]", "v" + titleversion.Text);
// Create wad file // Create wad file
FileStream wadfs = new FileStream(totaldirectory + @"\" + wadnamebox.Text, FileMode.Create); FileStream wadfs = new FileStream(RemoveIllegalCharacters(totaldirectory + @"\" + wadnamebox.Text), FileMode.Create);
// Add wad stuffs // Add wad stuffs
WADHeader wad = new WADHeader(); WADHeader wad = new WADHeader();
@ -1257,7 +1287,7 @@ namespace NUS_Downloader
currentdir += Path.DirectorySeparatorChar; currentdir += Path.DirectorySeparatorChar;
// Create certs file // Create certs file
FileStream certsfs = new FileStream(currentdir + @"\cert.sys", FileMode.Create); FileStream certsfs = new FileStream(RemoveIllegalCharacters(currentdir + @"\cert.sys"), FileMode.Create);
// Getting it from SystemMenu 3.2 // Getting it from SystemMenu 3.2
DownloadNUSFile("0000000100000002", "tmd.289", currentdir + @"\", 0, true); DownloadNUSFile("0000000100000002", "tmd.289", currentdir + @"\", 0, true);
@ -1498,7 +1528,6 @@ namespace NUS_Downloader
string titleID = ""; string titleID = "";
string descname = ""; string descname = "";
string stticket = "";
bool dangerous = false; bool dangerous = false;
bool ticket = true; bool ticket = true;
@ -1547,7 +1576,7 @@ namespace NUS_Downloader
break; break;
} }
XMLToolStripItem.Image = SelectItemImage(ticket, dangerous); XMLToolStripItem.Image = SelectItemImage(ticket, dangerous);
XMLToolStripItem.Text = titleID + " " + stticket + " " + descname;
XMLToolStripItem.Text = String.Format("{0} - {1}", titleID, descname); XMLToolStripItem.Text = String.Format("{0} - {1}", titleID, descname);
} }
AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes); AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes);
@ -1792,6 +1821,17 @@ namespace NUS_Downloader
titleidbox.Text = titleidbox.Text.Substring(0, 14) + e.ClickedItem.Text.Substring(0, 2); titleidbox.Text = titleidbox.Text.Substring(0, 14) + e.ClickedItem.Text.Substring(0, 2);
} }
private string RemoveIllegalCharacters(string databasestr)
{
// Database strings must contain filename-legal characters.
foreach (char illegalchar in System.IO.Path.GetInvalidFileNameChars())
{
if (databasestr.Contains(illegalchar.ToString()))
databasestr = databasestr.Replace(illegalchar, '-');
}
return databasestr;
}
private byte[] ZeroSignature(byte[] tmdortik) private byte[] ZeroSignature(byte[] tmdortik)
{ {
// Write all 0x00 to signature... // Write all 0x00 to signature...
@ -1970,7 +2010,7 @@ namespace NUS_Downloader
tmd = ZeroSignature(tmd); tmd = ZeroSignature(tmd);
tmd = TruchaSign(tmd); tmd = TruchaSign(tmd);
FileStream testtmd = new FileStream(fileinfo[0] + fileinfo[1], FileMode.Open); FileStream testtmd = new FileStream(RemoveIllegalCharacters(fileinfo[0] + fileinfo[1]), FileMode.Open);
testtmd.Write(tmd, 0, tmd.Length); testtmd.Write(tmd, 0, tmd.Length);
testtmd.Close(); testtmd.Close();
} }
@ -2017,7 +2057,7 @@ namespace NUS_Downloader
byte[] limitseconds = new byte[4]; byte[] limitseconds = new byte[4];
limitseconds = InttoByteArray(Convert.ToInt32(timelimitsecs.Text), 4); limitseconds = InttoByteArray(Convert.ToInt32(timelimitsecs.Text), 4);
//DEBUG //DEBUG
WriteStatus(DisplayBytes(limitseconds, " ")); //WriteStatus(DisplayBytes(limitseconds, " "));
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
cetkbuff[0x248 + i] = limitseconds[i]; cetkbuff[0x248 + i] = limitseconds[i];
@ -2028,7 +2068,7 @@ namespace NUS_Downloader
cetkbuff = TruchaSign(cetkbuff); cetkbuff = TruchaSign(cetkbuff);
// Write changes to cetk. // Write changes to cetk.
FileStream testtik = new FileStream(fileinfo[0] + "cetk", FileMode.Open); FileStream testtik = new FileStream(RemoveIllegalCharacters(fileinfo[0] + "cetk"), FileMode.Open);
testtik.Write(cetkbuff, 0, cetkbuff.Length); testtik.Write(cetkbuff, 0, cetkbuff.Length);
testtik.Close(); testtik.Close();
} }
@ -2129,6 +2169,196 @@ namespace NUS_Downloader
wadnamebox.Text = titleidbox.Text + "-NUS-[v]" + titleversion.Text + ".wad"; wadnamebox.Text = titleidbox.Text + "-NUS-[v]" + titleversion.Text + ".wad";
} }
} }
wadnamebox.Text = RemoveIllegalCharacters(wadnamebox.Text);
} }
// This is WIP code/theory...
private byte[] GenerateTicket(byte[] EncTitleKey, byte[] TitleID)
{
byte[] Ticket = new byte[0x2A4];
// RSA Signature Heading...
Ticket[1] = 0x01; Ticket[3] = 0x01;
// Signature Issuer... (Root-CA00000001-XS00000003)
byte[] SignatureIssuer = new byte[0x1A] { 0x52, 0x6F, 0x6F, 0x74, 0x2D, 0x43, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x2D, 0x58, 0x53, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33 };
for (int a = 0; a < 0x40; a++)
{
Ticket[0x140 + a] = SignatureIssuer[a];
}
// Encrypted TitleKey...
for (int b = 0; b < 0x10; b++)
{
Ticket[0x1BF + b] = EncTitleKey[b];
}
// Ticket ID...
for (int c = 0; c < 0x08; c++)
{
Ticket[0x1D0 + c] = 0x49;
}
// Title ID...
for (int d = 0; d < 0x08; d++)
{
Ticket[0x1DC + d] = TitleID[d];
}
// Misc FF...
Ticket[0x1E4] = 0xFF; Ticket[0x1E5] = 0xFF;
Ticket[0x1E6] = 0xFF; Ticket[0x1E7] = 0xFF;
// Unknown 0x01...
Ticket[0x221] = 0x01;
// Misc FF...
for (int e = 0; e < 0x20; e++)
{
Ticket[0x222 + e] = 0xFF;
}
return Ticket;
}
private void button15_Click(object sender, EventArgs e)
{
// Read Content info from TMD again (revert)
string[] fileinfo = shamelessvariablelabel.Text.Split(',');
// Read the tmd as a stream...
byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]);
FillContentInfo(tmd);
}
private void FillContentInfo(byte[] tmd)
{
// Clear anything existing...
contentsEdit.Items.Clear();
// # of Contents and BootIndex
int nbr_cont = ContentCount(tmd);
int boot_idx = BootIndex(tmd);
string[] tmdcontents = GetContentNames(tmd, nbr_cont);
byte[] tmdindices = GetContentIndices(tmd, nbr_cont);
// Loop and add contents to listbox...
for (int a = 0; a < nbr_cont; a++)
{
contentsEdit.Items.Add(String.Format("[{0}] [{1}]", tmdindices[a], tmdcontents[a]));
}
// Identify Boot Content...
contentsEdit.Items[boot_idx] += " [BOOT]";
}
private void button8_Click(object sender, EventArgs e)
{
// Move selected content upwards (down an index)...
if (contentsEdit.SelectedIndex <= 0)
return;
int sel_idx = contentsEdit.SelectedIndex;
string sel_item = contentsEdit.Items[sel_idx].ToString();
string lower_item = contentsEdit.Items[sel_idx - 1].ToString();
contentsEdit.Items[sel_idx] = String.Format("[{0}]{1}", sel_idx, lower_item.Substring(3, lower_item.Length - 3));
contentsEdit.Items[sel_idx - 1] = String.Format("[{0}]{1}", sel_idx - 1, sel_item.Substring(3, sel_item.Length - 3));
contentsEdit.SelectedIndex = sel_idx - 1;
}
private void button9_Click(object sender, EventArgs e)
{
// Move selected content down (up an index)...
if (contentsEdit.SelectedIndex >= contentsEdit.Items.Count - 1)
return;
int sel_idx = contentsEdit.SelectedIndex;
string sel_item = contentsEdit.Items[sel_idx].ToString();
string upper_item = contentsEdit.Items[sel_idx + 1].ToString();
contentsEdit.Items[sel_idx] = String.Format("[{0}]{1}", sel_idx, upper_item.Substring(3, upper_item.Length - 3));
contentsEdit.Items[sel_idx + 1] = String.Format("[{0}]{1}", sel_idx + 1, sel_item.Substring(3, sel_item.Length - 3));
contentsEdit.SelectedIndex = sel_idx + 1;
}
private void button12_Click(object sender, EventArgs e)
{
// Set a new boot index...
if (contentsEdit.SelectedIndex <= 0)
return;
for (int a = 0; a < contentsEdit.Items.Count; a++)
{
if (contentsEdit.Items[a].ToString().Contains(" [BOOT]"))
contentsEdit.Items[a] = contentsEdit.Items[a].ToString().Substring(0, contentsEdit.Items[a].ToString().Length - 7);
}
contentsEdit.Items[contentsEdit.SelectedIndex] += " [BOOT]";
}
private void button11_Click(object sender, EventArgs e)
{
// Add a file to the contents...
OpenFileDialog opencont = new OpenFileDialog();
opencont.Filter = "All Files|*";
opencont.Multiselect = false;
opencont.Title = "Locate a Content";
if (opencont.ShowDialog() != DialogResult.Cancel)
{
if ((opencont.SafeFileName.Length != 8) && (OnlyHexInString(opencont.SafeFileName) == false))
{
MessageBox.Show("Please locate/rename a file to be (8 HEX CHARACTERS) long!", "Bad!", MessageBoxButtons.OK);
return;
}
for (int i = 0; i < contentsEdit.Items.Count; i++)
{
if (contentsEdit.Items[i].ToString().Contains(opencont.SafeFileName))
{
MessageBox.Show("A file already exists in the title with that filename!", "Bad!", MessageBoxButtons.OK);
return;
}
}
// D: TODO?
string[] fileinfo = shamelessvariablelabel.Text.Split(',');
if (fileinfo[0] + opencont.SafeFileName != opencont.FileName)
{
// Move the file into the directory...
File.Copy(opencont.FileName, fileinfo[0] + opencont.SafeFileName);
}
contentsEdit.Items.Add(String.Format("[{0}] [{1}]", contentsEdit.Items.Count, opencont.SafeFileName));
}
}
public bool OnlyHexInString(string test)
{
return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
}
private void button10_Click(object sender, EventArgs e)
{
// Remove a content from the list...
if ((contentsEdit.SelectedIndex <= 0) || (contentsEdit.Items.Count <= 1))
return;
string[] fileinfo = shamelessvariablelabel.Text.Split(',');
DialogResult question = MessageBox.Show("Delete the actual file as well?", "Delete content?", MessageBoxButtons.YesNoCancel);
if (question == DialogResult.Yes)
File.Delete(fileinfo[0] + contentsEdit.SelectedItem.ToString().Substring(contentsEdit.SelectedItem.ToString().IndexOf("] [") + 3, 8));
if (question != DialogResult.Cancel)
contentsEdit.Items.RemoveAt(contentsEdit.SelectedIndex);
}
} }
} }

View File

@ -102,6 +102,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="direction_down.ico" /> <Content Include="direction_down.ico" />
<None Include="Resources\bug_add.png" />
<None Include="Resources\arrow_down.png" />
<None Include="Resources\arrow_up.png" />
<None Include="Resources\connect.png" />
<None Include="Resources\package_add.png" />
<None Include="Resources\package_delete.png" />
<None Include="Resources\pencil.png" />
<None Include="Resources\bullet_redgreen.png" /> <None Include="Resources\bullet_redgreen.png" />
<None Include="Resources\bullet_green.png" /> <None Include="Resources\bullet_green.png" />
<None Include="Resources\bullet_redorange.png" /> <None Include="Resources\bullet_redorange.png" />

View File

@ -60,6 +60,27 @@ namespace NUS_Downloader.Properties {
} }
} }
internal static System.Drawing.Bitmap arrow_down {
get {
object obj = ResourceManager.GetObject("arrow_down", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap arrow_up {
get {
object obj = ResourceManager.GetObject("arrow_up", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap bug_add {
get {
object obj = ResourceManager.GetObject("bug_add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap bullet_green { internal static System.Drawing.Bitmap bullet_green {
get { get {
object obj = ResourceManager.GetObject("bullet_green", resourceCulture); object obj = ResourceManager.GetObject("bullet_green", resourceCulture);
@ -95,6 +116,13 @@ namespace NUS_Downloader.Properties {
} }
} }
internal static System.Drawing.Bitmap connect {
get {
object obj = ResourceManager.GetObject("connect", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap dsi { internal static System.Drawing.Bitmap dsi {
get { get {
object obj = ResourceManager.GetObject("dsi", resourceCulture); object obj = ResourceManager.GetObject("dsi", resourceCulture);
@ -102,6 +130,20 @@ namespace NUS_Downloader.Properties {
} }
} }
internal static System.Drawing.Bitmap package_add {
get {
object obj = ResourceManager.GetObject("package_add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap package_delete {
get {
object obj = ResourceManager.GetObject("package_delete", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap wilolgoi { internal static System.Drawing.Bitmap wilolgoi {
get { get {
object obj = ResourceManager.GetObject("wilolgoi", resourceCulture); object obj = ResourceManager.GetObject("wilolgoi", resourceCulture);

View File

@ -139,4 +139,22 @@
<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">
<value>..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</data>
<data name="connect" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\connect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="package_add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\package_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="package_delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\package_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bug_add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bug_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

136
NUSDTEST/AuthoringTests.txt Normal file
View File

@ -0,0 +1,136 @@
==========================================================================
Visual Studio Team System: Overview of Authoring and Running Tests
==========================================================================
This overview describes the features for authoring and running tests in
Visual Studio Team System and Visual Studio Team Edition for Software Testers.
Opening Tests
-------------
To open a test, open a test project or a test metadata file (a file with
extension .vsmdi) that contains the definition of the test. You can find
test projects and metadata files in Solution Explorer.
Viewing Tests
-------------
To see which tests are available to you, open the Test View window. Or,
if you have installed Team Edition for Software Testers, you can also open
the Test List Editor window to view tests.
To open the Test View window, click the Test menu, point to Windows, and
then click Test View. To open the Test List Editor window (if you have
installed Team Edition for Software Testers), click Test, point to Windows,
and then click Test List Editor.
Running Tests
-------------
You can run tests from the Test View window and the Test List Editor window.
See Viewing Tests to learn how to open these windows. To run one or more
tests displayed in the Test View window, first select the tests in that
window; to select multiple tests, hold either the Shift or CTRL key while
clicking tests. Then click the Run Tests button in the Test View window
toolbar.
If you have installed Visual Studio Team Edition for Software Testers, you can
also use the Test List Editor window to run tests. To run tests in Test List Editor,
select the check box next to each test that you want to run. Then click the
Run Tests button in the Test List Editor window toolbar.
Viewing Test Results
--------------------
When you run a test or a series of tests, the results of the test run will be
shown in the Test Results window. Each individual test in the run is shown on
a separate line so that you can see its status. The window contains an
embedded status bar in the top half of the window that provides you with
summary details of the complete test run.
To see more detailed results for a particular test result, double-click it in
the Test Results window. This opens a window that provides more information
about the particular test result, such as any specific error messages returned
by the test.
Changing the way that tests are run
-----------------------------------
Each time you run one or more tests, a collection of settings is used to
determine how those tests are run. These settings are contained in a “test
run configuration” file.
Here is a partial list of the changes you can make with a test run
configuration file:
- Change the naming scheme for each test run.
- Change the test controller that the tests are run on so that you can run
tests remotely.
- Gather code coverage data for the code being tested so that you can see
which lines of code are covered by your tests.
- Enable and disable test deployment.
- Specify additional files to deploy before tests are run.
- Select a different host, ASP.NET, for running ASP.NET unit tests.
- Select a different host, the smart device test host, for running smart device unit tests.
- Set various properties for the test agents that run your tests.
- Run custom scripts at the start and end of each test run so that you can
set up the test environment exactly as required each time tests are run.
- Set time limits for tests and test runs.
- Set the browser mix and the number of times to repeat Web tests in the
test run.
By default, a test run configuration file is created whenever you create a
new test project. You make changes to this file by double-clicking it in
Solution Explorer and then changing its settings. (Test run configuration
files have the extension .testrunconfig.)
A solution can contain multiple test run configuration files. Only one of
those files, known as the “Active” test run configuration file, is used to
determine the settings that are currently used for test runs. You select
the active test run configuration by clicking Select Active Test Run
Configuration on the Test menu.
-------------------------------------------------------------------------------
Test Types
----------
Using Visual Studio Team Edition for Software Testers, you can create a number
of different test types:
Unit test: Use a unit test to create a programmatic test in C++, Visual C# or
Visual Basic that exercises source code. A unit test calls the methods of a
class, passing suitable parameters, and verifies that the returned value is
what you expect.
There are three specialized variants of unit tests:
- Data-driven unit tests are created when you configure a unit test to be
called repeatedly for each row of a data source. The data from each row
is used by the unit test as input data.
- ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web
application.
- Smart device unit tests are unit tests that are deployed to a smart device
or emulator and then executed by the smart device test host.
Web Test: Web tests consist of an ordered series of HTTP requests that you
record in a browser session using Microsoft Internet Explorer. You can have
the test report specific details about the pages or sites it requests, such
as whether a particular page contains a specified string.
Load Test: You use a load test to encapsulate non-manual tests, such as
unit, Web, and generic tests, and then run them simultaneously by using
virtual users. Running these tests under load generates test results,
including performance and other counters, in tables and in graphs.
Generic test: A generic test is an existing program wrapped to function as a
test in Visual Studio. The following are examples of tests or programs that
you can turn into generic tests:
- An existing test that uses process exit codes to communicate whether the
test passed or failed. 0 indicates passing and any other value indicates
a failure.
- A general program to obtain specific functionality during a test scenario.
- A test or program that uses a special XML file (called a “summary results
file”), to communicate detailed results.
Manual test: The manual test type is used when the test tasks are to be
completed by a test engineer as opposed to an automated script.
Ordered test: Use an ordered test to execute a set of tests in an order you
specify.
-------------------------------------------------------------------------------

1055
NUSDTEST/Form1Test.cs Normal file

File diff suppressed because it is too large Load Diff

72
NUSDTEST/NUSDTEST.csproj Normal file
View File

@ -0,0 +1,72 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BC13EE75-CAC3-4CB4-A67F-C8B3CCDFD63B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NUSDTEST</RootNamespace>
<AssemblyName>NUSDTEST</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1Test.cs" />
<Compile Include="ProgramTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourcesTest.cs" />
<Compile Include="SettingsTest.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="AuthoringTests.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NUS Downloader\NUS Downloader.csproj">
<Project>{DB1289FA-BA83-408F-A576-326E5EC4CC6D}</Project>
<Name>NUS Downloader</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Shadow Include="Test References\NUS Downloader.accessor" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

77
NUSDTEST/ProgramTest.cs Normal file
View File

@ -0,0 +1,77 @@
using NUS_Downloader;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NUSDTEST
{
/// <summary>
///This is a test class for ProgramTest and is intended
///to contain all ProgramTest Unit Tests
///</summary>
[TestClass()]
public class ProgramTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Main
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void MainTest()
{
string[] args = null; // TODO: Initialize to an appropriate value
Program_Accessor.Main(args);
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}
}
}

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NUSDTEST")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NUSDTEST")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21ad20c3-5bda-47ed-875a-bd7274986e95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

185
NUSDTEST/ResourcesTest.cs Normal file
View File

@ -0,0 +1,185 @@
using NUS_Downloader.Properties;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NUSDTEST
{
/// <summary>
///This is a test class for ResourcesTest and is intended
///to contain all ResourcesTest Unit Tests
///</summary>
[TestClass()]
public class ResourcesTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for wilolgoi
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void wilolgoiTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for ResourceManager
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void ResourceManagerTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for dsi
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void dsiTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for Culture
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void CultureTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for bullet_redorange
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void bullet_redorangeTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for bullet_redgreen
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void bullet_redgreenTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for bullet_red
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void bullet_redTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for bullet_orange
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void bullet_orangeTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for bullet_green
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void bullet_greenTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for Resources Constructor
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void ResourcesConstructorTest()
{
// Private Accessor for NUS_Downloader.Properties.Resources is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Resources is not found. Please reb" +
"uild the containing project or run the Publicize.exe manually.");
}
}
}

89
NUSDTEST/SettingsTest.cs Normal file
View File

@ -0,0 +1,89 @@
using NUS_Downloader.Properties;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NUSDTEST
{
/// <summary>
///This is a test class for SettingsTest and is intended
///to contain all SettingsTest Unit Tests
///</summary>
[TestClass()]
public class SettingsTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Default
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void DefaultTest()
{
// Private Accessor for NUS_Downloader.Properties.Settings is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Settings is not found. Please rebu" +
"ild the containing project or run the Publicize.exe manually.");
}
/// <summary>
///A test for Settings Constructor
///</summary>
[TestMethod()]
[DeploymentItem("NUS Downloader.exe")]
public void SettingsConstructorTest()
{
// Private Accessor for NUS_Downloader.Properties.Settings is not found. Please rebuild the containing project or run the Publicize.exe manually.
Assert.Inconclusive("Private Accessor for NUS_Downloader.Properties.Settings is not found. Please rebu" +
"ild the containing project or run the Publicize.exe manually.");
}
}
}

View File

@ -0,0 +1,2 @@
NUS Downloader.exe
Desktop