private void Button1_Click(object sender, EventArgs e) { //Portal to Voxel try { if (textBox1.Text != "") { textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); string t1 = textBox1.Text.Replace(" ", ""); if (t1.Length == 12 && !textBox1.Text.Contains(":")) { //Gives both Galactic and Voxel PortalToVoxel(t1); string[] value = GalacticCoord2.Replace(" ", "").Split(':'); string A = value[0].Trim(); string B = value[1].Trim(); string C = value[2].Trim(); string D = value[3].Trim(); //Validate Coordinates if (ValidateCoord(A, B, C, D)) { MessageBox.Show("Invalid Coordinates! Out of Range!", "Alert"); Clear(); AppendLine(textBox7, "Invalid Coordinates!"); return; } textBox2.Text = GalacticCoord2; PortalCode = textBox1.Text; } else { Clear(); AppendLine(textBox7, "Incorrect Coordinate Input!"); } } } catch { Clear(); AppendLine(textBox7, "Incorrect Coordinate Input!"); } }
private void Button4_Click(object sender, EventArgs e) { try { if (textBox8.Text != "") { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); string t8 = textBox8.Text.Replace(" ", ""); //HexToVoxel(t8); CalculateLongHex(t8); string[] value = GalacticCoord2.Replace(" ", "").Split(':'); string A = value[0].Trim(); string B = value[1].Trim(); string C = value[2].Trim(); string D = value[3].Trim(); //Validate Coordinates if (ValidateCoord(A, B, C, D)) { MessageBox.Show("Invalid Coordinates! Out of Range!", "Alert"); Clear(); AppendLine(textBox7, "Invalid Coordinates!"); return; } //CalculateVoxelFromHex(t8); textBox2.Text = GalacticCoord2; GalacticToPortal(Planet, A, B, C, D); textBox1.Text = PortalCode; } } catch { Clear(); AppendLine(textBox7, "Incorrect Coordinate Input!"); } }