private static String loadJson() { String pathString = LaunchOptions.getOptionValue(LaunchOptions.Option.JSON); if (System.IO.File.Exists(pathString)) { loadedLaunchProf = Newtonsoft.Json.JsonConvert.DeserializeObject <LaunchProfile>(System.IO.File.ReadAllText(pathString)); } else { return(@"Unable to open file: " + pathString); } return(null); }
private static void handleOptions() { if (LaunchOptions.getOptionValue(LaunchOptions.Option.HELP) == true) { System.Console.Write("\n\n" + LaunchOptions.printHelp() + "\n"); return; } if (LaunchOptions.getOptionValue(LaunchOptions.Option.JSON) != null) { String status = loadJson(); doLaunch = true; } if (LaunchOptions.getOptionValue(LaunchOptions.Option.PROFILE) != null) { loadedLaunchProf.ProfileId = LaunchOptions.getOptionValue(LaunchOptions.Option.PROFILE); doLaunch = true; } if (LaunchOptions.getOptionValue(LaunchOptions.Option.ROM) != null) { loadedLaunchProf.RomPath = LaunchOptions.getOptionValue(LaunchOptions.Option.ROM).Replace("\\", "/"); doLaunch = true; } if (LaunchOptions.getOptionValue(LaunchOptions.Option.CREATE) != null) { String status = handleCreate(); } if (LaunchOptions.getOptionValue(LaunchOptions.Option.MAPGEN) != null) { String status = handleMapGen(); } }
private static string handleMapGen() { String mapId = LaunchOptions.getOptionValue(LaunchOptions.Option.MAPGEN).Replace("\"", "").Replace("\\", "/"); List <string> mapperIdList = new List <string>(); List <RomProfileMapper> mapperList = new List <RomProfileMapper>(); if (mapId != null) { if (mapId.Trim() == "*") { mapperIdList.AddRange(System.IO.Directory.GetFiles(Manager.SettingManager.getSettingValue("romProfileMapperDirecotry"))); } else { mapperIdList.Add(mapId); } if (mapperIdList.Count > 0) { foreach (String id in mapperIdList) { mapperList.Add(Manager.MapperManager.loadMapper(id)); } if (mapperList.Count > 0) { foreach (RomProfileMapper map in mapperList) { map.generateMapFiles(); } } } } return(""); }
static void Main(string[] args) { //Setup Launch Options LaunchOptions.resetOptions(); //Load Settings Manager.SettingManager.loadSettingsFile(); //Check Directories Manager.ProfileManager.createProfileDirectory(); Manager.EmulatorManager.createEmulatorDirectory(); Manager.MapperManager.createRomProfileMapperDirectory(); //Process Launch Options if (args.Length == 0) { System.Console.WriteLine("No options provided. Run with --help for help."); } else { LaunchOptions.processOptions(args); } //Handle Launch Options handleOptions(); //Load Profile loadProfile(); //Load Emulator loadEmulator(); //Build Launcher if (loadedProfile != null && loadedEmulator != null) { launcher = new Launcher(loadedProfile, loadedEmulator, loadedLaunchProf.RomPath); } //Execute if (launcher != null) { string status = launcher.launch(); if (status != null) { Console.WriteLine("An error occurred while executing the launch command: " + status); Console.ReadKey(); } } else if (doLaunch) { //Pause to show error Console.ReadKey(); } //Wait for input /* * if(launcher == null) * { * Console.WriteLine("Press any key to continue. ALSO REMOVE THIS AFTER DEVELOPMENT!!!!!!!!"); * Console.ReadKey(); * } */ }