示例#1
0
        private static IEnumerable <FileScheme> EnumerateSchemes(IReadOnlyList <FileScheme> schemes)
        {
            foreach (FileScheme scheme in schemes)
            {
                yield return(scheme);

                if (scheme is FileSchemeList fileList)
                {
                    foreach (FileScheme nestedScheme in EnumerateSchemes(fileList.Schemes))
                    {
                        yield return(nestedScheme);
                    }
                }
                else if (scheme.SchemeType == FileEntryType.Archive)
                {
                    ArchiveFileScheme archive = (ArchiveFileScheme)scheme;
                    yield return(archive.WebScheme);

                    foreach (FileScheme nestedScheme in EnumerateSchemes(archive.WebScheme.Schemes))
                    {
                        yield return(nestedScheme);
                    }
                }
            }
        }
        internal static ArchiveFileScheme ReadScheme(Stream stream, string filePath, string fileName)
        {
            ArchiveFileScheme scheme = new ArchiveFileScheme(filePath, fileName);

            scheme.ReadScheme(stream);
            return(scheme);
        }
示例#3
0
        internal static ArchiveFileScheme ReadScheme(SmartStream stream, long offset, long size, string filePath, string fileName)
        {
            ArchiveFileScheme scheme = new ArchiveFileScheme(stream, offset, size, filePath, fileName);

            scheme.ReadScheme();
            scheme.ProcessEntry();
            return(scheme);
        }
示例#4
0
        internal ArchiveFile(IFileCollection collection, ArchiveFileScheme scheme)
        {
            if (scheme == null)
            {
                throw new ArgumentNullException(nameof(scheme));
            }

            Header = scheme.Header;
        }
        internal static ArchiveFileScheme ReadScheme(byte[] buffer, string filePath, string fileName)
        {
            ArchiveFileScheme scheme = new ArchiveFileScheme(filePath, fileName);

            using (MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length, false))
            {
                scheme.ReadScheme(stream);
            }
            return(scheme);
        }
示例#6
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());
            }
        }
示例#7
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());
            }
        }
示例#8
0
 internal ArchiveFile(ArchiveFileScheme scheme)
 {
     Header = scheme.Header;
 }
示例#9
0
 public static ArchiveFileScheme ReadScheme(Stream stream, string filePath, string fileName)
 {
     return(ArchiveFileScheme.ReadScheme(stream, filePath, fileName));
 }
示例#10
0
 public static ArchiveFileScheme ReadScheme(byte[] buffer, string filePath, string fileName)
 {
     return(ArchiveFileScheme.ReadScheme(buffer, filePath, fileName));
 }
示例#11
0
 public static ArchiveFileScheme ReadScheme(SmartStream stream, long offset, long size, string filePath, string fileName)
 {
     return(ArchiveFileScheme.ReadScheme(stream, offset, size, filePath, fileName));
 }
 internal ArchiveFile(ArchiveFileScheme scheme) :
     base(scheme.NameOrigin)
 {
     Header = scheme.Header;
 }