コード例 #1
0
            public static byte GetFlagWriteByte(Condition.Flag flag, CompareOperator compare)
            {
                int b  = ((int)flag) & 0x1F;
                int b2 = ((int)compare) << 5;

                return((byte)(b | b2));
            }
コード例 #2
0
            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));
                }
            }
コード例 #3
0
        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)));
            }
        }