Esempio n. 1
0
        public void Inject(UiInjectionManager manager)
        {
            if (_leafs.Length == 0)
            {
                return;
            }

            String root = _source.ProvideRootDirectory();

            foreach (ArchiveEntry entry in _leafs)
            {
                String sourcePath    = Path.Combine(root, PathEx.ChangeMultiDotExtension(entry.Name, null));
                String directoryPath = Path.GetDirectoryName(sourcePath);

                if (entry.Name.EndsWith(".ztr"))
                {
                    if (_source.TryProvideStrings() == null && !_source.DirectoryIsExists(directoryPath))
                    {
                        continue;
                    }
                }
                else if (!_source.DirectoryIsExists(directoryPath))
                {
                    continue;
                }

                Inject(entry, sourcePath);
            }

            if (_injected)
            {
                manager.Enqueue(_listing);
            }
        }
Esempio n. 2
0
        public void Inject(UiInjectionManager manager)
        {
            if (_leafs.Length == 0)
            {
                return;
            }

            String root            = _source.ProvideRootDirectory();
            String targetDirectory = Path.Combine(root, _listing.ExtractionSubpath);

            if (!_source.DirectoryIsExists(targetDirectory))
            {
                return;
            }

            foreach (WpdEntry entry  in _leafs)
            {
                String targetPath = Path.Combine(targetDirectory, entry.NameWithoutExtension);
                Inject(entry, targetPath);
            }

            if (_injected)
            {
                List <ArchiveEntry>   entries      = new List <ArchiveEntry>(2);
                MemoryInjectionSource memorySource = new MemoryInjectionSource();
                if (_headers.IsValueCreated)
                {
                    ArchiveEntry entry = _listing.Accessor.HeadersEntry;
                    entries.Add(entry);
                    memorySource.RegisterStream(entry.Name, _headers.Value);
                }
                if (_content.IsValueCreated)
                {
                    ArchiveEntry entry = _listing.Accessor.ContentEntry;
                    entries.Add(entry);
                    memorySource.RegisterStream(entry.Name, _content.Value);
                }

                using (UiArchiveInjector injector = new UiArchiveInjector(_listing.Accessor.Parent, entries.ToArray(), _conversion, false, memorySource))
                    injector.Inject(manager);

                manager.Enqueue(_listing.Accessor.Parent);
            }
        }