public static byte[] WriteProperty(CProperty property) { var bytes = new List <byte>(); // Write length and name of property var formattedName = WriteString(property?.Name ?? "None"); bytes.AddRange(WriteInt(formattedName.Length)); bytes.AddRange(formattedName); bytes.AddRange(WritePadding()); // If this was a "None" property, nothing else is needed if (property == null) { return(bytes.ToArray()); } // Write property type string formattedName = WriteString(property.GetType().Name); bytes.AddRange(WriteInt(formattedName.Length)); bytes.AddRange(formattedName); bytes.AddRange(WritePadding()); // Size of data and data itself will be written by the derived types bytes.AddRange(property.WriteSizeAndData()); return(bytes.ToArray()); }
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); }
public bool IsDuplicate(CProperty otherProperty) { return(otherProperty.Data == Data); }