Exemplo n.º 1
0
        private void ReadCustom(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2, bool canRepeat)
        {
            if (includeHeader)
            {
                EnumType     = (int)reader.ReadInt64();
                PropertyGuid = reader.ReadPropertyGuid();
            }

            switch (leng1)
            {
            case 1:
                ByteType = BytePropertyType.Byte;
                Value    = (int)reader.ReadByte();
                break;

            case 0:     // Should be only seen in maps
            case 8:
                ByteType = BytePropertyType.Long;
                Value    = (int)reader.ReadInt64();
                break;

            default:
                if (canRepeat)
                {
                    ReadCustom(reader, false, leng2, 0, false);
                    return;
                }
                throw new FormatException("Invalid length " + leng1 + " for ByteProperty");
            }
        }
Exemplo n.º 2
0
        public override void Read(BinaryReader reader, bool includeHeader, long leng)
        {
            if (includeHeader)
            {
                EnumType = (int)reader.ReadInt64();
                reader.ReadByte(); // null byte
            }

            switch (leng)
            {
            case 1:
                ByteType = BytePropertyType.Byte;
                Value    = (int)reader.ReadByte();
                break;

            case 0:     // Should be only seen in maps
            case 8:
                ByteType = BytePropertyType.Long;
                Value    = (int)reader.ReadInt64();
                break;

            default:
                throw new FormatException("Invalid length " + leng + " for ByteProperty");
            }
        }
Exemplo n.º 3
0
 public override void FromString(string[] d)
 {
     EnumType = Asset.AddHeaderReference(d[0]);
     if (byte.TryParse(d[1], out byte res))
     {
         ByteType = BytePropertyType.Byte;
         Value = res;
     }
     else
     {
         ByteType = BytePropertyType.Long;
         Value = Asset.AddHeaderReference(d[1]);
     }
 }
Exemplo n.º 4
0
        public override void FromString(string[] d, UAsset asset)
        {
            var tempStr = FString.FromString(d[0]);

            EnumType = tempStr == null ? 0 : asset.AddNameReference(tempStr);
            if (byte.TryParse(d[1], out byte res))
            {
                ByteType = BytePropertyType.Byte;
                Value    = res;
            }
            else
            {
                ByteType = BytePropertyType.Long;

                tempStr = FString.FromString(d[1]);
                Value   = tempStr == null ? 0 : asset.AddNameReference(tempStr);
            }
        }