public static ConditionBinaryOverlay ConditionFactory(OverlayStream stream, BinaryOverlayFactoryPackage package) { var subRecMeta = stream.GetSubrecordFrame(); if (subRecMeta.RecordType != RecordTypes.CTDA) { throw new ArgumentException(); } Condition.Flag flag = ConditionBinaryCreateTranslation.GetFlag(subRecMeta.Content[0]); if (flag.HasFlag(Condition.Flag.UseGlobal)) { return(ConditionGlobalBinaryOverlay.ConditionGlobalFactory(stream, package)); } else { return(ConditionFloatBinaryOverlay.ConditionFloatFactory(stream, package)); } }
public static Condition CreateFromBinary( MutagenFrame frame, RecordTypeConverter?recordTypeConverter) { if (!frame.Reader.TryGetSubrecord(Mutagen.Bethesda.Fallout4.Internals.RecordTypes.CTDA, out var subRecMeta)) { throw new ArgumentException(); } var flagByte = frame.GetUInt8(subRecMeta.HeaderLength); Condition.Flag flag = ConditionBinaryCreateTranslation.GetFlag(flagByte); if (flag.HasFlag(Condition.Flag.UseGlobal)) { return(ConditionGlobal.CreateFromBinary(frame.SpawnWithLength(subRecMeta.ContentLength, checkFraming: false))); } else { return(ConditionFloat.CreateFromBinary(frame.SpawnWithLength(subRecMeta.ContentLength, checkFraming: false))); } }
private Condition.Flag GetFlagsCustom(int location) => ConditionBinaryCreateTranslation.GetFlag(_data.Span[location]);