Esempio n. 1
0
        public List <SteamLaunchableModGoldSrc> GetGoldSrcMods()
        {
            // gold source mods
            List <SteamLaunchableModGoldSrc> GoldSourceMods = new List <SteamLaunchableModGoldSrc>();
            string AppInstallDir  = SteamProcessInfo.GetGoldSrcModPath();
            UInt32 sourceModAppID = 70;

            if (Directory.Exists(AppInstallDir))
            {
                Directory.GetDirectories(AppInstallDir)
                .Where(dr => !GoldSrcModSkipFolders.Contains(Path.GetFileName(dr)))
                .Where(dr => File.Exists(Path.Combine(dr, "liblist.gam")))
                .ToList().ForEach(dr =>
                {
                    //VObject rootObj = VdfConvert.Deserialize("\"GameInfo\"\r\n{\r\n" + File.ReadAllText(Path.Combine(dr, "liblist.gam")) + "\r\n}");
                    //VObject tmp = (VObject)rootObj["GameInfo"];
                    //VToken tmp2 = tmp["gamedir"];
                    //UInt64 tmpID = SteamLaunchableShortcut.GetModShortcutID(tmp2.ToString(), sourceModAppID);
                    //if (tmpID > 0) GoldSourceMods.Add(tmpID);

                    SteamLaunchableModGoldSrc mod = SteamLaunchableModGoldSrc.Make(sourceModAppID, dr, Path.Combine(dr, "liblist.gam"));
                    if (mod != null)
                    {
                        GoldSourceMods.Add(mod);
                    }
                });
            }
            return(GoldSourceMods);
        }
Esempio n. 2
0
 public void GetSteamPidTest()
 {
     if (!SteamProcessInfo.IsSteamInstalled)
     {
         Assert.Warn("Steam not installed");
     }
     Assert.NotZero(SteamProcessInfo.GetSteamPid(), "Steam PID is Zero, is Steam running?");
 }
Esempio n. 3
0
        public void GetSteamLibraryPathsTest()
        {
            List <string> Paths = SteamProcessInfo.GetSteamLibraryPaths().ToList();

            Assert.That(Paths.Count, Is.GreaterThan(0), "No Steam library paths found");
            Assert.That(Paths[0], Is.EqualTo(SteamProcessInfo.SteamInstallPath), "First Steam library path is not the default path");
            foreach (string path in Paths)
            {
                Assert.That(Directory.Exists(path), Is.True, "Returned library path does not exist");
            }
        }
Esempio n. 4
0
        public List <SteamLaunchableModSource> GetSourceMods()
        {
            // source mods
            List <SteamLaunchableModSource> SourceMods = new List <SteamLaunchableModSource>();

            {
                string sourceMods = SteamProcessInfo.GetSourceModPath();
                if (Directory.Exists(sourceMods))
                {
                    Directory.GetDirectories(sourceMods)
                    .Where(dr => File.Exists(Path.Combine(dr, "gameinfo.txt")))
                    .ToList().ForEach(dr =>
                    {
                        VObject rootObj = new VObject();
                        rootObj.Add(VdfConvert.Deserialize(File.ReadAllText(Path.Combine(dr, "gameinfo.txt"))));
                        VObject GameInfoObj   = (VObject)rootObj["GameInfo"];
                        VObject FileSystemObj = (VObject)GameInfoObj["FileSystem"];
                        VToken appID          = FileSystemObj["SteamAppId"];

                        UInt32 appIdCheck = 0;
                        if (!UInt32.TryParse(appID.ToString(), out appIdCheck))
                        {
                            return;
                        }
                        if (appIdCheck == 0)
                        {
                            return;
                        }

                        string AppInstallDir = SteamApps.GetAppInstallDir(appIdCheck);
                        if (!string.IsNullOrWhiteSpace(AppInstallDir))
                        {
                            SteamLaunchableModSource mod = SteamLaunchableModSource.Make(appIdCheck, dr, rootObj);
                            if (mod != null)
                            {
                                SourceMods.Add(mod);
                            }
                        }
                    });
                }
            }
            return(SourceMods);
        }