private static void checkDir(DirectoryInfo dir) { if (dir.Exists) { Console.Title = "StationeersTools - " + dir.Name; foreach (FileInfo file in dir.GetFiles()) { if (file.Name == "world.bin") { raw_binfile = file; } if (file.Name == "world.xml") { raw_xmlfile = file; } } if (raw_binfile == null || raw_xmlfile == null) { PrintUtils.PrintLine("Could not find both world files!", ConsoleColor.Red); } } else { PrintUtils.PrintLine("Incorrect path!", ConsoleColor.Red); } }
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 void FlattenSurface() { Menus.ShowVoxelSelectMenu(false); VoxelUtils.ClearVoxelList(ActiveVoxels); Console.Write("Cleared voxels: "); PrintUtils.PrintLine(ActiveVoxels.Count.ToString(), ConsoleColor.DarkYellow); VoxelUtils.SetVoxelList(FloorVoxels, 1, 255); Console.WriteLine("Saving to file..."); Program.binfile.Save(Program.raw_binfile.FullName); Console.Write("Saved! Press any key to continue."); Console.Read(); }
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"); }