internal SerializedFile(IFileCollection collection, IAssemblyManager manager, SerializedFileScheme scheme)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }
            if (scheme == null)
            {
                throw new ArgumentNullException(nameof(scheme));
            }

            Collection      = collection;
            AssemblyManager = manager;
            FilePath        = scheme.FilePath;
            NameOrigin      = scheme.Name;
            Name            = FilenameUtils.FixFileIdentifier(scheme.Name);
            Flags           = scheme.Flags;

            Header   = scheme.Header;
            Metadata = scheme.Metadata;
        }
Example #2
0
        public DependencyCollection(FileCollection fileCollection, IEnumerable <FileEntry> entries, Action <string> dependencyCallback)
        {
            if (fileCollection == null)
            {
                throw new ArgumentNullException(nameof(fileCollection));
            }
            if (entries == null)
            {
                throw new ArgumentNullException(nameof(entries));
            }
            if (dependencyCallback == null)
            {
                throw new ArgumentNullException(nameof(dependencyCallback));
            }

            m_fileCollection = fileCollection;
            Dictionary <string, FileEntry> fileEntries = new Dictionary <string, FileEntry>();

            foreach (FileEntry entry in entries)
            {
                string name = FilenameUtils.FixFileIdentifier(entry.Name);
                fileEntries.Add(name, entry);
            }
            m_entries            = fileEntries;
            m_dependencyCallback = dependencyCallback;
        }
Example #3
0
        public void ReadFiles()
        {
            foreach (FileEntry entry in m_entries.Values)
            {
                if (entry.EntryType == FileEntryType.Resource)
                {
                    entry.ReadResourcesFile(m_fileCollection);
                }
            }

            foreach (FileEntry entry in m_entries.Values)
            {
                if (entry.EntryType == FileEntryType.Serialized)
                {
                    string name = FilenameUtils.FixFileIdentifier(entry.Name);
                    if (m_loadedFiles.Add(name))
                    {
                        entry.ReadSerializedFile(m_fileCollection, OnRequestDependency);
                    }
                }
            }

            foreach (FileEntry entry in m_entries.Values)
            {
                if (entry.EntryType == FileEntryType.Bundle)
                {
                    entry.ReadBundleFile(m_fileCollection);
                }
                else if (entry.EntryType == FileEntryType.Web)
                {
                    entry.ReadWebFile(m_fileCollection);
                }
            }
        }
Example #4
0
        internal SerializedFile(GameCollection collection, SerializedFileScheme scheme)
        {
            Collection = collection ?? throw new ArgumentNullException(nameof(collection));
            FilePath   = scheme.FilePath;
            NameOrigin = scheme.Name;
            Name       = FilenameUtils.FixFileIdentifier(scheme.Name);
            Layout     = GetLayout(collection, scheme, Name);

            Header   = scheme.Header;
            Metadata = scheme.Metadata;

            for (int i = 0; i < Metadata.Entries.Length; i++)
            {
                m_assetEntryLookup.Add(Metadata.Entries[i].PathID, i);
            }
        }
Example #5
0
        internal SerializedFile(IFileCollection collection, IAssemblyManager manager, SerializedFileScheme scheme)
        {
            Collection      = collection ?? throw new ArgumentNullException(nameof(collection));
            AssemblyManager = manager ?? throw new ArgumentNullException(nameof(manager));
            FilePath        = scheme.FilePath;
            NameOrigin      = scheme.Name;
            Name            = FilenameUtils.FixFileIdentifier(scheme.Name);
            Flags           = scheme.Flags;

            Header   = scheme.Header;
            Metadata = scheme.Metadata;

            for (int i = 0; i < Metadata.Entries.Length; i++)
            {
                m_assetEntryLookup.Add(Metadata.Entries[i].PathID, i);
            }
        }
Example #6
0
 public FileScheme(SmartStream stream, long offset, long size, string filePath, string fileName)
 {
     if (stream == null)
     {
         throw new ArgumentNullException(nameof(stream));
     }
     if (string.IsNullOrEmpty(filePath))
     {
         throw new ArgumentNullException(nameof(filePath));
     }
     m_stream   = stream.CreateReference();
     m_offset   = offset;
     m_size     = size;
     FilePath   = filePath;
     NameOrigin = fileName;
     Name       = FilenameUtils.FixFileIdentifier(fileName);
 }
Example #7
0
 protected FileScheme(string filePath, string fileName)
 {
     FilePath   = filePath ?? throw new ArgumentNullException(nameof(filePath));
     NameOrigin = fileName;
     Name       = FilenameUtils.FixFileIdentifier(fileName);
 }