예제 #1
0
        /// <summary>
        /// Search the "CustomGames" folder for binaries (.exe) files to import
        /// </summary>
        private static void FindCustomBinaries(ref CGameData.CTempGameSet tempGameSet)
        {
            List <string> fileList = Directory.EnumerateFiles(GAME_FOLDER_NAME, "*", SearchOption.AllDirectories).Where(s => s.EndsWith(".exe")).ToList();

            foreach (string file in fileList)
            {
                string strTitle  = Path.GetFileNameWithoutExtension(file);
                string strLaunch = Path.GetFullPath(file);
                tempGameSet.InsertGame(strTitle, strLaunch, false, CUSTOM_PLATFORM);
            }
        }
예제 #2
0
        /// <summary>
        /// Scan the registry for games, add new games to memory and export into JSON document
        /// </summary>
        public static void ScanGames()
        {
            CGameData.CTempGameSet tempGameSet = new CGameData.CTempGameSet();
            List <CRegScanner.RegistryGameData> gameDataList = CRegScanner.GetGames();

            foreach (CRegScanner.RegistryGameData data in gameDataList)
            {
                tempGameSet.InsertGame(data.m_strTitle, data.m_strLaunch, false, data.m_strPlatform);
            }
            CGameFinder.ImportFromFolder(ref tempGameSet);
            CGameData.MergeGameSets(tempGameSet);
            CJsonWrapper.Export(CGameData.GetPlatformGameList(CGameData.GamePlatform.All).ToList());
        }
예제 #3
0
        /// <summary>
        /// Search the "CustomGames" folder for file shortcuts (.lnk) to import.
        /// </summary>
        /// http://www.saunalahti.fi/janij/blog/2006-12.html#d6d9c7ee-82f9-4781-8594-152efecddae2
        private static void FindCustomLinkFiles(ref CGameData.CTempGameSet tempGameSet)
        {
            List <string> fileList = Directory.EnumerateFiles(GAME_FOLDER_NAME, "*", SearchOption.TopDirectoryOnly).Where(s => s.EndsWith(".lnk")).ToList();

            foreach (string file in fileList)
            {
                string strPathOnly = Path.GetDirectoryName(file);
                strPathOnly = Path.GetFullPath(strPathOnly);
                string strFilenameOnly = Path.GetFileName(file);

                Shell32.Shell      shell      = new Shell32.Shell();
                Shell32.Folder     folder     = shell.NameSpace(strPathOnly);
                Shell32.FolderItem folderItem = folder.ParseName(strFilenameOnly);
                if (folderItem != null)
                {
                    Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink;
                    string strTitle  = Path.GetFileNameWithoutExtension(file);
                    string strLaunch = link.Path;
                    tempGameSet.InsertGame(strTitle, strLaunch, false, CUSTOM_PLATFORM);
                }
            }
        }