private static string GeneratePropertyType(BINProperty metaProperty, Dictionary <uint, string> classNames) { string type = ""; if (IsPrimitiveType(metaProperty.type)) { type = TypeToObject[metaProperty.type]; } else if (metaProperty.type == BINValueType.Structure || metaProperty.type == BINValueType.Embedded) { type = GenerateStructureType(metaProperty, classNames); } else if (metaProperty.type == BINValueType.Container) { type = GenerateContainerType(metaProperty, classNames); } else if (metaProperty.type == BINValueType.Map) { type = GenerateMapType(metaProperty, classNames); } else if (metaProperty.type == BINValueType.LinkOffset) { type = GenerateLinkOffsetType(metaProperty, classNames); } else if (metaProperty.type == BINValueType.OptionalData) { type = GenerateOptionalDataType(metaProperty, classNames); } return(type); }
private static string GenerateOptionalDataType(BINProperty metaProperty, Dictionary <uint, string> classNames) { string type = ""; if (IsPrimitiveType(metaProperty.containerI.type)) { type = TypeToObject[metaProperty.containerI.type]; } else { type = GuessClassName(metaProperty.otherClass, classNames); } return("Optional<" + type + ">"); }
private static string GenerateContainerType(BINProperty metaProperty, Dictionary <uint, string> classNames) { string itemType = ""; if (IsPrimitiveType(metaProperty.containerI.type)) { itemType = TypeToObject[metaProperty.containerI.type]; } else { itemType = GuessClassName(metaProperty.otherClass, classNames); } return("List<" + itemType + ">"); }
private static string GenerateMapType(BINProperty metaProperty, Dictionary <uint, string> classNames) { string keyType = TypeToObject[metaProperty.mapI.key]; string valueType = ""; if (IsPrimitiveType(metaProperty.mapI.value)) { valueType = TypeToObject[metaProperty.mapI.value]; } else { valueType = GuessClassName(metaProperty.otherClass, classNames); } return("Dictionary<" + keyType + ", " + valueType + ">"); }
private static string GenerateLinkOffsetType(BINProperty metaProperty, Dictionary <uint, string> classNames) { return("Link<" + GuessClassName(metaProperty.otherClass, classNames) + ">"); }
private static string GenerateStructureType(BINProperty metaProperty, Dictionary <uint, string> classNames) { return(GuessClassName(metaProperty.otherClass, classNames));; }