Inheritance: VDF.VDFFile
示例#1
0
        protected override void resetSteamPath()
        {
            string reg_path = null, set_path = null;
            RegistryHandler steam = new RegistryHandler("local_machine", "SOFTWARE\\Valve\\Steam", false);
            reg_path = isSteamPath(steam.getValue("InstallPath"));
            set_path = isSteamPath(Core.settings.steam_override);

            if (set_path != null)
                path = set_path;
            else if (reg_path != null)
                path = reg_path;
            else
                path = null;

            if (path != null) {
                DirectoryInfo read_me = new DirectoryInfo(Path.Combine(path, "steamapps"));
                // Loads the steam isntall path folders
                loadSteamPaths(read_me);

                // Loads the alt steam library folders
                if (File.Exists(Path.Combine(path, "config", "config.vdf"))) {
                    config_file = new SteamConfigFile(Path.Combine(path, "config", "config.vdf"));
                    foreach (string folder in config_file.BaseInstallFolders) {
                        read_me = new DirectoryInfo(Path.Combine(folder, "SteamApps"));
                        loadSteamPaths(read_me);
                    }
                }

                // Loads the steam cloud folders
                read_me = new DirectoryInfo(Path.Combine(path, "userdata"));
                if (read_me.Exists) {
                    DirectoryInfo[] read_us;
                    read_us = read_me.GetDirectories();
                    foreach (DirectoryInfo subDir in read_us) {
                        setUserEv(subDir.Name, EnvironmentVariable.SteamUserData, subDir.FullName);
                    }
                    userdata_path = read_me.FullName;
                }

            } else {
                userdata_path = null;
                steam_apps_path = null;
            }
        }
示例#2
0
        public static bool GetSteamLib()
        {
            try
            {
                bool status = false;
                if (File.Exists(@"D:\Games\Life Is Strange Episode 5\Binaries\Win32\LifeIsStrange.exe"))
                {
                    Dir = @"D:\Games\Life Is Strange Episode 5";
                    return true;
                }
                string SteamPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Valve\Steam", "SteamPath", null);
                SteamPath = SteamPath.Replace("/", @"\");
                if (!string.IsNullOrEmpty(SteamPath))
                {
                    var confselect = new SteamConfigFile(SteamPath + @"\config\config.vdf");
                    foreach (string folder in confselect.BaseInstallFolders)
                    {
                        if (File.Exists(folder + @"\steamapps\common\Life Is Strange\Binaries\Win32\LifeIsStrange.exe"))
                        {
                            Dir = folder + @"\steamapps\common\Life Is Strange";
                            return true;
                        }

                    }
                }
                if (!status)
                {
                    if (File.Exists(SteamPath + @"\steamapps\common\Life Is Strange\Binaries\Win32\LifeIsStrange.exe"))
                    {
                        status = true;
                        Dir = SteamPath + @"\steamapps\common\Life Is Strange";
                    }
                }
                return status;
            }
            catch
            {
                return false;
            }
        }