public static void ShowVoxelSelectMenu(bool heightrequired) { Console.Clear(); Console.WriteLine("How would you like to pick the affected area?"); string[][] options = { PrintUtils.BuildRow("1", "Circle around point"), PrintUtils.BuildRow("2", "Square around point"), PrintUtils.BuildRow("3", "Point to point") }; PrintUtils.PrintColumns(options, 1); Console.WriteLine(); int selected = 100; while (selected == 100) { string input = PrintUtils.RequestInputLine("Option"); int.TryParse(input, out selected); } BinUtils.StartSelect(selected, heightrequired); }
public static Vector3 RequestVector(string message) { PrintUtils.PrintLine(message, ConsoleColor.DarkYellow); Vector3 point = new Vector3(); bool fx = false, fy = false, fz = false; while (!fx) { string input = PrintUtils.RequestInputLine("X"); try { point.x = float.Parse(input); fx = true; } catch (Exception ex) { PrintUtils.PrintLine("Incorrect input!", ConsoleColor.Red); } } while (!fy) { string input = PrintUtils.RequestInputLine("Y"); try { point.y = float.Parse(input); fy = true; } catch (Exception ex) { PrintUtils.PrintLine("Incorrect input!", ConsoleColor.Red); } } while (!fz) { string input = PrintUtils.RequestInputLine("Z"); try { point.z = float.Parse(input); fz = true; } catch (Exception ex) { PrintUtils.PrintLine("Incorrect input!", ConsoleColor.Red); } } return(point); }
public static float RequestFloat(string message) { float value = 0; bool fr = false; PrintUtils.PrintLine(message, ConsoleColor.DarkYellow); while (!fr) { string input = PrintUtils.RequestInputLine("Value"); try { value = float.Parse(input); fr = true; } catch (Exception ex) { PrintUtils.PrintLine("Incorrect input!", ConsoleColor.Red); } } return(value); }
static void Main(string[] args) { Console.Clear(); PrintUtils.PrepareConsole(); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { e.Cancel = true; keepRunning = false; }; Console.WriteLine("Welcome to StationeersTools 2019 - Made by The Psycho"); Console.WriteLine("You can always press ctrl+c to shut down, this will cancel unsaved changes."); Console.WriteLine("Changes will always be written to the original file"); PrintUtils.PrintLine("Your original file will be backed up, but PLEASE make your own!", ConsoleColor.Red); PrintUtils.PrintLine("Although very unlikely, I am not responsible for any damage after game updates.", ConsoleColor.Red); if (args.Length > 0) { try { DirectoryInfo dir = new DirectoryInfo(args[0]); checkDir(dir); } catch (Exception ex) { PrintUtils.PrintLine("Incorrect path!", ConsoleColor.Red); } } else { PrintUtils.PrintLine("Please input the full path to the save folder :)", ConsoleColor.White); while (raw_binfile == null || raw_xmlfile == null) { try { string dirpath = PrintUtils.RequestInputLine("Directory"); DirectoryInfo dir = new DirectoryInfo(dirpath); checkDir(dir); } catch (Exception ex) { PrintUtils.PrintLine("Incorrect path!", ConsoleColor.Red); } } } string datetime = DateTime.Now.ToString("yyyyMMddHmmss"); raw_binfile.CopyTo(raw_binfile.FullName + "." + datetime + ".original"); raw_xmlfile.CopyTo(raw_xmlfile.FullName + "." + datetime + ".original"); LoadFiles(); while (keepRunning) { Menus.ShowMenus(); Console.Clear(); Console.WriteLine("test"); Console.ReadKey(); } Console.WriteLine("Graceful Exit"); }