public List <string> GetMountedPaths() { List <string> result = new List <string>(); string gamePath = game.installPath; string modPath = installPath; SourceSDK.KeyValue gameInfo = null; SourceSDK.KeyValue searchPaths = null; switch (game.engine) { case Engine.SOURCE: gameInfo = SourceSDK.KeyValue.readChunkfile(modPath + "\\gameinfo.txt"); searchPaths = gameInfo.findChildByKey("searchpaths"); break; case Engine.SOURCE2: gameInfo = SourceSDK.KeyValue.readChunkfile(modPath + "\\gameinfo.gi"); searchPaths = gameInfo.findChildByKey("searchpaths"); break; case Engine.GOLDSRC: searchPaths = new SourceSDK.KeyValue("searchpaths"); searchPaths.addChild(new SourceSDK.KeyValue("game", new DirectoryInfo(installPath).Name)); searchPaths.addChild(new SourceSDK.KeyValue("game", "valve")); break; } foreach (SourceSDK.KeyValue searchPath in searchPaths.getChildren()) { string[] keys = searchPath.getKey().Split('+'); if (!keys.Contains("game")) { continue; } string value = searchPath.getValue(); switch (game.engine) { case Engine.SOURCE: value = value.Replace("/", "\\"); if (value.Contains("|all_source_engine_paths|")) { value = value.Replace("|all_source_engine_paths|", gamePath + "\\"); } else if (value.Contains("|gameinfo_path|")) { value = value.Replace("|gameinfo_path|", modPath + "\\"); } else if (!Directory.Exists(value)) { value = gamePath + "\\" + value; } value = value.Replace("\\\\", "\\"); if (value.EndsWith("/")) { value = value.Substring(0, value.Length - 1); } break; case Engine.SOURCE2: value = gamePath + "\\game\\" + value; // We can't mount the vpks because we have no vpk.exe /*foreach(string file in Directory.GetFiles(value, "*.vpk", SearchOption.AllDirectories)) * { * string fileName = Path.GetFileNameWithoutExtension(file); * if (int.TryParse(fileName.Substring(fileName.Length - 3), out _)) * continue; * * result.Add(file.Replace("_dir.vpk", ".vpk")); * }*/ break; case Engine.GOLDSRC: value = gamePath + "\\" + value; break; } result.Add(value); } return(result.Distinct().ToList()); }