Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Feb 16, 2024
2 parents d217d45 + 4e1b66b commit 0019e9c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/GUI/RevEng.Shared/Cli/CliConfigMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public static ReverseEngineerCommandOptions ToOptions(this CliConfig config, str

public static bool TryGetCliConfig(string fullPath, string connectionString, DatabaseType databaseType, List<TableModel> objects, CodeGenerationMode codeGenerationMode, out CliConfig config, out List<string> warnings)
{
if (File.Exists(fullPath))
var cliConfigExists = File.Exists(fullPath);
if (cliConfigExists)
{
config = JsonSerializer.Deserialize<CliConfig>(File.ReadAllText(fullPath, Encoding.UTF8));
}
Expand Down Expand Up @@ -147,10 +148,13 @@ public static bool TryGetCliConfig(string fullPath, string connectionString, Dat

warnings = ValidateExcludedColumns(config, objects);

if (!cliConfigExists || config.CodeGeneration.RefreshObjectLists)
{
#pragma warning disable CA1869 // Cache and reuse 'JsonSerializerOptions' instances
var options = new JsonSerializerOptions { WriteIndented = true };
var options = new JsonSerializerOptions { WriteIndented = true };
#pragma warning restore CA1869 // Cache and reuse 'JsonSerializerOptions' instances
File.WriteAllText(fullPath, JsonSerializer.Serialize(config, options), Encoding.UTF8);
File.WriteAllText(fullPath, JsonSerializer.Serialize(config, options), Encoding.UTF8);
}

return true;
}
Expand Down

0 comments on commit 0019e9c

Please sign in to comment.