コード例 #1
0
        public CProperty GetProperty()
        {
            // First, read the length and value of the following property name string
            int    propNameLength = GetInt();
            string propName       = GetString(propNameLength);

            SkipPadding();

            // If this is a "None" ending type property, just return - nothing else will follow this
            if (propName == "None")
            {
                return(null);
            }

            // Get the property type string
            int    typeNameLength = GetInt();
            string typeName       = GetString(typeNameLength);

            SkipPadding();

            // Skip past the size of the following data and its padding
            GetInt();
            SkipPadding();

            // Finally, read the data based on the property type
            CProperty returnProperty;

            switch (typeName)
            {
            case "ArrayProperty":
                returnProperty = new ArrayProperty(propName, this);
                break;

            case "IntProperty":
                returnProperty = new IntProperty(propName, this);
                break;

            case "StrProperty":
                returnProperty = new StrProperty(propName, this);
                break;

            case "NameProperty":
                returnProperty = new NameProperty(propName, this);
                break;

            case "StructProperty":
                returnProperty = new StructProperty(propName, this, _outputter);
                break;

            case "BoolProperty":
                returnProperty = new BoolProperty(propName, this);
                break;

            default:
                throw new Exception($"Unexpected property type: {typeName}");
            }

            returnProperty.ParseData();
            return(returnProperty);
        }
コード例 #2
0
        public static StructProperty CreateAppearanceProperty()
        {
            var props = new CProperty[]
            {
                NameProperty.Create("nmHead"),
                IntProperty.Create("iGender", 1),
                IntProperty.Create("iRace"),
                NameProperty.Create("nmHaircut"),
                IntProperty.Create("iHairColor"),
                IntProperty.Create("iFacialHair"),
                NameProperty.Create("nmBeard"),
                IntProperty.Create("iSkinColor"),
                IntProperty.Create("iEyeColor"),
                NameProperty.Create("nmFlag"),
                IntProperty.Create("iVoice"),
                IntProperty.Create("iAttitude"),
                IntProperty.Create("iArmorDeco"),
                IntProperty.Create("iArmorTint"),
                IntProperty.Create("iArmorTintSecondary"),
                IntProperty.Create("iWeaponTint"),
                IntProperty.Create("iTattooTint"),
                NameProperty.Create("nmWeaponPattern"),
                NameProperty.Create("nmPawn", "None"),
                NameProperty.Create("nmTorso"),
                NameProperty.Create("nmArms"),
                NameProperty.Create("nmLegs"),
                NameProperty.Create("nmHelmet"),
                NameProperty.Create("nmEye", "DefaultEyes"),
                NameProperty.Create("nmTeeth", "DefaultTeeth"),
                NameProperty.Create("nmFacePropLower"),
                NameProperty.Create("nmFacePropUpper"),
                NameProperty.Create("nmPatterns"),
                NameProperty.Create("nmVoice"),
                NameProperty.Create("nmLanguage", "None"),
                NameProperty.Create("nmTattoo_LeftArm"),
                NameProperty.Create("nmTattoo_RightArm"),
                NameProperty.Create("nmScars"),
                NameProperty.Create("nmTorso_Underlay"),
                NameProperty.Create("nmArms_Underlay"),
                NameProperty.Create("nmLegs_Underlay"),
                NameProperty.Create("nmFacePaint"),
                NameProperty.Create("nmLeftArm"),
                NameProperty.Create("nmRightArm"),
                NameProperty.Create("nmLeftArmDeco"),
                NameProperty.Create("nmRightArmDeco"),
                NameProperty.Create("nmLeftForearm"),
                NameProperty.Create("nmRightForearm"),
                NameProperty.Create("nmThighs"),
                NameProperty.Create("nmShins", "None"),
                NameProperty.Create("nmTorsoDeco")
            };
            var structProp = StructProperty.Create("kAppearance", props);

            return(structProp);
        }