Fix substring issue

internals
CallumDev 4 years ago
parent b0b72b5a83
commit 181ceb5451
  1. 7
      src/CodeGenerator/ImguiDefinitions.cs

@ -355,12 +355,13 @@ namespace CodeGenerator
TemplateType = templateType; TemplateType = templateType;
ArraySize = asize; ArraySize = asize;
int startBracket = name.IndexOf('['); int startBracket = name.IndexOf('[');
if (startBracket != -1 && ArraySize == 0) if (startBracket != -1)
{ {
//This is only for older cimgui binding jsons //This is only for older cimgui binding jsons
int endBracket = name.IndexOf(']'); int endBracket = name.IndexOf(']');
string sizePart = name.Substring(startBracket + 1, endBracket - startBracket - 1); string sizePart = name.Substring(startBracket + 1, endBracket - startBracket - 1);
ArraySize = ParseSizeString(sizePart, enums); if(ArraySize == 0)
ArraySize = ParseSizeString(sizePart, enums);
Name = Name.Substring(0, startBracket); Name = Name.Substring(0, startBracket);
} }
IsFunctionPointer = Type.IndexOf('(') != -1; IsFunctionPointer = Type.IndexOf('(') != -1;
@ -517,4 +518,4 @@ namespace CodeGenerator
return new OverloadDefinition(ExportedName, FriendlyName, parameters, DefaultValues, ReturnType, StructName, Comment, IsConstructor, IsDestructor); return new OverloadDefinition(ExportedName, FriendlyName, parameters, DefaultValues, ReturnType, StructName, Comment, IsConstructor, IsDestructor);
} }
} }
} }

Loading…
Cancel
Save