Removing some redundancy

This commit is contained in:
Kurt 2014-12-10 23:00:25 -08:00
parent a99ddf11bf
commit 84fd7f4da9
4 changed files with 47 additions and 47 deletions

View file

@ -140,7 +140,7 @@ namespace PKHeX
for (int i = 0; i < newdata.Length / 4; i++)
{
RTB_Code.AppendText((writeoffset + i * 4 + 0x20000000).ToString("X8") + " ");
RTB_Code.AppendText(BitConverter.ToUInt32(newdata,i*4).ToString("X8") + System.Environment.NewLine);
RTB_Code.AppendText(BitConverter.ToUInt32(newdata,i*4).ToString("X8") + Environment.NewLine);
}
// Mat's Code - Unfinished
@ -150,7 +150,7 @@ namespace PKHeX
// RTB_Code.AppendText("00000001 "); // 01 00 00 00
// RTB_Code.AppendText((writeoffset + i * 4).ToString("X8") + " ");
// RTB_Code.AppendText(BitConverter.ToUInt32(newdata,i*4).ToString("X8") + System.Environment.NewLine);
// RTB_Code.AppendText(BitConverter.ToUInt32(newdata,i*4).ToString("X8") + Environment.NewLine);
//}
}
private void B_Clear_Click(object sender, EventArgs e)
@ -184,7 +184,7 @@ namespace PKHeX
{
RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 0 * 4).ToString("X8") + " ");
RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 1 * 4).ToString("X8") + " ");
RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 2 * 4).ToString("X8") + System.Environment.NewLine);
RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 2 * 4).ToString("X8") + Environment.NewLine);
}
}
}
@ -261,11 +261,11 @@ namespace PKHeX
if (BitConverter.ToUInt32(cybersav, i) != BitConverter.ToUInt32(newcyber, i))
{
result += ((0x20000000 + i).ToString("X8") + " ");
result += (BitConverter.ToUInt32(newcyber, i).ToString("X8") + System.Environment.NewLine);
result += (BitConverter.ToUInt32(newcyber, i).ToString("X8") + Environment.NewLine);
lines++;
if ((lines % 128 == 0) && CHK_Break.Checked)
{ result += ("\n--- Segment " + (lines / 128 + 1).ToString() + " ---" + System.Environment.NewLine + System.Environment.NewLine); }
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + Environment.NewLine + Environment.NewLine); }
if (lines > 10000) goto toomany;
}
}
@ -280,11 +280,11 @@ namespace PKHeX
for (int z = 0; z < newdata.Length; z += 4)
{
result += ((0x20000000 + i + z).ToString("X8") + " ");
result += (BitConverter.ToUInt32(newdata, z).ToString("X8") + System.Environment.NewLine);
result += (BitConverter.ToUInt32(newdata, z).ToString("X8") + Environment.NewLine);
lines++;
if ((lines % 128 == 0) && CHK_Break.Checked)
{ result += ("\n--- Segment " + (lines / 128 + 1).ToString() + " ---" + System.Environment.NewLine + System.Environment.NewLine); }
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + Environment.NewLine + Environment.NewLine); }
if (lines > 10000) goto toomany;
}
}
@ -294,11 +294,11 @@ namespace PKHeX
if (cybersav[0x14818] != newcyber[0x14818])
{
result += ((0x00000000 + 0x14818).ToString("X8") + " ");
result += (newcyber[0x14818].ToString("X8") + System.Environment.NewLine);
result += (newcyber[0x14818].ToString("X8") + Environment.NewLine);
lines++;
if ((lines % 128 == 0) && CHK_Break.Checked)
{ result += (System.Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + System.Environment.NewLine + System.Environment.NewLine); }
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + Environment.NewLine + Environment.NewLine); }
if (lines > 10000) goto toomany;
}
@ -312,11 +312,11 @@ namespace PKHeX
for (int z = 0; z < newdata.Length; z += 4)
{
result += ((0x20000000 + i + z).ToString("X8") + " ");
result += (BitConverter.ToUInt32(newdata, z).ToString("X8") + System.Environment.NewLine);
result += (BitConverter.ToUInt32(newdata, z).ToString("X8") + Environment.NewLine);
lines++;
if ((lines % 128 == 0) && CHK_Break.Checked)
{ result += (System.Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + System.Environment.NewLine + System.Environment.NewLine); }
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + Environment.NewLine + Environment.NewLine); }
if (lines > 10000) goto toomany;
}
}

