public static FileScheme ReadScheme(SmartStream stream, string filePath, string fileName)
 {
     if (BundleFile.IsBundleFile(stream))
     {
         return(BundleFile.ReadScheme(stream, filePath, fileName));
     }
     if (ArchiveFile.IsArchiveFile(stream))
     {
         return(ArchiveFile.ReadScheme(stream, filePath, fileName));
     }
     if (WebFile.IsWebFile(stream))
     {
         return(WebFile.ReadScheme(stream, filePath));
     }
     if (SerializedFile.IsSerializedFile(stream))
     {
         return(SerializedFile.ReadScheme(stream, filePath, fileName));
     }
     return(ResourceFile.ReadScheme(stream, filePath, fileName));
 }
        private void ReadScheme(Stream stream)
        {
            byte[] buffer;
            using (EndianReader reader = new EndianReader(stream, EndianType.BigEndian))
            {
                Header.Read(reader);
                switch (Header.Type)
                {
                case ArchiveType.GZip:
                    buffer = ReadGZip(reader);
                    break;

                case ArchiveType.Brotli:
                    buffer = ReadBrotli(reader);
                    break;

                default:
                    throw new NotSupportedException(Header.Type.ToString());
                }
            }

            WebScheme = WebFile.ReadScheme(buffer, FilePath);
        }
 public static FileScheme ReadScheme(byte[] buffer, string filePath, string fileName)
 {
     using (MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length, false))
     {
         if (BundleFile.IsBundleFile(stream))
         {
             return(BundleFile.ReadScheme(buffer, filePath, fileName));
         }
         if (ArchiveFile.IsArchiveFile(stream))
         {
             return(ArchiveFile.ReadScheme(buffer, filePath, fileName));
         }
         if (WebFile.IsWebFile(stream))
         {
             return(WebFile.ReadScheme(buffer, filePath));
         }
         if (SerializedFile.IsSerializedFile(stream))
         {
             return(SerializedFile.ReadScheme(buffer, filePath, fileName));
         }
         return(ResourceFile.ReadScheme(buffer, filePath, fileName));
     }
 }
コード例 #4
0
 public static FileScheme ReadScheme(SmartStream stream, long offset, long size, string filePath, string fileName)
 {
     if (BundleFile.IsBundleFile(stream, offset, size))
     {
         return(BundleFile.ReadScheme(stream, offset, size, filePath, fileName));
     }
     if (ArchiveFile.IsArchiveFile(stream, offset, size))
     {
         return(ArchiveFile.ReadScheme(stream, offset, size, filePath, fileName));
     }
     if (WebFile.IsWebFile(stream, offset, size))
     {
         return(WebFile.ReadScheme(stream, offset, size, filePath, fileName));
     }
     if (ResourceFile.IsDefaultResourceFile(fileName))
     {
         return(ResourceFile.ReadScheme(stream, offset, size, filePath, fileName));
     }
     if (SerializedFile.IsSerializedFile(stream, offset, size))
     {
         return(SerializedFile.ReadScheme(stream, offset, size, filePath, fileName));
     }
     return(ResourceFile.ReadScheme(stream, offset, size, filePath, fileName));
 }
コード例 #5
0
        private void ProcessEntry()
        {
            string name = Path.GetFileNameWithoutExtension(FilePath);

            WebScheme = WebFile.ReadScheme(m_dataStream, 0, m_stream.Length, FilePath, name);
        }