/// <summary> /// Creates and stores the Idx file. /// </summary> string CreateIdxFile(string packageId, string packageVersion, string tempDirectory) { Trace.TraceInformation("#StartActivity CreateIdxFile " + packageId + " " + packageVersion); Trace.TraceInformation("Creating the idx file."); ElfieCmd cmd = new ElfieCmd(this._indexerVersion); string idxFile = cmd.RunIndexer(tempDirectory, packageId, packageVersion); Trace.TraceInformation("#StopActivity CreateIdxFile"); return idxFile; }
/// <summary> /// Runs the merger to create the ardb file. /// </summary> /// <param name="mergerVersion">The version of the merger tool to use to create the ardb file.</param> /// <param name="idxList">The directory with the idx files to include in the ardb file.</param> /// <param name="outputDirectory">The directory to save the ardb file to.</param> /// <returns></returns> string RunArdbMerger(Version mergerVersion, string idxDirectory, string outputDirectory) { Directory.CreateDirectory(outputDirectory); ElfieCmd cmd = new ElfieCmd(mergerVersion); string ardbFile = cmd.RunMerger(idxDirectory, outputDirectory); // Basic validation, just check that the ardb size is about the right number. int minimumArdbSize = Catalog2ElfieOptions.MinimumArdbTextSize; FileInfo ardbFileInfo = new FileInfo(ardbFile); SarifTraceListener.TraceInformation($"Verify the ardb.txt file size {ardbFileInfo.Length} > {minimumArdbSize}."); SarifTraceListener.TraceInformation("NG912", ardbFileInfo.Length.ToString()); if (ardbFileInfo.Length < minimumArdbSize) { throw new InvalidOperationException($"The ardb size was less than the minimum size. {ardbFileInfo.Length} < {minimumArdbSize}"); } return ardbFile; }