private static void MainMenu() { IMenuOption[] menuOptions = new IMenuOption[] { new RunPresetOption(), new CollectionCreationOption(), new OutputListOption() }; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{currentGame.Name} Encount Music Editor"); Console.ResetColor(); for (int i = 0, total = menuOptions.Length; i < total; i++) { Console.WriteLine($"{i + 1}. {menuOptions[i].Name}"); } Console.WriteLine("0. Exit"); int choice = ConsolePrompt.PromptInt("Choice"); if (choice == 0) { return; } else if (choice - 1 < menuOptions.Length) { menuOptions[choice - 1].Run(currentGame); } }while (true); }
private static void SetupGame() { int selectedGameInput = -1; do { Console.WriteLine("Select Persona Game"); // display list of available games as choices, starting at 1 foreach (GameTitle game in Enum.GetValues(typeof(GameTitle))) { Console.WriteLine($"{(int)game + 1}. {game}"); } // save temp choice int tempChoice = ConsolePrompt.PromptInt("Game"); // save and exit prompt if game choice is valid if (Enum.IsDefined(typeof(GameTitle), tempChoice - 1)) { selectedGameInput = tempChoice - 1; } }while (selectedGameInput < 0); GameTitle selectedGame = (GameTitle)selectedGameInput; currentGame = new GameProps(selectedGame); }
private string SelectPresetFile() { string[] allPresets = null; try { allPresets = Directory.GetFiles(presetsFolderDir, "*.preset", SearchOption.AllDirectories); } catch (Exception e) { Console.WriteLine(e); Console.WriteLine("Problem reading presets from folder!"); return(null); } // exit if no presets were found if (allPresets.Length < 1) { return(null); } // display all presets Console.WriteLine("Available Presets"); for (int i = 0, total = allPresets.Length; i < total; i++) { Console.WriteLine($"{i + 1}. {Path.GetFileNameWithoutExtension(allPresets[i])}"); } // get valid preset choice int presetSelection = -1; do { int tempChoice = ConsolePrompt.PromptInt("Preset Selection"); if (tempChoice > allPresets.Length) { Console.WriteLine("Invalid selection!"); } else { presetSelection = tempChoice; } } while (presetSelection < 1); return(allPresets[presetSelection - 1]); }
public void ExtendSongsList() { int newNumSongs = ConsolePrompt.PromptInt("New Total Songs"); string originalConversionFile = $@"{currentDir}\music manager\idtowaveindex_original.json"; string outputConversionFile = $@"{currentDir}\music manager\idtowaveindex.json"; string originalNamesFile = $@"{currentDir}\music manager\songnames_original.json"; string outputNamesFile = $@"{currentDir}\music manager\songnames.json"; idtowaveindex originalConversions = ParseConversionFile(originalConversionFile); if (originalConversions == null) { return; } songnames originalNames = ParseNamesFile(originalNamesFile); if (originalNames == null) { return; } int normalNumSongs = originalConversions.conversions.Length; // new array of conversion objects with new total conversionObject[] newConversionList = new conversionObject[newNumSongs]; nameObject[] newNamesList = new nameObject[newNumSongs]; // copy original list to new list Array.Copy(originalConversions.conversions, newConversionList, originalConversions.conversions.Length); Array.Copy(originalNames.names, newNamesList, originalNames.names.Length); int startingIndex = 886; for (int i = normalNumSongs, total = newNumSongs, indexCounter = 0; i < total; i++, indexCounter++) { conversionObject newConversion = new conversionObject(); newConversion.trackID = i.ToString(); newConversion.uwusID = null; newConversion.waveIndex = (startingIndex + indexCounter).ToString(); newConversionList[i] = newConversion; nameObject newName = new nameObject(); newName.id = i.ToString(); newName.trackName = $"(BGME) Song Index {newConversion.waveIndex}"; newNamesList[i] = newName; } originalConversions.conversions = newConversionList; originalNames.names = newNamesList; string newConversionText = JsonSerializer.Serialize <idtowaveindex>(originalConversions, new JsonSerializerOptions { WriteIndented = true }); string newNamesText = JsonSerializer.Serialize <songnames>(originalNames, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(outputConversionFile, newConversionText); File.WriteAllText(outputNamesFile, newNamesText); }