public static int GetSlot(string path, bool overwrite) { string[,] settings = FileLogic.ReadFileToSettings(path); bool EmptyPreset = true; Console.WriteLine("--- --- ---"); for (int x = 0; x < settings.Length; x++) { try { if (settings[x, 0] == null) { Console.WriteLine(@$"Preset {x + 1} : \EMPTY\"); } else { Console.WriteLine($"Preset {x + 1} : {settings[x, 0]} | {settings[x, 1]}"); EmptyPreset = false; } } catch (IndexOutOfRangeException) { break; } } Console.WriteLine("--- --- ---"); int option; while (true) { Console.WriteLine(" : Enter the preset number you'd like to select : "); Display.ShowHeader(); option = Input.GetInt(); if (option < 1 || option > settings.Length && EmptyPreset == false) { Display.ShowError("Entered an invalid response, number chosen outside the presets shown"); } else if (EmptyPreset == true && overwrite == false) { Display.ShowError("There is nothing saved into that preset"); } else { break; } } return option; }
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; }