Exemplo n.º 1
0
        private void _emuExec(string emu, emuMovie movie, string rom)
        {
            string  args    = String.Format(movie.CommandLine, movie.FileName, rom);
            Process procemu = new Process();

            procemu.StartInfo.FileName  = emu;
            procemu.StartInfo.Arguments = args;
            procemu.Start();
        }
Exemplo n.º 2
0
		private void _emuExec(string emu, emuMovie movie, string rom) {
			string args = String.Format(movie.CommandLine, movie.FileName, rom);
			Process procemu = new Process();
			procemu.StartInfo.FileName = emu;
			procemu.StartInfo.Arguments = args;
			procemu.Start();
		}
Exemplo n.º 3
0
        public Program(string[] args)
        {
            string moviefile = null;
            string emufile   = null;

            #region ini
            string inifile = _getprogdir() + @"\config.ini";
            _settings = new INI(inifile);
            string dirs = _settings["config", "dirs"];
            if ((dirs == null) || (dirs.Trim() == ""))
            {
                Console.WriteLine("Please select your rom dir...\n");
                if ((dirs = _adddirdlg()) == null)
                {
                    fatal("'" + inifile + @"' not found or missing data. Please create and list your rom directories semicolon deliminated as follows:
					
[config]
dirs=c:\my roms\;c:\my other roms\;c:\etc\etc\etc\");
                }
                else
                {
                    Console.WriteLine("Please note, that you can add new directories by modifying your '" + inifile + @"' configuration file. The dirs key should contain directories which are semicolon deliminated, for example:

[config]
dirs=c:\my roms\;c:\my other roms\;c:\etc\etc\etc\

Press any key to continue.");
                    Console.ReadKey();
                }
            }
            #endregion

            #region args the lazy way
            moviefile = String.Join(" ", args).Replace('"', ' ').Trim();                //Hack.
            if ((moviefile == null) || (moviefile == ""))
            {
                _mainmenu();
                Environment.Exit(0);
            }
            if (!File.Exists(moviefile))
            {
                fatal("Movie file '" + moviefile + @"' does not exist.

Usage:   program.exe movie file
Example: program.exe C:\blah\Dragon Warrior (U).exe");
            }
            #endregion

            db = new database(_getprogdir() + @"\roms." + _dbversion.ToString() + ".db");
            emuMovie movie = new emuMovie(moviefile);
            emufile = _settings["config", movie.FileExt];
            if (!File.Exists(emufile))
            {
                emufile = _filedlg(_promptdlgtype.emu);
                if (emufile == null)
                {
                    fatal("The movie can not be played with out an emulator being set. Please re-run the program and select one or please set the value through your ini as follows:\n\n[config]\n" + movie.FileExt + @"=C:\path\and\filename.exe");
                }
                _settings["config", movie.FileExt] = emufile;
            }
            ArrayList romfiles = movie.ROM();
            string    romfile  = "";
            if (romfiles == null)
            {
                if (_promptyesno("Unable to locate the ROM in the database. Would you like to update? If not, a file selection dialog will show."))
                {
                    _updatedb(dirs);
                }
            }
            romfiles = movie.ROM();
            if (romfiles == null)
            {
                romfile = _filedlg(_promptdlgtype.rom, movie.FileExt);
            }
            else if (romfiles.Count == 1)
            {
                romfile = romfiles[0].ToString();
            }
            else
            {
                for (int i = 0; i < romfiles.Count; i++)
                {
                    Console.WriteLine("{0})\t{1}", i + 1, romfiles[i]);
                }
                int selection = 0;
                try {
                    selection = int.Parse(_prompt("Please enter the number for the rom you wish to use."));
                } catch (FormatException) {
                    Program.fatal("Invalid selection.");
                }
                if ((selection > 0) && (selection <= romfiles.Count))
                {
                    romfile = romfiles[selection - 1].ToString();
                }
                else
                {
                    Program.fatal("Invalid selection.");
                }
            }
            if (!File.Exists(romfile))
            {
                if (romfiles == null)
                {
                    db.Remove(romfile);
                    fatal("The ROM file with hash of " + movie.Hash + " was identified in the database, but the file '" + romfile + "' associated with it was not found. The dead entry has been removed from the database.");
                }
            }
            _emuExec(emufile, movie, romfile);
            db.Close();
        }
Exemplo n.º 4
0
		public Program(string[] args) {
			string moviefile = null;
			string emufile = null;

			#region ini
			string inifile = _getprogdir() + @"\config.ini";
			_settings = new INI(inifile);
			string dirs = _settings["config", "dirs"];
			if ((dirs == null) || (dirs.Trim() == "")) {
				Console.WriteLine("Please select your rom dir...\n");
				if ((dirs = _adddirdlg()) == null) {
					fatal("'" + inifile + @"' not found or missing data. Please create and list your rom directories semicolon deliminated as follows:
					
[config]
dirs=c:\my roms\;c:\my other roms\;c:\etc\etc\etc\");
				} else {
					Console.WriteLine("Please note, that you can add new directories by modifying your '" + inifile + @"' configuration file. The dirs key should contain directories which are semicolon deliminated, for example:

[config]
dirs=c:\my roms\;c:\my other roms\;c:\etc\etc\etc\

Press any key to continue.");
					Console.ReadKey();
				}
			}
			#endregion

			#region args the lazy way
			moviefile = String.Join(" ", args).Replace('"', ' ').Trim();	//Hack.
			if ((moviefile == null) || (moviefile == "")) {
				_mainmenu();
				Environment.Exit(0);
			}
			if (!File.Exists(moviefile)) {
				fatal("Movie file '" + moviefile + @"' does not exist.

Usage:   program.exe movie file
Example: program.exe C:\blah\Dragon Warrior (U).exe");
			}
			#endregion

			db = new database(_getprogdir() + @"\roms." + _dbversion.ToString() + ".db");
			emuMovie movie = new emuMovie(moviefile);
			emufile = _settings["config", movie.FileExt];
			if (!File.Exists(emufile)) {		
				emufile = _filedlg(_promptdlgtype.emu);
				if (emufile == null)
					fatal("The movie can not be played with out an emulator being set. Please re-run the program and select one or please set the value through your ini as follows:\n\n[config]\n" + movie.FileExt + @"=C:\path\and\filename.exe");
				_settings["config", movie.FileExt] = emufile;
			}
			ArrayList romfiles = movie.ROM();
			string romfile = "";
			if (romfiles == null) {
				if (_promptyesno("Unable to locate the ROM in the database. Would you like to update? If not, a file selection dialog will show."))
					_updatedb(dirs);
			}
			romfiles = movie.ROM();
			if (romfiles == null) {
				romfile = _filedlg(_promptdlgtype.rom, movie.FileExt);
			} else if (romfiles.Count == 1) {
				romfile = romfiles[0].ToString();
			} else {
				for (int i = 0; i < romfiles.Count; i++)
					Console.WriteLine("{0})\t{1}", i+1, romfiles[i]);
				int selection = 0;
				try {
					selection = int.Parse(_prompt("Please enter the number for the rom you wish to use."));
				} catch (FormatException) {
					Program.fatal("Invalid selection.");
				}
				if ((selection > 0) && (selection <= romfiles.Count)) {
					romfile = romfiles[selection - 1].ToString();
				} else {
					Program.fatal("Invalid selection.");
				}
			}
			if (!File.Exists(romfile)) {
				if (romfiles == null) {
					db.Remove(romfile);
					fatal("The ROM file with hash of " + movie.Hash + " was identified in the database, but the file '" + romfile + "' associated with it was not found. The dead entry has been removed from the database.");
				}
			}
			_emuExec(emufile, movie, romfile);
			db.Close();
		}