diff --git a/ComfySharp/ComfyClient.cs b/ComfySharp/ComfyClient.cs index 73ca555..aa1041f 100644 --- a/ComfySharp/ComfyClient.cs +++ b/ComfySharp/ComfyClient.cs @@ -74,7 +74,7 @@ public class ComfyClient { if (req is { IsSuccessStatusCode: true, Content: not null }) { var doc = await req.Content.ReadFromJsonAsync(); dbGenerator.GenerateClasses(doc); - //ObjectInfoParser.Parse(doc, out nodes); + } return null; diff --git a/ComfySharp/NodeDBGenerator.cs b/ComfySharp/NodeDBGenerator.cs index ff03cda..f2df445 100644 --- a/ComfySharp/NodeDBGenerator.cs +++ b/ComfySharp/NodeDBGenerator.cs @@ -87,14 +87,19 @@ public class NodeDBGenerator { } } + /// + /// Generates C# classes for all known types, enums and stringLists, then also for every node + /// + /// JsonDocument containing the nodes off an objectInfo api call public void GenerateClasses(JsonDocument document) { + Logger.Info("NodeDB Scan phase 1: building Types, Enum and StringLists DataBases"); foreach (var node in document.RootElement.EnumerateObject()) ScanNode(node); string types = ""; foreach (var knownType in knownTypes) types += $"\t{knownType}"; - Logger.Info($"List of recognized Types:\n{types}"); + Logger.Debug($"List of recognized Types:\n{types}"); Logger.Info($"Total amount of types iterated: {typeFields}\n"); string enums = ""; @@ -104,8 +109,11 @@ public class NodeDBGenerator { enums += $"\t{value}"; enums += "\n"; } - Logger.Info($"List of recognized Enums: {enums}"); + Logger.Debug($"List of recognized Enums: {enums}"); Logger.Info($"Total amount of enums iterated: {enumFields}\n"); + + Logger.Info("NodeDB Scan phase 2: generating types"); + } /// @@ -131,7 +139,7 @@ public class NodeDBGenerator { /// Executed on the input property inside a node /// private void ScanInputs(JsonProperty input) { - Logger.Debug($"Scanning inputs of node: {input.Name}"); + Logger.Trace($"Scanning inputs of node: {input.Name}"); foreach (var inputType in input.Value.EnumerateObject()) { //these are related to the nodes themselves and useless for us if (inputType.Name == "hidden") continue; @@ -145,7 +153,7 @@ public class NodeDBGenerator { /// Executed for each of the elements inside a required or optional input /// private void ScanInputField(JsonProperty inputProperty) { - Logger.Debug($"Scanning input field: {inputProperty.Name}"); + Logger.Trace($"Scanning input field: {inputProperty.Name}"); // if element 0 is a string, this is a type if (inputProperty.Value[0].ValueKind == JsonValueKind.String) { @@ -186,8 +194,11 @@ public class NodeDBGenerator { } } + /// + /// Executed for each output array of every node. + /// private void ScanOutputs(JsonProperty output) { - Logger.Debug($"Scanning outputs of node: {output.Name}"); + Logger.Trace($"Scanning outputs of node: {output.Name}"); foreach (var outputType in output.Value.EnumerateArray()) AddKnownType(outputType.GetString()!); }