public static void SetDefaultSpeed(string material) { if (material == null) { Console.WriteLine(" : Enter the material you'd like to access your saved defualts for :"); Console.WriteLine(" ( If the material doesn't exist a blank new file will be created )"); Display.ShowHeader(); material = Console.ReadLine(); } string path = FileLogic.MaterialToFilePath(material); if (FileLogic.CheckFileExistance(path) == false) { Console.WriteLine(" : No file detected, creating a blank save file :"); FileLogic.FormatFileToSettingStandard(path, false); } int slot = SecondaryLogic.GetSlot(path, true); double speed = SecondaryLogic.RateCalculation(true, null); Console.WriteLine(" : Enter a label for this default : "); Display.ShowHeader(); string comment = Console.ReadLine(); string ammendment = Convert.ToString(speed); FileLogic.AmmendSettingsFile(path, ammendment, slot - 1, comment); Console.WriteLine(" : Default successfully saved :"); }
public static double loadMinionSave(bool Write, string material) { string path; while(true) { if (material == null) { Console.WriteLine(" : Enter name of material to load defaults for : "); Display.ShowHeader(); material = Console.ReadLine(); } path = FileLogic.MaterialToFilePath(material); if (FileLogic.CheckFileExistance(path) == false) { Display.ShowError("CRITICAL ERROR - No file in exsistance to load"); MainLogic.SetDefaultSpeed(material); } else { break; } } int option = GetSlot(path, Write); string[,] settings = FileLogic.ReadFileToSettings(path); double speedSelected = Convert.ToDouble(settings[option-1, 0]); return speedSelected; }
public static void ClearDefualts() { Console.WriteLine(@" 1 - Clear all settings 2 - Clear specific settings file "); int choice; while (true) { Console.WriteLine(" : Enter you choice from the menu :"); choice = Input.GetInt(); if (choice > 2 || choice < 1) { Display.ShowError("Invalid input, (1-2)"); } else { break; } } string material; string path; if (choice == 1) { Console.WriteLine(" : Are you sure you want to wipe the file (Y/N) : "); string YesOrNO = Console.ReadLine().ToLower(); if (YesOrNO == "yes" || YesOrNO == "y") { FileLogic.DeleteDir(FileLogic.SETTINGS_FOLDER); Console.WriteLine(" - FILE RESET -"); FileLogic.CreateDirectory(FileLogic.SETTINGS_FOLDER); } else { Console.WriteLine("- DELETION ABORTED -"); } } else if (choice == 2) { Console.WriteLine(" : Enter material defaults you'd like to clear :"); Display.ShowHeader(); material = Console.ReadLine(); path = FileLogic.MaterialToFilePath(material); if (FileLogic.CheckFileExistance(path) == false) { Display.ShowError("This file doesn't exsist, and so can't be deleted"); } else { Console.WriteLine(" : Are you sure you want to wipe the file (Y/N) : "); string YesOrNO = Console.ReadLine().ToLower(); if (YesOrNO == "yes" || YesOrNO == "y") { FileLogic.DeleteFile(path); Console.WriteLine(" - FILE DELETED -"); } else { Console.WriteLine("- DELETION ABORTED -"); } } } }