private Locator() { //the steam install folder steam_folder = new Lazy <string>(delegate { var key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); key = key.OpenSubKey(@"SOFTWARE\Valve\Steam"); var folder = key.GetValue("InstallPath") as string; return(folder); }, isThreadSafe: true); //a list of file paths of steam app folders steamapps_list = new Lazy <IReadOnlyList <string> >(delegate { var list = new List <string>(); var defaultApps = Path.Combine(SteamFolder, "SteamApps"); list.Add(defaultApps); var desr = VdfDeserializer.FromFile(Path.Combine(defaultApps, "libraryfolders.vdf")); var tbl = desr.Deserialize() as VdfTable; int i = 1; while (tbl.ContainsName(i.ToString())) { var p = (tbl[i.ToString()] as VdfString).Content; list.Add(Path.Combine(p, "SteamApps")); i++; } return(list.AsReadOnly()); }, isThreadSafe: true); users = new Lazy <IReadOnlyList <SteamUser> >(() => new List <SteamUser>(GetUserList()).AsReadOnly(), isThreadSafe: true); }
public static SteamCmdAppWorkshop ReadSteamCmdAppWorkshopFile(string file) { if (string.IsNullOrWhiteSpace(file) || !File.Exists(file)) { return(null); } var vdfSerializer = VdfDeserializer.FromFile(file); var vdf = vdfSerializer.Deserialize(); return(SteamCmdWorkshopDetailsResult.Deserialize(vdf)); }
private IEnumerable <SteamUser> GetUserList() { var cfgdir = Path.Combine(SteamFolder, "config"); var ulist = VdfDeserializer.FromFile(Path.Combine(cfgdir, "loginusers.vdf")).Deserialize() as VdfTable; foreach (var item in ulist) { var uid = item.Name; var uname = ((VdfString)((VdfTable)item)["PersonaName"]).Content; yield return(new SteamUser(uname, ulong.Parse(uid))); } }
/// <summary> /// Loads paths to all user steam libraries. /// </summary> private void LoadLibraries() { Libraries.Clear(); Libraries.Add(new Library(this, RootPath)); var librariesPath = Path.Combine(RootPath, "steamapps", "libraryfolders.vdf"); if (!File.Exists(librariesPath)) { return; } var folders = (VdfTable)VdfDeserializer.FromFile(librariesPath).Deserialize(); var index = 1; while (folders.TryGetValue(index.ToString(), out var value)) { Libraries.Add(new Library(this, ((VdfString)value).Content)); index++; } }
private string GetInstallPath(string gameid) { if (gamePaths.TryGetValue(gameid, out var v)) { return(v); } foreach (var apps in steamapps_list.Value) { if (File.Exists(Path.Combine(apps, $"appmanifest_{gameid}.acf"))) { var desr = VdfDeserializer.FromFile(Path.Combine(apps, $"appmanifest_{gameid}.acf")); var tbl = desr.Deserialize() as VdfTable; var dirName = (tbl["installdir"] as VdfString).Content; var p = Path.Combine(apps, "common", dirName); gamePaths.Add(gameid, p); return(p); } } return(null); }
public Game(string pathToManifest, string resourcesPath) { manifest = (VdfTable)VdfDeserializer.FromFile(pathToManifest).Deserialize(); this.resourcesPath = resourcesPath; }