private void ButtonText(InSim insim, IS_BTT btt) { try { drag.distanceToDrive = Convert.ToInt32(btt.Text); } catch (Exception e) { drag.distanceToDrive = 0; Console.WriteLine("Could not convert number. Letters or symbols present in text"); Console.WriteLine(e); } }
// Button type void ButtonType(InSim insim, IS_BTT BTT) { try { switch (BTT.ClickID) { case 32: onepts = BTT.Text; insim.Send(new IS_BTN { UCID = BTT.UCID, ReqI = 32, ClickID = 32, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 73, // up to down L = 102, // left to right Text = "" + BTT.Text, TypeIn = 3, Caption = "^0Amount of points to reward 1st place" }); break; case 33: twopts = BTT.Text; break; case 34: threepts = BTT.Text; break; case 35: fourpts = BTT.Text; break; } } catch (Exception e) { LogTextToFile("error", "[" + BTT.UCID + "] " + StringHelper.StripColors(_connections[BTT.UCID].PName) + "(" + _connections[BTT.UCID].UName + ") BTT - Exception: " + e, false); } }
// Button type void ButtonType(InSim insim, IS_BTT BTT) { try { switch (BTT.ClickID) { #region ' cases ' case 32: if (BTT.Text.Contains("1") || BTT.Text.Contains("2") || BTT.Text.Contains("3") || BTT.Text.Contains("4") || BTT.Text.Contains("5") || BTT.Text.Contains("6") || BTT.Text.Contains("7") || BTT.Text.Contains("8") || BTT.Text.Contains("9")) { onepts = BTT.Text; insim.Send(new IS_BTN { UCID = BTT.UCID, ReqI = 32, ClickID = 32, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 73, // up to down L = 102, // left to right Text = "^7" + BTT.Text, TypeIn = 3, Caption = "^0Amount of points to reward 1st place" }); SqlInfo.updateptsFIRST(Convert.ToInt32(BTT.Text)); } else { insim.Send(BTT.UCID, "^1Invalid input!"); } break; case 33: if (BTT.Text.Contains("1") || BTT.Text.Contains("2") || BTT.Text.Contains("3") || BTT.Text.Contains("4") || BTT.Text.Contains("5") || BTT.Text.Contains("6") || BTT.Text.Contains("7") || BTT.Text.Contains("8") || BTT.Text.Contains("9")) { twopts = BTT.Text; insim.Send(new IS_BTN { UCID = BTT.UCID, ReqI = 33, ClickID = 33, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 77, // up to down L = 102, // left to right Text = "^7" + BTT.Text, TypeIn = 3, Caption = "^0Amount of points to reward 2nd place" }); SqlInfo.updateptsSECOND(Convert.ToInt32(BTT.Text)); } else { insim.Send(BTT.UCID, "^1Invalid input!"); } break; case 34: if (BTT.Text.Contains("1") || BTT.Text.Contains("2") || BTT.Text.Contains("3") || BTT.Text.Contains("4") || BTT.Text.Contains("5") || BTT.Text.Contains("6") || BTT.Text.Contains("7") || BTT.Text.Contains("8") || BTT.Text.Contains("9")) { threepts = BTT.Text; insim.Send(new IS_BTN { UCID = BTT.UCID, ReqI = 34, ClickID = 34, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 81, // up to down L = 102, // left to right Text = "^7" + BTT.Text, TypeIn = 3, Caption = "^0Amount of points to reward 3rd place" }); SqlInfo.updateptsTHIRD(Convert.ToInt32(BTT.Text)); } else { insim.Send(BTT.UCID, "^1Invalid input!"); } break; case 35: if (BTT.Text.Contains("1") || BTT.Text.Contains("2") || BTT.Text.Contains("3") || BTT.Text.Contains("4") || BTT.Text.Contains("5") || BTT.Text.Contains("6") || BTT.Text.Contains("7") || BTT.Text.Contains("8") || BTT.Text.Contains("9")) { fourpts = BTT.Text; insim.Send(new IS_BTN { UCID = BTT.UCID, ReqI = 35, ClickID = 35, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 85, // up to down L = 102, // left to right Text = "^7" + BTT.Text, TypeIn = 3, Caption = "^0Amount of points to reward 4th place" }); SqlInfo.updateptsFORTH(Convert.ToInt32(BTT.Text)); } else { insim.Send(BTT.UCID, "^1Invalid input!"); } break; #endregion } } catch (Exception e) { LogTextToFile("error", "[" + BTT.UCID + "] " + StringHelper.StripColors(_connections[BTT.UCID].PName) + "(" + _connections[BTT.UCID].UName + ") BTT - Exception: " + e, false); } }