View file

@ -365,19 +365,19 @@ namespace PKHeX
internal static DialogResult Error(params string[] lines)
{
System.Media.SystemSounds.Exclamation.Play();
string msg = String.Join(System.Environment.NewLine + System.Environment.NewLine, lines);
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
return (DialogResult)MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
internal static DialogResult Alert(params string[] lines)
{
System.Media.SystemSounds.Asterisk.Play();
string msg = String.Join(System.Environment.NewLine + System.Environment.NewLine, lines);
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
return (DialogResult)MessageBox.Show(msg, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
internal static DialogResult Prompt(MessageBoxButtons btn, params string[] lines)
{
System.Media.SystemSounds.Question.Play();
string msg = String.Join(System.Environment.NewLine + System.Environment.NewLine, lines);
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
return (DialogResult)MessageBox.Show(msg, "Prompt", btn, MessageBoxIcon.Asterisk);
}
}

View file

@ -2734,7 +2734,7 @@ namespace PKHeX
}
#endregion
else
Util.Error("Attempted to load an unsupported file type/size.", "File Loaded:" + System.Environment.NewLine + path);
Util.Error("Attempted to load an unsupported file type/size.", "File Loaded:" + Environment.NewLine + path);
}
private void openMAIN(byte[] input, string path, string GameType, bool oras)
{
@ -3262,10 +3262,10 @@ namespace PKHeX
if (checksum != actualsum)
{
invalid1++;
RTB_S.Text += "Invalid: " + i.ToString("X2") + " @ region " + start[i].ToString("X5") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + i.ToString("X2") + " @ region " + start[i].ToString("X5") + Environment.NewLine;
}
}
RTB_S.Text += "1st SAV: " + (start.Length - invalid1).ToString() + "/" + start.Length.ToString() + System.Environment.NewLine;
RTB_S.Text += "1st SAV: " + (start.Length - invalid1).ToString() + "/" + start.Length.ToString() + Environment.NewLine;
if (cybergadget) return;
@ -3285,10 +3285,10 @@ namespace PKHeX
if (checksum != actualsum)
{
invalid2++;
RTB_S.Text += "Invalid: " + i.ToString("X2") + " @ region " + start[i].ToString("X5") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + i.ToString("X2") + " @ region " + start[i].ToString("X5") + Environment.NewLine;
}
}
RTB_S.Text += "2nd SAV: " + (start.Length - invalid2).ToString() + "/" + start.Length.ToString() + System.Environment.NewLine;
RTB_S.Text += "2nd SAV: " + (start.Length - invalid2).ToString() + "/" + start.Length.ToString() + Environment.NewLine;
if (invalid1 + invalid2 == (start.Length * 2))
RTB_S.Text = "No checksums are valid.";
}
@ -3430,10 +3430,10 @@ namespace PKHeX
if (!hashValue.SequenceEqual(actualhash))
{
invalid1++;
RTB_S.Text += "Invalid: " + hashtabledata[2 + 4 * i].ToString("X5") + " @ " + hashtabledata[0 + 4 * i].ToString("X5") + "-" + hashtabledata[1 + 4 * i].ToString("X5") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + hashtabledata[2 + 4 * i].ToString("X5") + " @ " + hashtabledata[0 + 4 * i].ToString("X5") + "-" + hashtabledata[1 + 4 * i].ToString("X5") + Environment.NewLine;
}
}
RTB_S.Text += "1st SAV: " + (106 - invalid1).ToString() + "/" + 106.ToString() + System.Environment.NewLine;
RTB_S.Text += "1st SAV: " + (106 - invalid1).ToString() + "/" + 106.ToString() + Environment.NewLine;
// Check The Second Half of Hashes
for (int i = 0; i < hashtabledata.Length; i += 4)
@ -3466,13 +3466,13 @@ namespace PKHeX
if (!hashValue.SequenceEqual(actualhash))
{
invalid2++;
RTB_S.Text += "Invalid: " + hashtabledata[2 + 4 * i].ToString("X5") + " @ " + hashtabledata[0 + 4 * i].ToString("X5") + "-" + hashtabledata[1 + 4 * i].ToString("X5") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + hashtabledata[2 + 4 * i].ToString("X5") + " @ " + hashtabledata[0 + 4 * i].ToString("X5") + "-" + hashtabledata[1 + 4 * i].ToString("X5") + Environment.NewLine;
}
}
RTB_S.Text += "2nd SAV: " + (106 - invalid2).ToString() + "/" + 106.ToString() + System.Environment.NewLine;
RTB_S.Text += "2nd SAV: " + (106 - invalid2).ToString() + "/" + 106.ToString() + Environment.NewLine;
if (invalid1 + invalid2 == (2 * 106))
RTB_S.Text = "None of the IVFC hashes are valid." + System.Environment.NewLine;
RTB_S.Text = "None of the IVFC hashes are valid." + Environment.NewLine;
// Check the Upper Level IVFC Hashes
{
@ -3483,7 +3483,7 @@ namespace PKHeX
Array.Copy(savefile, 0x43C, actualhash, 0, 0x20);
if (!hashValue.SequenceEqual(actualhash))
{
RTB_S.Text += "Invalid: " + 0x2000.ToString("X5") + " @ " + 0x43C.ToString("X3") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + 0x2000.ToString("X5") + " @ " + 0x43C.ToString("X3") + Environment.NewLine;
}
}
{
@ -3494,7 +3494,7 @@ namespace PKHeX
Array.Copy(savefile, 0x30C, actualhash, 0, 0x20);
if (!hashValue.SequenceEqual(actualhash))
{
RTB_S.Text += "Invalid: " + 0x81000.ToString("X5") + " @ " + 0x30C.ToString("X3") + System.Environment.NewLine;
RTB_S.Text += "Invalid: " + 0x81000.ToString("X5") + " @ " + 0x30C.ToString("X3") + Environment.NewLine;
}
}
{
@ -3768,7 +3768,7 @@ namespace PKHeX
if (section.SequenceEqual(FFFF))
{
string problem = String.Format("0x200 chunk @ 0x{0} is FF'd.", (i * 0x200).ToString("X5"))
+ System.Environment.NewLine + "Cyber will screw up (as of August 31st)." + System.Environment.NewLine + System.Environment.NewLine;
+ Environment.NewLine + "Cyber will screw up (as of August 31st)." + Environment.NewLine + Environment.NewLine;
// Check to see if it is in the Pokedex
if (i * 0x200 > 0x14E00 && i * 0x200 < 0x15700)
@ -4250,7 +4250,7 @@ namespace PKHeX
private void setSAVLabel()
{
L_SAVINDEX.Text = (savindex + 1).ToString();
RTB_S.AppendText("Loaded Save File " + (savindex + 1).ToString() + System.Environment.NewLine);
RTB_S.AppendText("Loaded Save File " + (savindex + 1).ToString() + Environment.NewLine);
}
private void getSAVOffsets()
{
@ -4394,7 +4394,7 @@ namespace PKHeX
}
private void Menu_DumpLoadBoxes_Click(object sender, EventArgs e)
{
DialogResult dr = Util.Prompt(MessageBoxButtons.YesNoCancel, "Press Yes to Import All from Folder." + System.Environment.NewLine + "Press No to Dump All to Folder.", "Press Cancel to Abort.");
DialogResult dr = Util.Prompt(MessageBoxButtons.YesNoCancel, "Press Yes to Import All from Folder." + Environment.NewLine + "Press No to Dump All to Folder.", "Press Cancel to Abort.");
if (dr != DialogResult.Cancel)
{
string exepath = System.Windows.Forms.Application.StartupPath;
@ -4706,7 +4706,7 @@ namespace PKHeX
private void B_OUTPasserby_Click(object sender, EventArgs e)
{
string result = "";
result += "PSS List" + System.Environment.NewLine + System.Environment.NewLine;
result += "PSS List" + Environment.NewLine + Environment.NewLine;
string[] headers = {
"PSS Data - Friends",
"PSS Data - Acquaintances",
@ -4715,7 +4715,7 @@ namespace PKHeX
int offset = savindex * 0x7F000 + SaveGame.PSS;
for (int g = 0; g < 3; g++)
{
result += "----" + System.Environment.NewLine + headers[g] + System.Environment.NewLine + "----" + System.Environment.NewLine + System.Environment.NewLine;
result += "----" + Environment.NewLine + headers[g] + Environment.NewLine + "----" + Environment.NewLine + Environment.NewLine;
uint count = BitConverter.ToUInt32(savefile,offset + 0x4E20);
int r_offset = offset;
@ -4751,14 +4751,14 @@ namespace PKHeX
gamename = "OR";
else gamename = "UNK GAME";
result +=
"OT: " + otname + System.Environment.NewLine +
"Message: " + message + System.Environment.NewLine +
"Game: " + gamename + System.Environment.NewLine +
"Country ID: " + country + System.Environment.NewLine +
"Region ID: " + region + System.Environment.NewLine +
"Favorite: " + specieslist[favpkm] + System.Environment.NewLine;
"OT: " + otname + Environment.NewLine +
"Message: " + message + Environment.NewLine +
"Game: " + gamename + Environment.NewLine +
"Country ID: " + country + Environment.NewLine +
"Region ID: " + region + Environment.NewLine +
"Favorite: " + specieslist[favpkm] + Environment.NewLine;
result += System.Environment.NewLine;
result += Environment.NewLine;
r_offset += 0xC8;
}
offset += 0x5000;

View file

@ -66,14 +66,14 @@ namespace PKHeX
string cardname = Util.TrimFromZero(Encoding.Unicode.GetString(wondercard_data, 0x2, 0x48));
int cardtype = wondercard_data[0x51];
string s = "";
s += "Card #: " + cardID.ToString("0000") + System.Environment.NewLine + cardname + System.Environment.NewLine + System.Environment.NewLine;
s += "Card #: " + cardID.ToString("0000") + Environment.NewLine + cardname + Environment.NewLine + Environment.NewLine;
if (cardtype == 1) // Item
{
int item = BitConverter.ToUInt16(wondercard_data, 0x68);
int qty = BitConverter.ToUInt16(wondercard_data, 0x70);
s += "Item: " + Form1.itemlist[item] + System.Environment.NewLine + "Quantity: " + qty.ToString();
s += "Item: " + Form1.itemlist[item] + Environment.NewLine + "Quantity: " + qty.ToString();
}
else if (cardtype == 0) // PKM
{
@ -88,13 +88,13 @@ namespace PKHeX
string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(wondercard_data, 0xB6, 22));
s +=
"Species: " + Form1.specieslist[species] + System.Environment.NewLine
+ "Item: " + Form1.itemlist[helditem] + System.Environment.NewLine
+ "Move 1: " + Form1.movelist[move1] + System.Environment.NewLine
+ "Move 2: " + Form1.movelist[move2] + System.Environment.NewLine
+ "Move 3: " + Form1.movelist[move3] + System.Environment.NewLine
+ "Move 4: " + Form1.movelist[move4] + System.Environment.NewLine
+ "OT: " + OTname + System.Environment.NewLine
"Species: " + Form1.specieslist[species] + Environment.NewLine
+ "Item: " + Form1.itemlist[helditem] + Environment.NewLine
+ "Move 1: " + Form1.movelist[move1] + Environment.NewLine
+ "Move 2: " + Form1.movelist[move2] + Environment.NewLine
+ "Move 3: " + Form1.movelist[move3] + Environment.NewLine
+ "Move 4: " + Form1.movelist[move4] + Environment.NewLine
+ "OT: " + OTname + Environment.NewLine
+ "ID: " + TID.ToString() + "/" + SID.ToString();
}
else