From 75100b6dadebdcc59b35fb24eb301be2560c1d35 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 26 Feb 2015 22:50:27 -0800 Subject: [PATCH] Cap u16 MaskedTextBoxes at 65535, set = if > --- SAV/SAV_Trainer.Designer.cs | 22 ++++++++++++++++++++++ SAV/SAV_Trainer.cs | 10 ++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/SAV/SAV_Trainer.Designer.cs b/SAV/SAV_Trainer.Designer.cs index f8959b7e1..997f68dfb 100644 --- a/SAV/SAV_Trainer.Designer.cs +++ b/SAV/SAV_Trainer.Designer.cs @@ -298,6 +298,7 @@ private void InitializeComponent() this.MT_TID.Size = new System.Drawing.Size(39, 20); this.MT_TID.TabIndex = 8; this.MT_TID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.MT_TID.TextChanged += new System.EventHandler(this.changeFFFF); this.MT_TID.MouseHover += new System.EventHandler(this.showTSV); // // MT_SID @@ -309,6 +310,7 @@ private void InitializeComponent() this.MT_SID.Size = new System.Drawing.Size(39, 20); this.MT_SID.TabIndex = 9; this.MT_SID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.MT_SID.TextChanged += new System.EventHandler(this.changeFFFF); this.MT_SID.MouseHover += new System.EventHandler(this.showTSV); // // cb1 @@ -939,6 +941,7 @@ private void InitializeComponent() this.TB_MBMS.Name = "TB_MBMS"; this.TB_MBMS.Size = new System.Drawing.Size(35, 20); this.TB_MBMS.TabIndex = 65; + this.TB_MBMS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBMN // @@ -948,6 +951,7 @@ private void InitializeComponent() this.TB_MBMN.Name = "TB_MBMN"; this.TB_MBMN.Size = new System.Drawing.Size(35, 20); this.TB_MBMN.TabIndex = 64; + this.TB_MBMN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBRS // @@ -957,6 +961,7 @@ private void InitializeComponent() this.TB_MBRS.Name = "TB_MBRS"; this.TB_MBRS.Size = new System.Drawing.Size(35, 20); this.TB_MBRS.TabIndex = 63; + this.TB_MBRS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBRN // @@ -966,6 +971,7 @@ private void InitializeComponent() this.TB_MBRN.Name = "TB_MBRN"; this.TB_MBRN.Size = new System.Drawing.Size(35, 20); this.TB_MBRN.TabIndex = 62; + this.TB_MBRN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBTS // @@ -975,6 +981,7 @@ private void InitializeComponent() this.TB_MBTS.Name = "TB_MBTS"; this.TB_MBTS.Size = new System.Drawing.Size(35, 20); this.TB_MBTS.TabIndex = 61; + this.TB_MBTS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBTN // @@ -984,6 +991,7 @@ private void InitializeComponent() this.TB_MBTN.Name = "TB_MBTN"; this.TB_MBTN.Size = new System.Drawing.Size(35, 20); this.TB_MBTN.TabIndex = 60; + this.TB_MBTN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBDS // @@ -993,6 +1001,7 @@ private void InitializeComponent() this.TB_MBDS.Name = "TB_MBDS"; this.TB_MBDS.Size = new System.Drawing.Size(35, 20); this.TB_MBDS.TabIndex = 59; + this.TB_MBDS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBDN // @@ -1002,6 +1011,7 @@ private void InitializeComponent() this.TB_MBDN.Name = "TB_MBDN"; this.TB_MBDN.Size = new System.Drawing.Size(35, 20); this.TB_MBDN.TabIndex = 58; + this.TB_MBDN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBSS // @@ -1011,6 +1021,7 @@ private void InitializeComponent() this.TB_MBSS.Name = "TB_MBSS"; this.TB_MBSS.Size = new System.Drawing.Size(35, 20); this.TB_MBSS.TabIndex = 57; + this.TB_MBSS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MBSN // @@ -1020,6 +1031,7 @@ private void InitializeComponent() this.TB_MBSN.Name = "TB_MBSN"; this.TB_MBSN.Size = new System.Drawing.Size(35, 20); this.TB_MBSN.TabIndex = 56; + this.TB_MBSN.TextChanged += new System.EventHandler(this.changeFFFF); // // GB_SuperB // @@ -1119,6 +1131,7 @@ private void InitializeComponent() this.TB_MCMS.Name = "TB_MCMS"; this.TB_MCMS.Size = new System.Drawing.Size(35, 20); this.TB_MCMS.TabIndex = 55; + this.TB_MCMS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCMN // @@ -1128,6 +1141,7 @@ private void InitializeComponent() this.TB_MCMN.Name = "TB_MCMN"; this.TB_MCMN.Size = new System.Drawing.Size(35, 20); this.TB_MCMN.TabIndex = 54; + this.TB_MCMN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCRS // @@ -1137,6 +1151,7 @@ private void InitializeComponent() this.TB_MCRS.Name = "TB_MCRS"; this.TB_MCRS.Size = new System.Drawing.Size(35, 20); this.TB_MCRS.TabIndex = 53; + this.TB_MCRS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCRN // @@ -1146,6 +1161,7 @@ private void InitializeComponent() this.TB_MCRN.Name = "TB_MCRN"; this.TB_MCRN.Size = new System.Drawing.Size(35, 20); this.TB_MCRN.TabIndex = 52; + this.TB_MCRN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCTS // @@ -1155,6 +1171,7 @@ private void InitializeComponent() this.TB_MCTS.Name = "TB_MCTS"; this.TB_MCTS.Size = new System.Drawing.Size(35, 20); this.TB_MCTS.TabIndex = 51; + this.TB_MCTS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCTN // @@ -1164,6 +1181,7 @@ private void InitializeComponent() this.TB_MCTN.Name = "TB_MCTN"; this.TB_MCTN.Size = new System.Drawing.Size(35, 20); this.TB_MCTN.TabIndex = 50; + this.TB_MCTN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCDS // @@ -1173,6 +1191,7 @@ private void InitializeComponent() this.TB_MCDS.Name = "TB_MCDS"; this.TB_MCDS.Size = new System.Drawing.Size(35, 20); this.TB_MCDS.TabIndex = 49; + this.TB_MCDS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCDN // @@ -1182,6 +1201,7 @@ private void InitializeComponent() this.TB_MCDN.Name = "TB_MCDN"; this.TB_MCDN.Size = new System.Drawing.Size(35, 20); this.TB_MCDN.TabIndex = 48; + this.TB_MCDN.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCSS // @@ -1191,6 +1211,7 @@ private void InitializeComponent() this.TB_MCSS.Name = "TB_MCSS"; this.TB_MCSS.Size = new System.Drawing.Size(35, 20); this.TB_MCSS.TabIndex = 47; + this.TB_MCSS.TextChanged += new System.EventHandler(this.changeFFFF); // // TB_MCSN // @@ -1200,6 +1221,7 @@ private void InitializeComponent() this.TB_MCSN.Name = "TB_MCSN"; this.TB_MCSN.Size = new System.Drawing.Size(35, 20); this.TB_MCSN.TabIndex = 46; + this.TB_MCSN.TextChanged += new System.EventHandler(this.changeFFFF); // // L_SuperC // diff --git a/SAV/SAV_Trainer.cs b/SAV/SAV_Trainer.cs index 371da148b..3e7b025e9 100644 --- a/SAV/SAV_Trainer.cs +++ b/SAV/SAV_Trainer.cs @@ -403,8 +403,8 @@ private void getTextBoxes() TB_OTName.Text = OT_NAME; //TB_Rival.Text = RIV_NAME; - MT_TID.Text = TID.ToString(); - MT_SID.Text = SID.ToString(); + MT_TID.Text = TID.ToString("00000"); + MT_SID.Text = SID.ToString("00000"); MT_Money.Text = money.ToString(); TB_Saying1.Text = saying1; @@ -661,6 +661,12 @@ private void change255(object sender, EventArgs e) if (box.Text == "") box.Text = "0"; if (Util.ToInt32(box.Text) > 255) box.Text = "255"; } + private void changeFFFF(object sender, EventArgs e) + { + MaskedTextBox box = sender as MaskedTextBox; + if (box.Text == "") box.Text = "0"; + if (Util.ToInt32(box.Text) > 65535) box.Text = "65535"; + } private int psssatoffset = 0x23800; private void changeStat(object sender, EventArgs e) {