Skip to content

Commit d2fe090

Browse files
committed
Separate namespaces for generated projects
1 parent a5a66dd commit d2fe090

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/CodeGenerator/Program.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,18 @@ static void Main(string[] args)
3838
string projectNamespace = libraryName switch
3939
{
4040
"cimgui" => "ImGuiNET",
41-
"cimplot" => "ImGuiNET",
42-
"cimnodes" => "ImGuiNET",
43-
"cimguizmo" => "ImGuiNET",
41+
"cimplot" => "ImPlotNET",
42+
"cimnodes" => "ImNodesNET",
43+
"cimguizmo" => "ImGuizmoNET",
44+
_ => throw new NotImplementedException()
45+
};
46+
47+
bool referencesImGui = libraryName switch
48+
{
49+
"cimgui" => false,
50+
"cimplot" => true,
51+
"cimnodes" => true,
52+
"cimguizmo" => true,
4453
_ => throw new NotImplementedException()
4554
};
4655

@@ -99,6 +108,10 @@ static void Main(string[] args)
99108
writer.Using("System.Numerics");
100109
writer.Using("System.Runtime.CompilerServices");
101110
writer.Using("System.Text");
111+
if (referencesImGui)
112+
{
113+
writer.Using("ImGuiNET");
114+
}
102115
writer.WriteLine(string.Empty);
103116
writer.PushBlock($"namespace {projectNamespace}");
104117

@@ -262,6 +275,10 @@ static void Main(string[] args)
262275
writer.Using("System");
263276
writer.Using("System.Numerics");
264277
writer.Using("System.Runtime.InteropServices");
278+
if (referencesImGui)
279+
{
280+
writer.Using("ImGuiNET");
281+
}
265282
writer.WriteLine(string.Empty);
266283
writer.PushBlock($"namespace {projectNamespace}");
267284
writer.PushBlock($"public static unsafe partial class {classPrefix}Native");
@@ -331,6 +348,10 @@ static void Main(string[] args)
331348
writer.Using("System.Numerics");
332349
writer.Using("System.Runtime.InteropServices");
333350
writer.Using("System.Text");
351+
if (referencesImGui)
352+
{
353+
writer.Using("ImGuiNET");
354+
}
334355
writer.WriteLine(string.Empty);
335356
writer.PushBlock($"namespace {projectNamespace}");
336357
writer.PushBlock($"public static unsafe partial class {classPrefix}");

0 commit comments

Comments
 (0)