コード例 #1
0
 public ResourceReader(string path, SerializedFile assetsFile, long offset, int size)
 {
     needSearch      = true;
     this.path       = path;
     this.assetsFile = assetsFile;
     this.offset     = offset;
     this.size       = size;
 }
コード例 #2
0
 public ObjectReader(EndianBinaryReader reader, SerializedFile assetsFile, ObjectInfo objectInfo) : base(reader.BaseStream, reader.endian)
 {
     this.assetsFile = assetsFile;
     m_PathID        = objectInfo.m_PathID;
     byteStart       = objectInfo.byteStart;
     byteSize        = objectInfo.byteSize;
     if (Enum.IsDefined(typeof(ClassIDType), objectInfo.classID))
     {
         type = (ClassIDType)objectInfo.classID;
     }
     else
     {
         type = ClassIDType.UnknownType;
     }
     serializedType = objectInfo.serializedType;
     platform       = assetsFile.m_TargetPlatform;
     m_Version      = assetsFile.header.m_Version;
 }
コード例 #3
0
        private SerializedFile LoadSerializedFileFromMemory(string fullName, EndianBinaryReader reader, string originalPath)
        {
            // TODO check if exists in resourceFileReaders first
            var upperFileName = Path.GetFileName(fullName).ToUpper();

            try
            {
                var assetsFile = new SerializedFile(this, fullName, reader);
                assetsFile.originalPath = originalPath;
                return(assetsFile);
            }
            catch
            {
                // catch block required
                return(null);
            }
            finally
            {
                resourceFileReaders.Add(upperFileName, reader);
            }
        }
コード例 #4
0
        private bool TryGetAssetsFile(out SerializedFile result)
        {
            result = null;
            if (m_FileID == 0)
            {
                result = assetsFile;
                return(true);
            }

            if (m_FileID > 0 && m_FileID - 1 < assetsFile.m_Externals.Count)
            {
                throw new NotImplementedException();
                //var assetsManager = assetsFile.assetsManager;
                //var assetsFileList = assetsManager.assetsFileList;
                //var assetsFileIndexCache = assetsManager.assetsFileIndexCache;

                //if (index == -2)
                //{
                //    var m_External = assetsFile.m_Externals[m_FileID - 1];
                //    var name = m_External.fileName.ToUpper();
                //    if (!assetsFileIndexCache.TryGetValue(name, out index))
                //    {
                //        index = assetsFileList.FindIndex(x => x.upperFileName == name);
                //        assetsFileIndexCache.Add(name, index);
                //    }
                //}

                //if (index >= 0)
                //{
                //    result = assetsFileList[index];
                //    return true;
                //}
            }

            return(false);
        }
コード例 #5
0
        private int index = -2; //-2 - Prepare, -1 - Missing

        public PPtr(ObjectReader reader)
        {
            m_FileID   = reader.ReadInt32();
            m_PathID   = reader.m_Version < 14 ? reader.ReadInt32() : reader.ReadInt64();
            assetsFile = reader.assetsFile;
        }