private static string CreateDepotVDF(SteamBuildConfig config, string outputPath) { string pathToBuild = BuildExecutor.GetFinalBuildPath(config); string buildPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetDirectoryName(pathToBuild)); string depotFileName = $"depot_build_{config.depotId}.vdf"; string depotPath = Path.Combine(outputPath, depotFileName); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("\"DepotBuildConfig\""); stringBuilder.AppendLine("{"); stringBuilder.AppendLine($"\t\"DepotID\" \"{config.depotId}\""); stringBuilder.AppendLine($"\t\"ContentRoot\" \"{buildPath}\""); stringBuilder.AppendLine($"\t\"FileMapping\""); stringBuilder.AppendLine("\t{"); stringBuilder.AppendLine($"\t\t\"LocalPath\" \"{config.localPath}\""); stringBuilder.AppendLine($"\t\t\"DepotPath\" \"{config.depotPath}\""); stringBuilder.AppendLine($"\t\t\"recursive\" \"{config.recursive}\""); stringBuilder.AppendLine("\t}"); int i = 0, l = config.fileExclusion.Length; for (; i < l; ++i) { stringBuilder.AppendLine($"\t\"FileExclusion\" \"{config.fileExclusion[i]}\""); } stringBuilder.AppendLine("}"); File.WriteAllText(depotPath, stringBuilder.ToString()); return(depotFileName); }
public static string CreateBuildFiles(string appId, string outputPath, string buildDescription, string setBranchLive, bool preview, params SteamBuildConfig[] configs) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("\"appbuild\""); stringBuilder.AppendLine("{"); stringBuilder.AppendLine($"\t\"appid\" \"{appId}\""); stringBuilder.AppendLine($"\t\"desc\" \"{buildDescription}\""); stringBuilder.AppendLine("\t\"buildoutput\" \".\\output\\\""); stringBuilder.AppendLine("\t\"contentroot\" \".\\content\\\""); stringBuilder.AppendLine($"\t\"setlive\" \"{setBranchLive}\""); stringBuilder.AppendLine($"\t\"preview\" \"{(preview ? "1" : "0")}\""); stringBuilder.AppendLine("\t\"local\" \"\""); stringBuilder.AppendLine("\t\"depots\""); stringBuilder.AppendLine("\t{"); int i = 0, l = configs.Length; for (; i < l; ++i) { SteamBuildConfig config = configs[i]; string depotPath = CreateDepotVDF(config, outputPath); stringBuilder.AppendLine($"\t\t\"{config.depotId}\" \"{depotPath}\""); } stringBuilder.AppendLine("\t}"); stringBuilder.AppendLine("}"); Directory.CreateDirectory(Path.Combine(outputPath, "content")); Directory.CreateDirectory(Path.Combine(outputPath, "output")); string appVDFPath = GetPathToAppVDF(outputPath, appId); File.WriteAllText(appVDFPath, stringBuilder.ToString()); return(appVDFPath); }