private string GetInstallPath(string steamInstallPath) { string installPath = string.Empty; string basePath = string.Format(@"{0}\{1}", steamInstallPath, "steamapps"); string[] files = Directory.GetFiles(basePath, "*.acf"); foreach (var file in files) { var reader = new AcfReader(file); if (reader.CheckIntegrity()) { var manifestObject = reader.ACFFileToStruct(); ACF_Struct appState = null; manifestObject.SubACF.TryGetValue("AppState", out appState); if (appState != null) { string gameName = null; appState.SubItems.TryGetValue("name", out gameName); if (gameName != null && gameName == ReflexNameInSteam) { installPath = string.Format(@"{0}\steamapps\common\{1}", steamInstallPath, manifestObject.SubACF["AppState"].SubItems["installdir"]); break; } } } } return(installPath); }
private string[] GetLibraryFolders(string steamInstallPath) { List <string> libraryFolders = new List <string>(); string libraryFoldersManifest = string.Format(@"{0}\{1}\libraryfolders.vdf", steamInstallPath, "steamapps"); if (File.Exists(libraryFoldersManifest)) { var reader = new AcfReader(libraryFoldersManifest); if (reader.CheckIntegrity()) { var manifestObject = reader.ACFFileToStruct(); for (int i = 1; ; ++i) //infinite loop { if (manifestObject.SubACF["LibraryFolders"].SubItems.ContainsKey(i.ToString())) { libraryFolders.Add(manifestObject.SubACF["LibraryFolders"].SubItems[i.ToString()].Replace(@"\\", @"\")); } else // no more steam libraries { break; } } } } return(libraryFolders.ToArray()); }