Exemplo n.º 1
0
 public void ReadWebFile(SmartStream stream, string webPath)
 {
     using (WebFile web = WebFile.Read(stream, webPath))
     {
         AddWebFile(web);
     }
 }
Exemplo n.º 2
0
 public void LoadWebFile(string webPath)
 {
     using (WebFile web = WebFile.Load(webPath))
     {
         AddWebFile(web);
     }
 }
Exemplo n.º 3
0
        public WebFile ReadFile(IFileCollection collection, IAssemblyManager manager)
        {
            WebFile web = new WebFile(collection, this);

            foreach (FileScheme scheme in Schemes)
            {
                web.AddFile(scheme, collection, manager);
            }
            return(web);
        }
Exemplo n.º 4
0
        internal WebFile ReadFile(GameProcessorContext context)
        {
            WebFile web = new WebFile(this);

            foreach (FileScheme scheme in Schemes)
            {
                web.AddFile(context, scheme);
            }
            return(web);
        }
Exemplo n.º 5
0
        internal void AddFile(FileScheme scheme, IFileCollection collection, IAssemblyManager manager)
        {
            switch (scheme.SchemeType)
            {
            case FileEntryType.Serialized:
            {
                SerializedFileScheme serializedScheme = (SerializedFileScheme)scheme;
                SerializedFile       file             = serializedScheme.ReadFile(collection, manager);
                m_serializedFiles.Add(file);
                OnSerializedFileAdded(file);
            }
            break;

            case FileEntryType.Bundle:
            {
                BundleFileScheme bundleScheme = (BundleFileScheme)scheme;
                BundleFile       bundle       = bundleScheme.ReadFile(collection, manager);
                m_fileLists.Add(bundle);
                OnFileListAdded(bundle);
            }
            break;

            case FileEntryType.Archive:
            {
                ArchiveFileScheme archiveScheme = (ArchiveFileScheme)scheme;
                ArchiveFile       archive       = archiveScheme.ReadFile(collection, manager);
                m_fileLists.Add(archive);
                OnFileListAdded(archive);
            }
            break;

            case FileEntryType.Web:
            {
                WebFileScheme webScheme = (WebFileScheme)scheme;
                WebFile       webFile   = webScheme.ReadFile(collection, manager);
                m_fileLists.Add(webFile);
                OnFileListAdded(webFile);
            }
            break;

            case FileEntryType.Resource:
            {
                ResourceFileScheme resourceScheme = (ResourceFileScheme)scheme;
                ResourceFile       resource       = resourceScheme.ReadFile();
                m_resourceFiles.Add(resource);
                OnResourceFileAdded(resource);
            }
            break;

            default:
                throw new NotSupportedException(scheme.SchemeType.ToString());
            }
        }
Exemplo n.º 6
0
        internal void AddFile(GameProcessorContext context, FileScheme scheme)
        {
            switch (scheme.SchemeType)
            {
            case FileEntryType.Serialized:
            {
                SerializedFileScheme serializedScheme = (SerializedFileScheme)scheme;
                SerializedFile       file             = serializedScheme.ReadFile(context);
                AddSerializedFile(file);
            }
            break;

            case FileEntryType.Bundle:
            {
                BundleFileScheme bundleScheme = (BundleFileScheme)scheme;
                BundleFile       bundle       = bundleScheme.ReadFile(context);
                AddFileList(bundle);
            }
            break;

            case FileEntryType.Archive:
            {
                ArchiveFileScheme archiveScheme = (ArchiveFileScheme)scheme;
                ArchiveFile       archive       = archiveScheme.ReadFile(context);
                AddFileList(archive);
            }
            break;

            case FileEntryType.Web:
            {
                WebFileScheme webScheme = (WebFileScheme)scheme;
                WebFile       webFile   = webScheme.ReadFile(context);
                AddFileList(webFile);
            }
            break;

            case FileEntryType.Resource:
            {
                ResourceFileScheme resourceScheme = (ResourceFileScheme)scheme;
                ResourceFile       resource       = resourceScheme.ReadFile();
                AddResourceFile(resource);
            }
            break;

            default:
                throw new NotSupportedException(scheme.SchemeType.ToString());
            }
        }
Exemplo n.º 7
0
 public void Load(string filePath)
 {
     if (BundleFile.IsBundleFile(filePath))
     {
         LoadBundleFile(filePath);
     }
     else if (ArchiveFile.IsArchiveFile(filePath))
     {
         LoadArchiveFile(filePath);
     }
     else if (WebFile.IsWebFile(filePath))
     {
         LoadWebFile(filePath);
     }
     else
     {
         LoadSerializedFile(filePath);
     }
 }
 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));
 }
Exemplo n.º 9
0
 public void Read(SmartStream stream, string filePath)
 {
     if (BundleFile.IsBundleFile(stream))
     {
         ReadBundleFile(stream, filePath);
     }
     else if (ArchiveFile.IsArchiveFile(stream))
     {
         ReadArchiveFile(stream, filePath);
     }
     else if (WebFile.IsWebFile(stream))
     {
         ReadWebFile(stream, filePath);
     }
     else
     {
         string fileName = Path.GetFileName(filePath);
         ReadSerializedFile(stream, filePath, fileName, OnRequestDependency);
     }
 }
        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));
     }
 }
Exemplo n.º 12
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));
 }
Exemplo n.º 13
0
        private void ProcessEntry()
        {
            string name = Path.GetFileNameWithoutExtension(FilePath);

            WebScheme = WebFile.ReadScheme(m_dataStream, 0, m_stream.Length, FilePath, name);
        }
Exemplo n.º 14
0
        internal void AddWebFile(WebFile web)
        {
            DependencyCollection depCollection = new DependencyCollection(this, web.Metadata.Entries, OnRequestDependency);

            depCollection.ReadFiles();
        }