Beispiel #1
0
        private static String handleCreate()
        {
            String createString = LaunchOptions.getOptionValue(LaunchOptions.Option.CREATE);

            if (createString.ToLower().CompareTo("profile") == 0)
            {
                String profName = "";
                do
                {
                    System.Console.WriteLine("Enter New Profile ID: ");
                    profName = System.Console.ReadLine();

                    while (!IsValidFilename(profName))
                    {
                        System.Console.WriteLine("\nInvalid Profile ID.\n\nEnter New Profile ID: ");
                        profName = System.Console.ReadLine().Replace("\"", "").Replace("\\", "/");
                    }
                } while (!Manager.ProfileManager.createProfile(profName));
            }

            if (createString.ToLower().CompareTo("emulator") == 0)
            {
                String emuName = "";
                do
                {
                    System.Console.WriteLine("Enter New Emulator ID: ");
                    emuName = System.Console.ReadLine();

                    while (!IsValidFilename(emuName))
                    {
                        System.Console.WriteLine("\nInvalid Emulator ID.\n\nEnter New Emulator ID: ");
                        emuName = System.Console.ReadLine().Replace("\"", "").Replace("\\", "/");
                    }
                } while (!Manager.EmulatorManager.createEmulator(emuName));
            }

            if (createString.ToLower().CompareTo("mapper") == 0)
            {
                String mapName = "";
                do
                {
                    System.Console.WriteLine("Enter New Mapper ID: ");
                    mapName = System.Console.ReadLine();

                    while (!IsValidFilename(mapName))
                    {
                        System.Console.WriteLine("\nInvalid Mapper ID.\n\nEnter New Mapper ID: ");
                        mapName = System.Console.ReadLine().Replace("\"", "").Replace("\\", "/");
                    }
                } while (!Manager.MapperManager.createRomProfileMapper(mapName));
            }

            return("");
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        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("");
        }