From 70a7b35459b260377b7487981b65839a02e3a8c6 Mon Sep 17 00:00:00 2001 From: Thraka Date: Wed, 23 Nov 2022 15:47:09 -0800 Subject: [PATCH] use logic that makes sense --- src/CodeGenerator/ImguiDefinitions.cs | 8 ++++---- src/CodeGenerator/Program.cs | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/CodeGenerator/ImguiDefinitions.cs b/src/CodeGenerator/ImguiDefinitions.cs index c9cc936..0dd327f 100644 --- a/src/CodeGenerator/ImguiDefinitions.cs +++ b/src/CodeGenerator/ImguiDefinitions.cs @@ -21,7 +21,7 @@ namespace CodeGenerator if (v == null) return 0; return v.ToObject(); } - public void LoadFrom(string directory, bool excludeInternals = true) + public void LoadFrom(string directory, bool useInternals = false) { JObject typesJson; @@ -67,7 +67,7 @@ namespace CodeGenerator string name = jp.Name; bool isInternal = typeLocations?[jp.Name]?.Value().Contains("internal") ?? false; - if (excludeInternals && isInternal) + if (!useInternals && isInternal) return null; EnumMember[] elements = jp.Values().Select(v => @@ -83,7 +83,7 @@ namespace CodeGenerator string name = jp.Name; bool isInternal = typeLocations?[jp.Name]?.Value().Contains("internal") ?? false; - if (excludeInternals && isInternal) + if (!useInternals && isInternal) return null; TypeReference[] fields = jp.Values().Select(v => @@ -125,7 +125,7 @@ namespace CodeGenerator } if (friendlyName == null) { return null; } bool isInternal = val["location"]?.ToString().Contains("internal") ?? false; - if (excludeInternals && isInternal) + if (!useInternals && isInternal) return null; string exportedName = ov_cimguiname; diff --git a/src/CodeGenerator/Program.cs b/src/CodeGenerator/Program.cs index fb39deb..b30cb68 100644 --- a/src/CodeGenerator/Program.cs +++ b/src/CodeGenerator/Program.cs @@ -9,8 +9,6 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.CommandLine; -using System.Linq.Expressions; -using System.Runtime.CompilerServices; namespace CodeGenerator { @@ -126,7 +124,7 @@ namespace CodeGenerator string definitionsPath = Path.Combine(AppContext.BaseDirectory, "definitions", libraryName); var defs = new ImguiDefinitions(); - defs.LoadFrom(definitionsPath, !useInternals); + defs.LoadFrom(definitionsPath, useInternals); Console.WriteLine($"Outputting generated code files to {outputPath}.");