コード例 #1
0
ファイル: PropertyExport.cs プロジェクト: atenfyr/UAssetAPI
        public override void Write(AssetBinaryWriter writer)
        {
            base.Write(writer);
            writer.Write((int)0);

            MainSerializer.WriteUProperty(Property, writer);
        }
コード例 #2
0
 public override void Write(AssetBinaryWriter writer)
 {
     for (int j = 0; j < Data.Count; j++)
     {
         PropertyData current = Data[j];
         MainSerializer.Write(current, writer, true);
     }
     writer.Write(new FName("None"));
 }
コード例 #3
0
ファイル: PropertyExport.cs プロジェクト: atenfyr/UAssetAPI
        public override void Read(AssetBinaryReader reader, int nextStarting)
        {
            base.Read(reader, nextStarting);
            reader.ReadInt32();

            FName exportClassType = this.GetExportClassType();

            Property = MainSerializer.ReadUProperty(reader, exportClassType);
        }
コード例 #4
0
ファイル: Category.cs プロジェクト: twindan/UAssetAPI
 public override void Write(BinaryWriter writer)
 {
     for (int j = 0; j < Data.Count; j++)
     {
         PropertyData current = Data[j];
         MainSerializer.Write(current, Asset, writer, true);
     }
     writer.Write((long)Asset.SearchHeaderReference("None"));
     Write2(writer);
 }
コード例 #5
0
        public override void Read(AssetBinaryReader reader, int nextStarting = 0)
        {
            Data = new List <PropertyData>();
            PropertyData bit;

            while ((bit = MainSerializer.Read(reader, true)) != null)
            {
                Data.Add(bit);
            }
        }
コード例 #6
0
ファイル: Category.cs プロジェクト: slicol/UAssetAPI
        public override void Read(BinaryReader reader)
        {
            Data = new List <PropertyData>();
            PropertyData bit;

            while ((bit = MainSerializer.Read(Asset, reader, true)) != null)
            {
                Data.Add(bit);
            }

            Read2(reader);
        }
コード例 #7
0
ファイル: StructExport.cs プロジェクト: atenfyr/UAssetAPI
        public override void Write(AssetBinaryWriter writer)
        {
            base.Write(writer);

            writer.Write(SuperStruct.Index);

            writer.Write(Children.Length);
            for (int i = 0; i < Children.Length; i++)
            {
                writer.Write(Children[i].Index);
            }

            if (Asset.GetCustomVersion <FCoreObjectVersion>() >= FCoreObjectVersion.FProperties)
            {
                writer.Write(LoadedProperties.Length);
                for (int i = 0; i < LoadedProperties.Length; i++)
                {
                    MainSerializer.WriteFProperty(LoadedProperties[i], writer);
                }
            }

            if (ScriptBytecode == null)
            {
                writer.Write(ScriptBytecodeSize);
                writer.Write(ScriptBytecodeRaw.Length);
                writer.Write(ScriptBytecodeRaw);
            }
            else
            {
                long lengthOffset1 = writer.BaseStream.Position;
                writer.Write((int)0); // total iCode offset; to be filled out after serialization
                long lengthOffset2 = writer.BaseStream.Position;
                writer.Write((int)0); // size on disk; to be filled out after serialization

                int  totalICodeOffset = 0;
                long startMetric      = writer.BaseStream.Position;
                for (int i = 0; i < ScriptBytecode.Length; i++)
                {
                    totalICodeOffset += ExpressionSerializer.WriteExpression(ScriptBytecode[i], writer);
                }
                long endMetric = writer.BaseStream.Position;

                // Write out total size in bytes
                long totalLength = endMetric - startMetric;
                long here        = writer.BaseStream.Position;
                writer.Seek((int)lengthOffset1, SeekOrigin.Begin);
                writer.Write(totalICodeOffset);
                writer.Seek((int)lengthOffset2, SeekOrigin.Begin);
                writer.Write((int)totalLength);
                writer.Seek((int)here, SeekOrigin.Begin);
            }
        }
コード例 #8
0
ファイル: StructExport.cs プロジェクト: atenfyr/UAssetAPI
        public override void Read(AssetBinaryReader reader, int nextStarting)
        {
            base.Read(reader, nextStarting);

            SuperStruct = new FPackageIndex(reader.ReadInt32());

            int numIndexEntries = reader.ReadInt32();

            Children = new FPackageIndex[numIndexEntries];
            for (int i = 0; i < numIndexEntries; i++)
            {
                Children[i] = new FPackageIndex(reader.ReadInt32());
            }

            if (Asset.GetCustomVersion <FCoreObjectVersion>() >= FCoreObjectVersion.FProperties)
            {
                int numProps = reader.ReadInt32();
                LoadedProperties = new FProperty[numProps];
                for (int i = 0; i < numProps; i++)
                {
                    LoadedProperties[i] = MainSerializer.ReadFProperty(reader);
                }
            }
            else
            {
                LoadedProperties = new FProperty[0];
            }

            ScriptBytecodeSize = reader.ReadInt32();     // # of bytes in total in deserialized memory
            int  scriptStorageSize = reader.ReadInt32(); // # of bytes in total
            long startedReading    = reader.BaseStream.Position;

            bool willParseRaw = true;

            try
            {
                if (ParseBytecode && Asset.EngineVersion >= UE4Version.VER_UE4_16)
                {
                    var tempCode = new List <Kismet.Bytecode.KismetExpression>();
                    while ((reader.BaseStream.Position - startedReading) < scriptStorageSize)
                    {
                        tempCode.Add(ExpressionSerializer.ReadExpression(reader));
                    }
                    ScriptBytecode = tempCode.ToArray();
                    willParseRaw   = false;
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex.StackTrace);
#endif
            }

            if (willParseRaw)
            {
                reader.BaseStream.Seek(startedReading, SeekOrigin.Begin);
                ScriptBytecode    = null;
                ScriptBytecodeRaw = reader.ReadBytes(scriptStorageSize);
            }
        }