Ejemplo n.º 1
0
 private string GetPropertyTypeDeclaration(MetaDumpProperty property, Dictionary <uint, string> classNames)
 {
     return(BinUtilities.UnpackType(property.Type) switch
     {
         BinPropertyType.Container => GetContainerTypeDeclaration(property.OtherClass, property.Container, false, classNames),
         BinPropertyType.UnorderedContainer => GetContainerTypeDeclaration(property.OtherClass, property.Container, true, classNames),
         BinPropertyType.Structure => GetStructureTypeDeclaration(property.OtherClass, classNames),
         BinPropertyType.Embedded => GetEmbeddedTypeDeclaration(property.OtherClass, classNames),
         BinPropertyType.Optional => GetOptionalTypeDeclaration(property.OtherClass, property.Container, classNames),
         BinPropertyType.Map => GetMapTypeDeclaration(property.OtherClass, property.Map, classNames),
         BinPropertyType type => GetPrimitivePropertyTypeDeclaration(type, true)
     });
Ejemplo n.º 2
0
        private void WritePropertyAttribute(StreamWriter sw, MetaDumpProperty property, Dictionary <uint, string> propertyNames)
        {
            BinPropertyType propertyType = BinUtilities.UnpackType(property.Type);

            if (propertyNames.TryGetValue(property.Hash, out string propertyName))
            {
                sw.WriteLineIndented(2, @"[MetaProperty(""{0}"", BinPropertyType.{1})]", propertyName, propertyType);
            }
            else
            {
                sw.WriteLineIndented(2, @"[MetaProperty({0}, BinPropertyType.{1})]", property.Hash, propertyType);
            }
        }
Ejemplo n.º 3
0
        private void WriteProperty(StreamWriter sw, MetaDumpClass dumpClass, MetaDumpProperty property, bool isPublic, Dictionary <uint, string> classNames, Dictionary <uint, string> propertyNames)
        {
            WritePropertyAttribute(sw, property, propertyNames);

            string visibility      = isPublic ? "public " : string.Empty;
            string typeDeclaration = GetPropertyTypeDeclaration(property, classNames);
            string propertyName    = StylizePropertyName(GetPropertyNameOrDefault(property.Hash, propertyNames));

            // Check that property name isn't the same as the class name
            string className = GetClassNameOrDefault(dumpClass.Hash, classNames);

            if (className == propertyName)
            {
                propertyName = 'm' + propertyName;
            }

            string formatted = string.Format("{0}{1} {2}", visibility, typeDeclaration, propertyName);

            sw.WriteLineIndented(2, formatted + " { get; set; }");
        }