use logic that makes sense

internals
Thraka 2 years ago
parent 2bedfd5898
commit 70a7b35459
  1. 8
      src/CodeGenerator/ImguiDefinitions.cs
  2. 4
      src/CodeGenerator/Program.cs

@ -21,7 +21,7 @@ namespace CodeGenerator
if (v == null) return 0; if (v == null) return 0;
return v.ToObject<int>(); return v.ToObject<int>();
} }
public void LoadFrom(string directory, bool excludeInternals = true) public void LoadFrom(string directory, bool useInternals = false)
{ {
JObject typesJson; JObject typesJson;
@ -67,7 +67,7 @@ namespace CodeGenerator
string name = jp.Name; string name = jp.Name;
bool isInternal = typeLocations?[jp.Name]?.Value<string>().Contains("internal") ?? false; bool isInternal = typeLocations?[jp.Name]?.Value<string>().Contains("internal") ?? false;
if (excludeInternals && isInternal) if (!useInternals && isInternal)
return null; return null;
EnumMember[] elements = jp.Values().Select(v => EnumMember[] elements = jp.Values().Select(v =>
@ -83,7 +83,7 @@ namespace CodeGenerator
string name = jp.Name; string name = jp.Name;
bool isInternal = typeLocations?[jp.Name]?.Value<string>().Contains("internal") ?? false; bool isInternal = typeLocations?[jp.Name]?.Value<string>().Contains("internal") ?? false;
if (excludeInternals && isInternal) if (!useInternals && isInternal)
return null; return null;
TypeReference[] fields = jp.Values().Select(v => TypeReference[] fields = jp.Values().Select(v =>
@ -125,7 +125,7 @@ namespace CodeGenerator
} }
if (friendlyName == null) { return null; } if (friendlyName == null) { return null; }
bool isInternal = val["location"]?.ToString().Contains("internal") ?? false; bool isInternal = val["location"]?.ToString().Contains("internal") ?? false;
if (excludeInternals && isInternal) if (!useInternals && isInternal)
return null; return null;
string exportedName = ov_cimguiname; string exportedName = ov_cimguiname;

@ -9,8 +9,6 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.CommandLine; using System.CommandLine;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
namespace CodeGenerator namespace CodeGenerator
{ {
@ -126,7 +124,7 @@ namespace CodeGenerator
string definitionsPath = Path.Combine(AppContext.BaseDirectory, "definitions", libraryName); string definitionsPath = Path.Combine(AppContext.BaseDirectory, "definitions", libraryName);
var defs = new ImguiDefinitions(); var defs = new ImguiDefinitions();
defs.LoadFrom(definitionsPath, !useInternals); defs.LoadFrom(definitionsPath, useInternals);
Console.WriteLine($"Outputting generated code files to {outputPath}."); Console.WriteLine($"Outputting generated code files to {outputPath}.");

Loading…
Cancel
Save