From 6ee3bc71f0db340c2522730adde75cdd4e073516 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 11 Jul 2014 18:39:24 -0700 Subject: [PATCH] minor updates removed 0x34 from 'extra bytes', removed species button in exchange for label clicking Species to set species name. --- f1-Main.Designer.cs | 91 ++++++++++------------ f1-Main.cs | 183 +++++++++++++++++++++++--------------------- f1-Main.resx | 3 - 3 files changed, 135 insertions(+), 142 deletions(-) diff --git a/f1-Main.Designer.cs b/f1-Main.Designer.cs index afe8f249e..61a2e38d4 100644 --- a/f1-Main.Designer.cs +++ b/f1-Main.Designer.cs @@ -36,7 +36,6 @@ public void InitializeComponent() this.CB_Ability = new System.Windows.Forms.ComboBox(); this.TB_PID = new System.Windows.Forms.TextBox(); this.TB_AbilityNumber = new System.Windows.Forms.MaskedTextBox(); - this.BTN_Shinytize = new System.Windows.Forms.Button(); this.CHK_Nicknamed = new System.Windows.Forms.CheckBox(); this.Label_Gender = new System.Windows.Forms.Label(); this.CB_Form = new System.Windows.Forms.ComboBox(); @@ -70,9 +69,10 @@ public void InitializeComponent() this.CB_Species = new System.Windows.Forms.ComboBox(); this.Label_EXP = new System.Windows.Forms.Label(); this.Label_Species = new System.Windows.Forms.Label(); - this.Label_PID = new System.Windows.Forms.Label(); - this.BTN_NickSpecies = new System.Windows.Forms.Button(); this.Label_HatchCounter = new System.Windows.Forms.Label(); + this.Label_IsShiny = new System.Windows.Forms.PictureBox(); + this.BTN_Shinytize = new System.Windows.Forms.Button(); + this.Label_PID = new System.Windows.Forms.Label(); this.Tab_Met = new System.Windows.Forms.TabPage(); this.CHK_AsEgg = new System.Windows.Forms.CheckBox(); this.CHK_Fateful = new System.Windows.Forms.CheckBox(); @@ -320,9 +320,9 @@ public void InitializeComponent() this.B_OpenPokedex = new System.Windows.Forms.Button(); this.GB_SAVtools = new System.Windows.Forms.GroupBox(); this.L_SAVINDEX = new System.Windows.Forms.Label(); - this.Label_IsShiny = new System.Windows.Forms.PictureBox(); this.tabMain.SuspendLayout(); this.Tab_Main.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit(); this.Tab_Met.SuspendLayout(); this.GB_EggConditions.SuspendLayout(); this.Tab_Stats.SuspendLayout(); @@ -404,7 +404,6 @@ public void InitializeComponent() this.Tab_Tools.SuspendLayout(); this.Tab_SAV.SuspendLayout(); this.GB_SAVtools.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit(); this.SuspendLayout(); // // tabMain @@ -461,7 +460,6 @@ public void InitializeComponent() this.Tab_Main.Controls.Add(this.CB_Species); this.Tab_Main.Controls.Add(this.Label_EXP); this.Tab_Main.Controls.Add(this.Label_Species); - this.Tab_Main.Controls.Add(this.BTN_NickSpecies); this.Tab_Main.Controls.Add(this.Label_HatchCounter); this.Tab_Main.Controls.Add(this.Label_IsShiny); this.Tab_Main.Controls.Add(this.BTN_Shinytize); @@ -522,16 +520,6 @@ public void InitializeComponent() this.TB_AbilityNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.TB_AbilityNumber.Visible = false; // - // BTN_Shinytize - // - this.BTN_Shinytize.Location = new System.Drawing.Point(30, 6); - this.BTN_Shinytize.Name = "BTN_Shinytize"; - this.BTN_Shinytize.Size = new System.Drawing.Size(26, 22); - this.BTN_Shinytize.TabIndex = 58; - this.BTN_Shinytize.Text = "☆"; - this.BTN_Shinytize.UseVisualStyleBackColor = true; - this.BTN_Shinytize.Click += new System.EventHandler(this.updateShinyPID); - // // CHK_Nicknamed // this.CHK_Nicknamed.Location = new System.Drawing.Point(5, 51); @@ -541,6 +529,7 @@ public void InitializeComponent() this.CHK_Nicknamed.Text = "Nickname:"; this.CHK_Nicknamed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.CHK_Nicknamed.UseVisualStyleBackColor = true; + this.CHK_Nicknamed.CheckedChanged += new System.EventHandler(this.updateNickname); // // Label_Gender // @@ -864,7 +853,7 @@ public void InitializeComponent() this.TB_Nickname.Location = new System.Drawing.Point(85, 49); this.TB_Nickname.MaxLength = 12; this.TB_Nickname.Name = "TB_Nickname"; - this.TB_Nickname.Size = new System.Drawing.Size(72, 20); + this.TB_Nickname.Size = new System.Drawing.Size(122, 20); this.TB_Nickname.TabIndex = 5; // // CB_Species @@ -898,26 +887,7 @@ public void InitializeComponent() this.Label_Species.TabIndex = 1; this.Label_Species.Text = "Species:"; this.Label_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // Label_PID - // - this.Label_PID.Location = new System.Drawing.Point(5, 11); - this.Label_PID.Name = "Label_PID"; - this.Label_PID.Size = new System.Drawing.Size(77, 13); - this.Label_PID.TabIndex = 0; - this.Label_PID.Text = "PID:"; - this.Label_PID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // BTN_NickSpecies - // - this.BTN_NickSpecies.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.BTN_NickSpecies.Location = new System.Drawing.Point(158, 48); - this.BTN_NickSpecies.Name = "BTN_NickSpecies"; - this.BTN_NickSpecies.Size = new System.Drawing.Size(50, 22); - this.BTN_NickSpecies.TabIndex = 6; - this.BTN_NickSpecies.Text = "Species"; - this.BTN_NickSpecies.UseVisualStyleBackColor = true; - this.BTN_NickSpecies.Click += new System.EventHandler(this.updateNicknameSpecies); + this.Label_Species.Click += new System.EventHandler(this.updateNickname); // // Label_HatchCounter // @@ -928,6 +898,37 @@ public void InitializeComponent() this.Label_HatchCounter.Text = "Hatch Counter:"; this.Label_HatchCounter.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // Label_IsShiny + // + this.Label_IsShiny.Image = global::PKHeX.Properties.Resources.rare_icon; + this.Label_IsShiny.InitialImage = global::PKHeX.Properties.Resources.rare_icon; + this.Label_IsShiny.Location = new System.Drawing.Point(33, 7); + this.Label_IsShiny.Name = "Label_IsShiny"; + this.Label_IsShiny.Size = new System.Drawing.Size(20, 20); + this.Label_IsShiny.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.Label_IsShiny.TabIndex = 62; + this.Label_IsShiny.TabStop = false; + this.Label_IsShiny.Visible = false; + // + // BTN_Shinytize + // + this.BTN_Shinytize.Location = new System.Drawing.Point(30, 6); + this.BTN_Shinytize.Name = "BTN_Shinytize"; + this.BTN_Shinytize.Size = new System.Drawing.Size(26, 22); + this.BTN_Shinytize.TabIndex = 58; + this.BTN_Shinytize.Text = "☆"; + this.BTN_Shinytize.UseVisualStyleBackColor = true; + this.BTN_Shinytize.Click += new System.EventHandler(this.updateShinyPID); + // + // Label_PID + // + this.Label_PID.Location = new System.Drawing.Point(5, 11); + this.Label_PID.Name = "Label_PID"; + this.Label_PID.Size = new System.Drawing.Size(77, 13); + this.Label_PID.TabIndex = 0; + this.Label_PID.Text = "PID:"; + this.Label_PID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // Tab_Met // this.Tab_Met.AllowDrop = true; @@ -2327,7 +2328,6 @@ public void InitializeComponent() this.CB_ExtraBytes.Items.AddRange(new object[] { "0x16", "0x17", - "0x34", "0x35", "0x36", "0x37", @@ -3777,18 +3777,6 @@ public void InitializeComponent() this.L_SAVINDEX.TabIndex = 16; this.L_SAVINDEX.Text = "0"; // - // Label_IsShiny - // - this.Label_IsShiny.Image = global::PKHeX.Properties.Resources.rare_icon; - this.Label_IsShiny.InitialImage = global::PKHeX.Properties.Resources.rare_icon; - this.Label_IsShiny.Location = new System.Drawing.Point(33, 7); - this.Label_IsShiny.Name = "Label_IsShiny"; - this.Label_IsShiny.Size = new System.Drawing.Size(20, 20); - this.Label_IsShiny.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.Label_IsShiny.TabIndex = 62; - this.Label_IsShiny.TabStop = false; - this.Label_IsShiny.Visible = false; - // // Form1 // this.AllowDrop = true; @@ -3812,6 +3800,7 @@ public void InitializeComponent() this.tabMain.ResumeLayout(false); this.Tab_Main.ResumeLayout(false); this.Tab_Main.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).EndInit(); this.Tab_Met.ResumeLayout(false); this.Tab_Met.PerformLayout(); this.GB_EggConditions.ResumeLayout(false); @@ -3908,7 +3897,6 @@ public void InitializeComponent() this.Tab_SAV.ResumeLayout(false); this.Tab_SAV.PerformLayout(); this.GB_SAVtools.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -4061,7 +4049,6 @@ public void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Infected; private System.Windows.Forms.ComboBox CB_Form; private System.Windows.Forms.Label Label_Gender; - private System.Windows.Forms.Button BTN_NickSpecies; private System.Windows.Forms.CheckBox CHK_Nicknamed; private System.Windows.Forms.Button BTN_Shinytize; private System.Windows.Forms.MaskedTextBox TB_AbilityNumber; diff --git a/f1-Main.cs b/f1-Main.cs index b91fc5e65..bf5842f10 100644 --- a/f1-Main.cs +++ b/f1-Main.cs @@ -216,6 +216,10 @@ public string TrimFromZero(string input) return input.Substring(0, index); } + private static string CleanFileName(string fileName) + { + return Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c.ToString(), string.Empty)); + } #region //// PKX WINDOW FUNCTIONS //// // Randomization // @@ -4101,7 +4105,7 @@ private void getIsShiny() Label_IsShiny.Visible = false; } - updateMarkings(); + getMarkings(); } private void getForms(int species) { @@ -4387,6 +4391,19 @@ private void getGenderLabel() } else { Label_Gender.Text = "-"; } } + private void getMarkings() + { + PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 }; + CheckBox[] cba = { CHK_Circle, CHK_Triangle, CHK_Square, CHK_Heart, CHK_Star, CHK_Diamond }; + for (int i = 0; i < 6; i++) + { + pba[i].Image = ImageTransparency.ChangeOpacity(pba[i].InitialImage, (float)(Convert.ToUInt16(cba[i].Checked)) * 0.9 + 0.1); + } + + PB_MarkShiny.Image = ImageTransparency.ChangeOpacity(PB_MarkShiny.InitialImage, (float)(Convert.ToUInt16(!BTN_Shinytize.Enabled)) * 0.9 + 0.1); + PB_MarkCured.Image = ImageTransparency.ChangeOpacity(PB_MarkCured.InitialImage, (float)(Convert.ToUInt16(CHK_Cured.Checked)) * 0.9 + 0.1); + PB_MarkPentagon.Image = ImageTransparency.ChangeOpacity(PB_MarkPentagon.InitialImage, (float)(Convert.ToUInt16(getIndex(CB_GameOrigin) == 24 || getIndex(CB_GameOrigin) == 25)) * 0.9 + 0.1); + } private int getMovePP(int move) { int pp = 0; @@ -4583,6 +4600,38 @@ private void Label_Gender_Click(object sender, EventArgs e) Label_Gender.Text = "♂"; } } + private void Label_PPups_Click(object sender, EventArgs e) + { + int index = 3; + if (ModifierKeys == Keys.Control) + { + index = 0; + } + CB_PPu1.SelectedIndex = CB_PPu2.SelectedIndex = CB_PPu3.SelectedIndex = CB_PPu4.SelectedIndex = index; + + } + private void Label_OTGender_Click(object sender, EventArgs e) + { + if (Label_OTGender.Text == "♂") + Label_OTGender.Text = "♀"; + else Label_OTGender.Text = "♂"; + } + private void Label_CTGender_Click(object sender, EventArgs e) + { + if (Label_CTGender.Text == "") return; + else if (Label_CTGender.Text == "♂") + Label_CTGender.Text = "♀"; + else Label_CTGender.Text = "♂"; + } + private void Marking_Click(object sender, EventArgs e) + { + PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 }; + CheckBox[] cba = { CHK_Circle, CHK_Triangle, CHK_Square, CHK_Heart, CHK_Star, CHK_Diamond }; + + CheckBox cb = cba[Array.IndexOf(pba, sender as PictureBox)]; + cb.Checked = !cb.Checked; + getMarkings(); + } // Prompted Updates of PKX Functions // public static string RemoveTroublesomeCharacters(TextBox tb) { @@ -5080,7 +5129,7 @@ private void updateSpecies(object sender, EventArgs e) // If species changes and no nickname, set the new name == speciesName. if (!CHK_Nicknamed.Checked) - updateNicknameSpecies(sender, e); + updateNickname(sender, e); } private void updateOriginGame(object sender, EventArgs e) { @@ -5103,7 +5152,7 @@ private void updateOriginGame(object sender, EventArgs e) CB_EncounterType.SelectedIndex = 0; } updateLocations(gameorigin); - updateMarkings(); + getMarkings(); } private void updateLocations(int gameorigin) { @@ -5445,6 +5494,39 @@ private void updateExtraByteIndex(object sender, EventArgs e) // Byte changed, need to refresh the Text box for the byte's value. TB_ExtraByte.Text = buff[offset].ToString(); } + private void updateNickname(object sender, EventArgs e) + { + + if (!CHK_Nicknamed.Checked) + { + // Fetch Current Species and set it as Nickname Text + int species = getIndex(CB_Species); + if (species == 0 || species > 721) + { + TB_Nickname.Text = ""; + } + else + { + // get language + int lang = getIndex(CB_Language); + string[] lang_val = { "en", "ja", "fr", "it", "de", "es", "ko" }; + + string l = ""; + switch (lang) + { + case 1: l = "ja"; break; + case 2: l = "en"; break; + case 3: l = "fr"; break; + case 4: l = "it"; break; + case 5: l = "de"; break; + case 7: l = "es"; break; + case 8: l = "ko"; break; + default: l = curlanguage; break; + } + TB_Nickname.Text = getStringList("Species", l)[species]; + } + } + } private void updateNotOT(object sender, EventArgs e) { if (TB_OTt2.Text == "") @@ -5490,7 +5572,7 @@ private void updatePKRSCured(object sender, EventArgs e) if (!CHK_Cured.Checked && CHK_Infected.Checked && CB_PKRSDays.SelectedIndex == 0) CB_PKRSDays.SelectedIndex++; - updateMarkings(); + getMarkings(); } private void updatePKRSInfected(object sender, EventArgs e) { @@ -5541,7 +5623,7 @@ private void updateIsEgg(object sender, EventArgs e) { if (!CHK_Nicknamed.Checked) { - updateNicknameSpecies(null, null); + updateNickname(null, null); } TB_Friendship.Text = ((int)Friendship().Rows[getIndex(CB_Species)][1]).ToString(); @@ -5570,36 +5652,6 @@ private void updateMetAsEgg(object sender, EventArgs e) CB_EggLocation.SelectedValue = 0; } } - private void updateNicknameSpecies(object sender, EventArgs e) - { - // Fetch Current Species and set it as Nickname Text - int species = getIndex(CB_Species); - if (species == 0 || species > 721) - { - TB_Nickname.Text = ""; - } - else - { - // get language - int lang = getIndex(CB_Language); - string[] lang_val = { "en", "ja", "fr", "it", "de", "es", "ko" }; - - string l = ""; - switch (lang) - { - case 1: l = "ja"; break; - case 2: l = "en"; break; - case 3: l = "fr"; break; - case 4: l = "it"; break; - case 5: l = "de"; break; - case 7: l = "es"; break; - case 8: l = "ko"; break; - default: l = curlanguage; break; - } - TB_Nickname.Text = getStringList("Species", l)[species]; - } - CHK_Nicknamed.Checked = false; - } private void updateShinyPID(object sender, EventArgs e) { uint PID = getHEXval(TB_PID); @@ -6553,21 +6605,26 @@ private bool verifiedpkx() //MessageBox.Show("The PKX Data has errors. Please fix them.", "Error"); System.Media.SystemSounds.Exclamation.Play(); - if (i < 6) + if (i < 6) // Main Tab { tabMain.SelectedIndex = 0; } - else if (i < 9) + else if (i < 9) // Met Tab { tabMain.SelectedIndex = 1; } - else + else // Moves { tabMain.SelectedIndex = 3; } return false; } } + // Further logic checking + if (Convert.ToUInt32(TB_EVTotal.Text) > 510) + { + tabMain.SelectedIndex = 2; + } return true; } private byte[] preparepkx(byte[] buff) @@ -8090,7 +8147,7 @@ private void Menu_DumpLoadBoxes_Click(object sender, EventArgs e) Array.Resize(ref pkxdata, 232); if (!File.Exists(path + "\\" + savedname)) { - File.WriteAllBytes(path + "\\" + savedname, pkxdata); + File.WriteAllBytes(CleanFileName(path + "\\" + savedname), pkxdata); } } } @@ -8423,54 +8480,6 @@ private void InitializeStrings() UpdateIVs(null, null); // Prompt an update for the characteristics } - - private void Label_PPups_Click(object sender, EventArgs e) - { - int index = 3; - if (ModifierKeys == Keys.Control) - { - index = 0; - } - CB_PPu1.SelectedIndex = CB_PPu2.SelectedIndex = CB_PPu3.SelectedIndex = CB_PPu4.SelectedIndex = index; - - } - - private void Label_OTGender_Click(object sender, EventArgs e) - { - if (Label_OTGender.Text == "♂") - Label_OTGender.Text = "♀"; - else Label_OTGender.Text = "♂"; - } - private void Label_CTGender_Click(object sender, EventArgs e) - { - if (Label_CTGender.Text == "") return; - else if (Label_CTGender.Text == "♂") - Label_CTGender.Text = "♀"; - else Label_CTGender.Text = "♂"; - } - - private void Marking_Click(object sender, EventArgs e) - { - PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 }; - CheckBox[] cba = { CHK_Circle, CHK_Triangle, CHK_Square, CHK_Heart, CHK_Star, CHK_Diamond }; - - CheckBox cb = cba[Array.IndexOf(pba, sender as PictureBox)]; - cb.Checked = !cb.Checked; - updateMarkings(); - } - private void updateMarkings() - { - PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 }; - CheckBox[] cba = { CHK_Circle, CHK_Triangle, CHK_Square, CHK_Heart, CHK_Star, CHK_Diamond }; - for (int i = 0; i < 6; i++) - { - pba[i].Image = ImageTransparency.ChangeOpacity(pba[i].InitialImage, (float)(Convert.ToUInt16(cba[i].Checked)) * 0.9 + 0.1); - } - - PB_MarkShiny.Image = ImageTransparency.ChangeOpacity(PB_MarkShiny.InitialImage, (float)(Convert.ToUInt16(!BTN_Shinytize.Enabled)) * 0.9 + 0.1); - PB_MarkCured.Image = ImageTransparency.ChangeOpacity(PB_MarkCured.InitialImage, (float)(Convert.ToUInt16(CHK_Cured.Checked)) * 0.9 + 0.1); - PB_MarkPentagon.Image = ImageTransparency.ChangeOpacity(PB_MarkPentagon.InitialImage, (float)(Convert.ToUInt16(getIndex(CB_GameOrigin) == 24 || getIndex(CB_GameOrigin) == 25)) * 0.9 + 0.1); - } } #region Structs & Classes public class cbItem diff --git a/f1-Main.resx b/f1-Main.resx index dcf01acff..0780d3b03 100644 --- a/f1-Main.resx +++ b/f1-Main.resx @@ -231,9 +231,6 @@ True - - True - True