private void Inject(WpdArchiveListing listing, WpdEntry[] fontEntries, WflContent[] fontContent) { UiInjectionManager manager = new UiInjectionManager(); using (MemoryInjectionSource source = new MemoryInjectionSource()) { String injectionRoot = Path.Combine(source.ProvideRootDirectory(), listing.ExtractionSubpath); for (int i = 0; i < fontEntries.Length; i++) { WpdEntry entry = fontEntries[i]; WflContent content = fontContent[i]; String injectionPath = Path.Combine(injectionRoot, entry.Name); MemoryStream stream = new MemoryStream(1024); source.RegisterStream(injectionPath, stream); WflFileWriter writer = new WflFileWriter(stream); writer.Write(content); stream.SetPosition(0); } UiWpdInjector injector = new UiWpdInjector(listing, fontEntries, false, source); injector.Inject(manager); } manager.WriteListings(); }
public static void InjectSingle(WpdArchiveListing listing, WpdEntry entry, MemoryStream output) { using (MemoryInjectionSource source = new MemoryInjectionSource()) { source.RegisterStream(String.Empty, output); UiWpdInjector injector = new UiWpdInjector(listing, new[] {entry}, false, source); UiInjectionManager manager = new UiInjectionManager(); injector.Inject(manager); manager.WriteListings(); } }
public static void InjectSingle(WpdArchiveListing listing, WpdEntry entry, MemoryStream output) { using (MemoryInjectionSource source = new MemoryInjectionSource()) { source.RegisterStream(String.Empty, output); UiWpdInjector injector = new UiWpdInjector(listing, new[] { entry }, false, source); UiInjectionManager manager = new UiInjectionManager(); injector.Inject(manager); manager.WriteListings(); } }
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); } }
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); } }