Пример #1
0
 public AIPackage.Flag GetFlagsCustom(int location)
 {
     if (_data.Length > 4)
     {
         return(EnumExt <AIPackage.Flag> .Convert(BinaryPrimitives.ReadUInt32LittleEndian(_data)));
     }
     else
     {
         return(EnumExt <AIPackage.Flag> .Convert(BinaryPrimitives.ReadUInt16LittleEndian(_data)));
     }
 }
Пример #2
0
 public AIPackage.Types GetTypeCustom(int location)
 {
     if (_data.Length > 4)
     {
         return(EnumExt <AIPackage.Types> .Convert(BinaryPrimitives.ReadUInt32LittleEndian(_data.Slice(4))));
     }
     else
     {
         return(EnumExt <AIPackage.Types> .Convert(_data[2]));
     }
 }
Пример #3
0
            public static partial void FillBinaryFlagsCustom(MutagenFrame frame, IAIPackageData item)
            {
                if (frame.Remaining == 8)
                {
                    var span = frame.Reader.ReadSpan(8);
                    item.Flags = EnumExt <AIPackage.Flag> .Convert(BinaryPrimitives.ReadUInt32LittleEndian(span));

                    item.Type = EnumExt <AIPackage.Types> .Convert(BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(4)));
                }
                else if (frame.Remaining == 4)
                {
                    var span = frame.Reader.ReadSpan(4);
                    item.Flags = EnumExt <AIPackage.Flag> .Convert(BinaryPrimitives.ReadUInt16LittleEndian(span));

                    item.Type = EnumExt <AIPackage.Types> .Convert(span[2]);
                }
                else
                {
                    throw new ArgumentException($"Odd length for general AI field: {frame.Remaining}");
                }
            }
Пример #4
0
        public E ParseValue(MutagenFrame reader, ErrorMaskBuilder?errorMask)
        {
            int i;

            switch (reader.Remaining)
            {
            case 1:
                i = reader.Reader.ReadUInt8();
                break;

            case 2:
                i = reader.Reader.ReadInt16();
                break;

            case 4:
                i = reader.Reader.ReadInt32();
                break;

            default:
                throw new NotImplementedException();
            }
            return(EnumExt <E> .Convert(i));
        }