Esempio n. 1
0
        /// <summary>
        /// Use to enumerate Emulator files from known Emulator exes
        /// 
        /// Searches for the emulator binary listed in the app.config
        /// </summary>
        /// <param name="directory"></param>
        /// <returns>Emulator count</returns>
        public static int EnumerateEmulators(string rootEmuDirectory)
        {
            string[] emulatorConsoleAssociations = new EmuManagerModel().EmulatorAssociations.Split(';');

            int emulatorCount = 0;
            foreach (string association in emulatorConsoleAssociations)
            {
                try
                {
                    // EX association: PS1:ePSXe.exe
                    string emulator = association.Split(':')[1];

                    string[] files = System.IO.Directory.GetFiles(rootEmuDirectory, emulator,
                        SearchOption.AllDirectories);

                    emulatorCount += files.Length;
                }
                catch (NullReferenceException)
                {
                    // This would mean an improperly formatted emulator association was present if hit
                    continue;
                }
            <<<<<<< HEAD
            =======
                catch (IOException)
                {
                    // This would mean the emulator directory was set incorrectly or unreadable
                    continue;
                }
            >>>>>>> origin/master

            }

            return emulatorCount;
        }
Esempio n. 2
0
        /// <summary>
        /// Use to enumerate ROM files from known ROM file types
        /// 
        /// Searches for the roms with extensions listed in the app.config
        /// </summary>
        /// <param name="rootRomDirectory"></param>
        /// <returns>ROM file count</returns>
        public static int EnumerateRomFiles(string rootRomDirectory)
        {
            var romExtensionsCSV = new EmuManagerModel().RomExtensions;

            string[] romExtensions = romExtensionsCSV.Split(',');

            int romCount = 0;
            foreach (string extension in romExtensions)
            {
        private static void WriteShortcutFile(string shortcutText)
        {
            string steamDirectory = new EmuManagerModel().SteamDirectory;

            steamDirectory = steamDirectory + @"\userdata\";
            foreach (var directory in Directory.EnumerateDirectories(steamDirectory))
            {
                File.WriteAllText(directory + @"\config\shortcuts.vdf", shortcutText);
            }
        }
        public EmuManagerViewModel()
        {
            EmuManagerModel = new EmuManagerModel();

            LoadRomsAndEmulatorsCommand = new LoadRomsAndEmulatorsCommand(this);
            CleanRomNamesCommand = new CleanRomNamesCommand(this);
            RevertRomStreamingCompatibilityCommand = new RevertRomStreamingCompatibilityCommand(this);
            FixRomStreamingCompatibilityCommand = new FixRomStreamingCompatibilityCommand(this);
            CreateSteamShortcutsCommand = new CreateSteamShortcutsCommand(this);
            DeleteSteamShortcutsCommand = new DeleteSteamShortcutsCommand(this);

            if (EmuManagerModel.AutoImportRoms)
            {
                LoadRomsAndEmulatorsAsync(false);
            }
        }