Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add await
  • Loading branch information
praveenkuttappan committed Jul 16, 2024
commit c5b40b23c0a7edcc7f6f31fad4140a415b7fdecf
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static async Task HandlePackageFileParsing(Stream stream, FileInfo packageFilePa
return;
}

var parsedFileName = string.IsNullOrEmpty(outputFileName) ? assemblySymbol.Name : Path.GetFileName(outputFileName);
var parsedFileName = string.IsNullOrEmpty(outputFileName) ? assemblySymbol.Name : outputFileName;
var treeTokenCodeFile = new CSharpAPIParser.TreeToken.CodeFileBuilder().Build(assemblySymbol, runAnalysis, dependencies);
var gzipJsonTokenFilePath = Path.Combine(OutputDirectory.FullName, $"{parsedFileName}.json.tgz");

Expand All @@ -123,11 +123,9 @@ static async Task HandlePackageFileParsing(Stream stream, FileInfo packageFilePa
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};

{
using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
JsonSerializer.Serialize(new Utf8JsonWriter(gZipStream, new JsonWriterOptions { Indented = false }), treeTokenCodeFile, options);
}
await using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
await using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
JsonSerializer.Serialize(new Utf8JsonWriter(gZipStream, new JsonWriterOptions { Indented = false }), treeTokenCodeFile, options);

Console.WriteLine($"TokenCodeFile File {gzipJsonTokenFilePath} Generated Successfully.");
Console.WriteLine();
Expand Down