示例#1
0
        /// <summary>
        /// Gets the set of non-default folder paths where Elite:Dangerous may be installed.
        /// </summary>
        /// <returns>The set of alternate paths.</returns>
        /// <remarks>
        /// This method looks into the Windows Registry to locate a non-default installation location.
        /// Additionally, it will include results from any Steam Libraries found.
        /// </remarks>
        public static IEnumerable <string> GetAlternatePaths()
        {
            // Reference: https://github.com/Bemoliph/Elite-Dangerous-Downloader/blob/master/downloader.py
            var launcherPath = (string)Registry.GetValue(
                @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{696F8871-C91D-4CB1-825D-36BE18065575}_is1",
                "InstallLocation",
                null);

            if (launcherPath != null)
            {
                yield return(Path.Combine(launcherPath, @"Products\elite-dangerous-64"));

                yield return(Path.Combine(launcherPath, @"Products\elite-dangerous-odyssey-64"));
            }

            var steamLibraryFolders = SteamLibraryFolders.FromFile(SteamLibraryFolders.DefaultPath);

            if (steamLibraryFolders != null)
            {
                foreach (var folder in steamLibraryFolders)
                {
                    yield return(Path.Combine(folder, @"steamapps\common\Elite Dangerous\Products\elite-dangerous-64"));

                    yield return(Path.Combine(folder, @"steamapps\common\Elite Dangerous\Products\elite-dangerous-odyssey-64"));
                }
            }
        }
示例#2
0
        public void SteamLibraryFoldersFromFileGetsTheListOfFolders()
        {
            var slf = SteamLibraryFolders.FromFile(@"TestFiles\libraryfolders.vdf");

            Assert.Equal(2, slf.Count);
            Assert.Equal(@"C:\Games\Path1", slf[0]);
            Assert.Equal("D:", slf[1]);
        }
示例#3
0
        public void SteamLibraryFoldersFromFileReturnsNullOnMissingOrInvalidFile(string contents)
        {
            using var tf = new TestFolder();
            string filename = $"libraryfolders.vdf";

            if (contents != null)
            {
                tf.WriteText(filename, contents);
            }

            Assert.Null(SteamLibraryFolders.FromFile(tf.Resolve(filename)));
        }