static void FillProperties(MutagenFrame frame, ushort objectFormat, IScriptEntry item) { var count = frame.ReadUInt16(); for (int i = 0; i < count; i++) { var name = StringBinaryTranslation.Instance.Parse(frame, stringBinaryType: StringBinaryType.PrependLengthUShort, encoding: frame.MetaData.Encodings.NonTranslated); var type = (ScriptProperty.Type)frame.ReadUInt8(); var flags = (ScriptProperty.Flag)frame.ReadUInt8(); ScriptProperty prop = type switch { ScriptProperty.Type.None => new ScriptProperty(), ScriptProperty.Type.Object => new ScriptObjectProperty(), ScriptProperty.Type.String => new ScriptStringProperty(), ScriptProperty.Type.Int => new ScriptIntProperty(), ScriptProperty.Type.Float => new ScriptFloatProperty(), ScriptProperty.Type.Bool => new ScriptBoolProperty(), ScriptProperty.Type.ArrayOfObject => new ScriptObjectListProperty(), ScriptProperty.Type.ArrayOfString => new ScriptStringListProperty(), ScriptProperty.Type.ArrayOfInt => new ScriptIntListProperty(), ScriptProperty.Type.ArrayOfFloat => new ScriptFloatListProperty(), ScriptProperty.Type.ArrayOfBool => new ScriptBoolListProperty(), _ => throw new NotImplementedException(), }; prop.Name = name; prop.Flags = flags; switch (prop) { case ScriptObjectProperty obj: FillObject(frame, obj, objectFormat); break; case ScriptObjectListProperty objList: var objListCount = frame.ReadUInt32(); for (int j = 0; j < objListCount; j++) { var subObj = new ScriptObjectProperty(); FillObject(frame, subObj, objectFormat); objList.Objects.Add(subObj); } break; default: prop.CopyInFromBinary(frame); break; } item.Properties.Add(prop); } }
static partial void FillBinaryIslandCustom(MutagenFrame frame, INavigationMapInfo item) { if (frame.ReadUInt8() > 0) { item.Island = IslandData.CreateFromBinary(frame); } }
static partial void FillBinaryFlagsCustom(MutagenFrame frame, ICondition item) { byte b = frame.ReadUInt8(); item.Flags = GetFlag(b); item.CompareOperator = GetCompareOperator(b); }
public static void FillBinaryCloudXSpeeds(MutagenFrame frame, CloudLayer[] clouds) { frame.ReadSubrecord(); for (int i = 0; i < NumLayers; i++) { clouds[i].XSpeed = ConvertToSpeed(frame.ReadUInt8()); } }
static partial void FillBinaryMoonAndPhaseLengthCustom(MutagenFrame frame, IClimateInternal item) { var raw = frame.ReadUInt8(); item.PhaseLength = (byte)(raw % 64); item.Moons = default(Climate.Moon); if (EnumExt.HasFlag(raw, MasserFlag)) { item.Moons |= Climate.Moon.Masser; } if (EnumExt.HasFlag(raw, SecundaFlag)) { item.Moons |= Climate.Moon.Secunda; } }
static partial void FillBinaryFlagsCustom(MutagenFrame frame, IScriptFragments item) { var flag = (Flag)frame.ReadUInt8(); item.FileName = Mutagen.Bethesda.Binary.StringBinaryTranslation.Instance.Parse( frame: frame, stringBinaryType: StringBinaryType.PrependLengthUShort); if (flag.HasFlag(Flag.OnBegin)) { item.OnBegin = ScriptFragment.CreateFromBinary(frame); } if (flag.HasFlag(Flag.OnEnd)) { item.OnEnd = ScriptFragment.CreateFromBinary(frame); } }
public static IEnumerable <ScriptEntry> ReadEntries(MutagenFrame frame, ushort objectFormat) { ushort count = frame.ReadUInt16(); for (int i = 0; i < count; i++) { var scriptName = StringBinaryTranslation.Instance.Parse(frame, stringBinaryType: StringBinaryType.PrependLengthUShort, encoding: frame.MetaData.Encodings.NonTranslated); var scriptFlags = (ScriptEntry.Flag)frame.ReadUInt8(); var entry = new ScriptEntry() { Name = scriptName, Flags = scriptFlags, }; FillProperties(frame, objectFormat, entry); yield return(entry); } }
public static Percent Parse(MutagenFrame reader, FloatIntegerType integerType) { switch (integerType) { case FloatIntegerType.UInt: return(Percent.FactoryPutInRange(((double)reader.ReadUInt32()) / uint.MaxValue)); case FloatIntegerType.UShort: return(Percent.FactoryPutInRange(((double)reader.ReadUInt16()) / ushort.MaxValue)); case FloatIntegerType.Byte: return(Percent.FactoryPutInRange(((double)reader.ReadUInt8()) / byte.MaxValue)); default: throw new NotImplementedException(); } }
public static partial void FillBinaryFlagsCustom(MutagenFrame frame, IScriptFragments item) { var flag = (Flag)frame.ReadUInt8(); item.FileName = StringBinaryTranslation.Instance.Parse( reader: frame, stringBinaryType: StringBinaryType.PrependLengthUShort, encoding: frame.MetaData.Encodings.NonTranslated); if (flag.HasFlag(Flag.OnBegin)) { item.OnBegin = ScriptFragment.CreateFromBinary(frame); } if (flag.HasFlag(Flag.OnEnd)) { item.OnEnd = ScriptFragment.CreateFromBinary(frame); } }
static partial void FillBinaryWeightSliderEnabledCustom(MutagenFrame frame, IArmorAddonInternal item) { item.WeightSliderEnabled = new GenderedItem <bool>(IsEnabled(frame.ReadUInt8()), IsEnabled(frame.ReadUInt8())); }
public byte Direct() { frame.Position = 0; return(frame.ReadUInt8()); }
public static partial void FillBinaryFlagsCustom(MutagenFrame frame, IBookInternal item) { item.Flags = (Book.Flag)frame.ReadUInt8(); }