internal static void ServerModMenu() { bool exit = false; while (!exit) { Console.WriteLine("Terraria Server " + Main.versionNumber2 + " - " + ModLoader.versionedName); Console.WriteLine(); TmodFile[] mods = ModLoader.FindMods(); for (int k = 0; k < mods.Length; k++) { BuildProperties properties = BuildProperties.ReadModFile(mods[k]); string name = properties.displayName; name = mods[k].name; string line = (k + 1) + "\t\t" + name + "("; line += (ModLoader.IsEnabled(mods[k]) ? "enabled" : "disabled") + ")"; Console.WriteLine(line); } Console.WriteLine("e\t\tEnable All"); Console.WriteLine("d\t\tDisable All"); Console.WriteLine("r\t\tReload and return to world menu"); Console.WriteLine("Type a number to switch between enabled/disabled"); Console.WriteLine(); Console.WriteLine("Type a command: "); string command = Console.ReadLine(); if (command == null) { command = ""; } command = command.ToLower(); Console.Clear(); if (command == "e") { foreach (TmodFile mod in mods) { ModLoader.EnableMod(mod); } } else if (command == "d") { foreach (TmodFile mod in mods) { ModLoader.DisableMod(mod); } } else if (command == "r") { Console.WriteLine("Unloading mods..."); ModLoader.Unload(); ModLoader.do_Load(null); exit = true; } else { int value; if (Int32.TryParse(command, out value)) { value--; if (value >= 0 && value < mods.Length) { ModLoader.SetModActive(mods[value], !ModLoader.IsEnabled(mods[value])); } } } } }
internal static void ServerModMenu() { bool exit = false; while (!exit) { Console.WriteLine("Terraria Server " + Main.versionNumber2 + " - " + ModLoader.versionedName); Console.WriteLine(); TmodFile[] mods = ModLoader.FindMods(); for (int k = 0; k < mods.Length; k++) { BuildProperties properties = BuildProperties.ReadModFile(mods[k]); string name = properties.displayName; name = mods[k].name; string line = (k + 1) + "\t\t" + name + "("; line += (ModLoader.IsEnabled(mods[k]) ? "enabled" : "disabled") + ")"; Console.WriteLine(line); } if (mods.Length == 0) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"No mods were found in: \"{ModLoader.ModPath}\"\nIf you are running a dedicated server, you may wish to use the 'modpath' command line switch or server config setting to specify a custom mods directory.\n"); Console.ResetColor(); } Console.WriteLine("e\t\tEnable All"); Console.WriteLine("d\t\tDisable All"); Console.WriteLine("r\t\tReload and return to world menu"); Console.WriteLine("Type a number to switch between enabled/disabled"); Console.WriteLine(); Console.WriteLine("Type a command: "); string command = Console.ReadLine(); if (command == null) { command = ""; } command = command.ToLower(); Console.Clear(); if (command == "e") { foreach (TmodFile mod in mods) { ModLoader.EnableMod(mod); } } else if (command == "d") { foreach (TmodFile mod in mods) { ModLoader.DisableMod(mod); } } else if (command == "r") { Console.WriteLine("Unloading mods..."); ModLoader.Unload(); ModLoader.do_Load(null); exit = true; } else { int value; if (Int32.TryParse(command, out value)) { value--; if (value >= 0 && value < mods.Length) { ModLoader.SetModActive(mods[value], !ModLoader.IsEnabled(mods[value])); } } } } }