Пример #1
0
        private void emulatorTreeView_CreateCustomRom(Utilities.EmulatorConsoles console)
        {
            List <IKnownEmulator> knownEmulatorTypes = emuMgr.GetKnownEmulatorTypesForConsole(console);

            using (CustomEmulatorForm form = new CustomEmulatorForm())
            {
                form.Initialize(console, knownEmulatorTypes);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    var emulator = form.Emulator;
                    emuMgr.AddCustomEmulator(emulator);
                    UpdateEmulatorList();
                }
            }
        }
Пример #2
0
        public void Execute()
        {
            bool   pathExists     = false;
            String pathToEmulator = String.Empty;

            while (!pathExists)
            {
                Console.WriteLine("Enter path to custom emulator:");
                Console.Write("> ");
                pathToEmulator = Console.ReadLine();
                if (!File.Exists(pathToEmulator))
                {
                    Console.WriteLine(String.Format("\"{0}\" does not exist", pathToEmulator));
                }
                else
                {
                    pathExists = true;
                }
            }

            Console.WriteLine("Enter arguments for custom emulator:");
            Console.Write("> ");
            String emulatorArguments = Console.ReadLine();

            Console.WriteLine("Enter custom emulator version [0.0.1]:");
            Console.Write("> ");
            String emulatorVersion = Console.ReadLine();

            if (String.IsNullOrEmpty(emulatorVersion))
            {
                emulatorVersion = "0.0.1";
            }

            String defaultEmulatorName = Path.GetFileName(pathToEmulator);

            Console.WriteLine(String.Format("Enter custom emulator name [{0}]:", defaultEmulatorName));
            Console.Write("> ");
            String emulatorName = Console.ReadLine();

            if (String.IsNullOrEmpty(emulatorName))
            {
                emulatorName = defaultEmulatorName;
            }

            bool inputAccepted = false;
            List <EmulatorConsoles> emulatorConsoles = new List <EmulatorConsoles>();

            while (!inputAccepted)
            {
                Console.WriteLine("Enter console types supported by this emulator (input is a list of numbers supported by spaces)");
                for (int i = 1; i < EmulatorConsoles.Values.Count() + 1; i++)
                {
                    Console.WriteLine(String.Format("{0}) {1}", i, EmulatorConsoles.Values.ToArray()[i - 1]));
                }
                Console.Write("> ");
                string emulatorConsoleInput = Console.ReadLine();

                inputAccepted = tryParseEmulatorConsoles(emulatorConsoleInput, out emulatorConsoles);
            }

            CustomEmulator emu = new CustomEmulator(pathToEmulator, emulatorArguments, emulatorVersion, emulatorName, emulatorConsoles);

            emuMgr.AddCustomEmulator(emu);
        }