Exemplo n.º 1
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;
        }
Exemplo n.º 2
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);
                }
            }
        }