Exemplo n.º 1
0
        public static SteamLaunchableModSource Make(UInt32 HostAppID, string ModDir, VObject gameInfo = null)
        {
            VObject GameInfoObj = (VObject)(gameInfo.ContainsKey("GameInfo") ? gameInfo["GameInfo"] : null);
            VToken  GameObj     = GameInfoObj != null?GameInfoObj.ContainsKey("game") ? GameInfoObj["game"] : null : null;

            VToken IconObj = GameInfoObj != null?GameInfoObj.ContainsKey("icon") ? GameInfoObj["icon"] : null : null;

            SteamLaunchableModSource src = new SteamLaunchableModSource(HostAppID, ModDir, GameObj?.ToString())
            {
                ModIcon = IconObj?.ToString()
            };

            return(src);
        }
Exemplo n.º 2
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);
        }