Skip to content

Commit

Permalink
Fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenkuttappan committed Sep 18, 2024
1 parent 1b4b8ed commit e99f537
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/dotnet/APIView/APIView.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpAPIParserTests", "..\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestReferenceWithInternalsVisibleTo", "..\Azure.ClientSdk.Analyzers\TestReferenceWithInternalsVisibleTo\TestReferenceWithInternalsVisibleTo.csproj", "{0FE36A2D-EB25-4119-A7DA-2605BB2516C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIViewJsonUtility", "APIViewJsonValidator\APIViewJsonUtility.csproj", "{424B9F9A-1518-40C3-B7D3-88B53A038A23}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIViewJsonUtility", "APIViewJsonUtility\APIViewJsonUtility.csproj", "{C1C37681-2D54-4BDF-A4B8-834EC29AAFCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -71,10 +71,10 @@ Global
{0FE36A2D-EB25-4119-A7DA-2605BB2516C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FE36A2D-EB25-4119-A7DA-2605BB2516C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FE36A2D-EB25-4119-A7DA-2605BB2516C2}.Release|Any CPU.Build.0 = Release|Any CPU
{424B9F9A-1518-40C3-B7D3-88B53A038A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{424B9F9A-1518-40C3-B7D3-88B53A038A23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{424B9F9A-1518-40C3-B7D3-88B53A038A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{424B9F9A-1518-40C3-B7D3-88B53A038A23}.Release|Any CPU.Build.0 = Release|Any CPU
{C1C37681-2D54-4BDF-A4B8-834EC29AAFCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1C37681-2D54-4BDF-A4B8-834EC29AAFCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1C37681-2D54-4BDF-A4B8-834EC29AAFCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1C37681-2D54-4BDF-A4B8-834EC29AAFCF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
27 changes: 13 additions & 14 deletions src/dotnet/APIView/APIViewJsonUtility/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public static int Main(string[] args)

try
{
var outputFileDirectory = outputDir?.FullName ?? jsonFilePath.Directory.FullName;
var outputFileDirectory = outputDir?.FullName ?? jsonFilePath.Directory?.FullName;
outputFileDirectory = outputFileDirectory == null? Path.GetTempPath() : outputFileDirectory;
if (dumpOption)
{

Expand Down Expand Up @@ -79,25 +80,23 @@ private static async Task GenerateReviewTextFromJson(Stream stream, string outpu

private static async Task ConvertToTreeModel(Stream stream, string outputFilePath)
{
CodeFile codeFile = null;
try
{
codeFile = await CodeFile.DeserializeAsync(stream, false, false);
var codeFile = await CodeFile.DeserializeAsync(stream, false, false);
if (codeFile != null)
{
codeFile.ConvertToTreeTokenModel();
Console.WriteLine("Converted APIView token model to parent - child token model");
codeFile.Tokens = null;
using var fileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write);
await codeFile.SerializeAsync(fileStream);
Console.WriteLine($"New APIView json parent - child token model file generated at {outputFilePath}");
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Input json is probably not using flat token model. Error reading input json file. : {ex.Message}");
throw;
}

if(codeFile != null)
{
codeFile.ConvertToTreeTokenModel();
Console.WriteLine("Converted APIView token model to parent - child token model");
codeFile.Tokens = null;
using var fileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write);
await codeFile.SerializeAsync(fileStream);
Console.WriteLine($"New APIView json parent - child token model file generated at {outputFilePath}");
}
}
}
}

0 comments on commit e99f537

Please sign in to comment.