Пример #1
0
        public AssetsFile(UnityContext context, UnityBinaryReader reader)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            Reader = reader;
            Header = new AssetsFileHeader(this);
            if (Header.Version < 9)
            {
                //Meta comes after object data
                throw new NotImplementedException();
            }
            TypeTree = new TypeTree(this);

            Files = new AssetsFileTable(this);

            PreloadList  = new PreloadList(this);
            Dependencies = new AssetsFileDependencyList(this);
        }
Пример #2
0
        public AssetsFile(UnityContext context, byte[] data)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            _buffer      = data;
            Context      = context;
            Assets       = new AssetsFileTable(this);
            Dependencies = new DependencyList(this);

            var reader = CreateReader(0);

            Header.Read(reader);
            reader.Position = Header.MetadataOffset;
            TypeTree.Read(reader, Header.Version);
            Assets.Read(reader);
            PreloadList.Read(reader, Header.Version);
            Dependencies.Read(reader, Header.Version);
        }