private string GetDynatraceLink() { if (SourceFile.Contains("sprint_")) { int sprintOffset = SourceFile.IndexOf("sprint_"); return("branches/" + SourceFile.Substring(sprintOffset)); } else if (SourceFile.Contains("trunk")) { int trunkOffset = SourceFile.IndexOf("trunk"); return(SourceFile.Substring(trunkOffset)); } else { return(null); } }
private bool IsDynatraceLinkAvailable(char separator) { return(!string.IsNullOrEmpty(RepositoryUrl) && (SourceFile.Contains($"{separator}agent{separator}native") || SourceFile.Contains("sprint_"))); }
public static void BuildArchive(string SourceDir, ModEntry metaData, string outputFilePath) { string buildDir = Directory.GetCurrentDirectory() + "\\build"; if (Directory.Exists(buildDir)) { Directory.Delete(buildDir, true); } Directory.CreateDirectory("_build"); // check for FPKs that must be built and build metaData.ModFpkEntries = new List <ModFpkEntry>(); List <string> builtFpks = new List <string>(); foreach (string FpkDir in ListFpkFolders(SourceDir)) { foreach (ModFpkEntry fpkEntry in BuildFpk(FpkDir, SourceDir)) { metaData.ModFpkEntries.Add(fpkEntry); if (!builtFpks.Contains(fpkEntry.FpkFile)) { builtFpks.Add(fpkEntry.FpkFile); } } } // check for other FPKs and build fpkentry data foreach (string SourceFile in Directory.GetFiles(SourceDir, "*.fpk*", SearchOption.AllDirectories)) { //tex chunk0\Assets\tpp\pack\collectible\common\col_common_tpp_fpk\Assets\tpp\pack\resident\resident00.fpkl is the only fpkl, don't know what a fpkl is, but gzcore crashes on it. if (SourceFile.Contains(".fpkl")) { continue; } string FileName = Tools.ToQarPath(SourceFile.Substring(SourceDir.Length)); if (!builtFpks.Contains(FileName)) { // unpack FPK and build FPK list foreach (string file in GzsLib.ListArchiveContents <FpkFile>(SourceFile)) { string fpkDir = Tools.ToWinPath(FileName.Replace(".fpk", "_fpk")); string fpkFullDir = Path.Combine(SourceDir, fpkDir); if (!Directory.Exists(fpkFullDir)) { GzsLib.ExtractArchive <FpkFile>(SourceFile, fpkFullDir); } metaData.ModFpkEntries.Add(new ModFpkEntry() { FilePath = file, FpkFile = FileName, ContentHash = Tools.GetMd5Hash(Path.Combine(SourceDir, fpkDir, Tools.ToWinPath(file))) }); } } } // build QAR entries metaData.ModQarEntries = new List <ModQarEntry>(); foreach (string qarFile in ListQarFiles(SourceDir)) { string subDir = qarFile.Substring(0, qarFile.LastIndexOf("\\")).Substring(SourceDir.Length).TrimStart('\\'); // the subdirectory for XML output string qarFilePath = Tools.ToQarPath(qarFile.Substring(SourceDir.Length)); if (!Directory.Exists(Path.Combine("_build", subDir))) { Directory.CreateDirectory(Path.Combine("_build", subDir)); // create file structure } File.Copy(qarFile, Path.Combine("_build", Tools.ToWinPath(qarFilePath)), true); ulong hash = Tools.NameToHash(qarFilePath); metaData.ModQarEntries.Add(new ModQarEntry() { FilePath = qarFilePath, Compressed = qarFile.Substring(qarFile.LastIndexOf(".") + 1).Contains("fpk") ? true : false, ContentHash = Tools.GetMd5Hash(qarFile), Hash = hash }); } //tex build external entries metaData.ModFileEntries = new List <ModFileEntry>(); foreach (string externalFile in ListExternalFiles(SourceDir)) { string subDir = externalFile.Substring(0, externalFile.LastIndexOf("\\")).Substring(SourceDir.Length).TrimStart('\\'); // the subdirectory for XML output string externalFilePath = Tools.ToQarPath(externalFile.Substring(SourceDir.Length)); if (!Directory.Exists(Path.Combine("_build", subDir))) { Directory.CreateDirectory(Path.Combine("_build", subDir)); // create file structure } File.Copy(externalFile, Path.Combine("_build", Tools.ToWinPath(externalFilePath)), true); string strip = "/" + ExternalDirName; if (externalFilePath.StartsWith(strip)) { externalFilePath = externalFilePath.Substring(strip.Length); } //ulong hash = Tools.NameToHash(qarFilePath); metaData.ModFileEntries.Add(new ModFileEntry() { FilePath = externalFilePath, ContentHash = Tools.GetMd5Hash(externalFile) }); } metaData.SBVersion.Version = SnakeBiteVersionStr; metaData.SaveToFile("_build\\metadata.xml"); // build archive FastZip zipper = new FastZip(); zipper.CreateZip(outputFilePath, "_build", true, "(.*?)"); Directory.Delete("_build", true); }