public bool TryInject(IUiInjectionSource source, string sourceFullPath, ArchiveEntryInjectionData data, ArchiveEntry entry)
        {
            Dictionary <string, string> sourceEntries;

            using (Stream input = source.TryOpen(sourceFullPath))
            {
                if (input != null)
                {
                    string        entryName;
                    ZtrTextReader reader = new ZtrTextReader(input, StringsZtrFormatter.Instance);
                    sourceEntries = reader.Read(out entryName).ToDictionary(e => e.Key, e => e.Value);
                    using (Stream output = data.OuputStreamFactory(entry))
                        Inject(data.Listing, entry, sourceEntries, output);

                    return(true);
                }
            }

            sourceEntries = source.TryProvideStrings();
            if (sourceEntries == null)
            {
                return(false);
            }

            using (Stream output = data.OuputStreamFactory(entry))
                Inject(data.Listing, entry, sourceEntries, output);

            return(true);
        }
Ejemplo n.º 2
0
 public UiWpdInjector(WpdArchiveListing listing, WpdEntry[] leafs, bool? conversion, IUiInjectionSource source)
 {
     _listing = listing;
     _leafs = leafs;
     _source = source;
     _conversion = conversion;
     _injectors = ProvideInjectors();
     _headers = new Lazy<Stream>(AcquireHeaders);
     _content = new Lazy<Stream>(AcquireContent);
 }
Ejemplo n.º 3
0
 public UiArchiveInjector(ArchiveListing listing, ArchiveEntry[] leafs, bool? conversion, bool? compression, IUiInjectionSource source)
 {
     _listing = listing;
     _leafs = leafs;
     _source = source;
     _conversion = conversion;
     _compression = compression;
     _injectionData = new ArchiveEntryInjectionData(_listing, OpenOutputStream);
     _injectors = ProvideInjectors();
 }
Ejemplo n.º 4
0
 public UiWpdInjector(WpdArchiveListing listing, WpdEntry[] leafs, bool?conversion, IUiInjectionSource source)
 {
     _listing    = listing;
     _leafs      = leafs;
     _source     = source;
     _conversion = conversion;
     _injectors  = ProvideInjectors();
     _headers    = new Lazy <Stream>(AcquireHeaders);
     _content    = new Lazy <Stream>(AcquireContent);
 }
Ejemplo n.º 5
0
 public UiArchiveInjector(ArchiveListing listing, ArchiveEntry[] leafs, bool?conversion, bool?compression, IUiInjectionSource source)
 {
     _listing       = listing;
     _leafs         = leafs;
     _source        = source;
     _conversion    = conversion;
     _compression   = compression;
     _injectionData = new ArchiveEntryInjectionData(_listing, OpenOutputStream);
     _injectors     = ProvideInjectors();
 }
Ejemplo n.º 6
0
        public bool TryInject(IUiInjectionSource source, string sourceFullPath, ArchiveEntryInjectionData data, ArchiveEntry entry)
        {
            using (Stream input = source.TryOpen(sourceFullPath))
            {
                if (input == null)
                    return false;

                using (Stream output = data.OuputStreamFactory(entry))
                input.CopyToStream(output, (int)input.Length, data.Buffer);

                return true;
            }
        }
Ejemplo n.º 7
0
        public bool TryInject(IUiInjectionSource source, string sourceFullPath, ArchiveEntryInjectionData data, ArchiveEntry entry)
        {
            using (Stream input = source.TryOpen(sourceFullPath))
            {
                if (input == null)
                {
                    return(false);
                }

                using (Stream output = data.OuputStreamFactory(entry))
                    input.CopyToStream(output, (int)input.Length, data.Buffer);

                return(true);
            }
        }
        public bool TryInject(IUiInjectionSource source, string sourceFullPath, ArchiveEntryInjectionData data, ArchiveEntry entry)
        {
            Dictionary<string, string> sourceEntries;
            using (Stream input = source.TryOpen(sourceFullPath))
            {
                if (input != null)
                {
                    string entryName;
                    ZtrTextReader reader = new ZtrTextReader(input, StringsZtrFormatter.Instance);
                    sourceEntries = reader.Read(out entryName).ToDictionary(e => e.Key, e => e.Value);
                    using (Stream output = data.OuputStreamFactory(entry))
                        Inject(data.Listing, entry, sourceEntries, output);

                    return true;
                }
            }

            MemoryInjectionSource memorySource = source as MemoryInjectionSource;
            if (memorySource == null)
                return false;

            sourceEntries = memorySource.TryProvideStrings();
            if (sourceEntries == null)
                return false;

            using (Stream output = data.OuputStreamFactory(entry))
                Inject(data.Listing, entry, sourceEntries, output);

            return true;
        }
Ejemplo n.º 9
0
 public void Inject(IUiInjectionSource source, UiInjectionManager manager)
 {
     using (UiWpdInjector injector = new UiWpdInjector(_listing, _leafs, _conversion, source))
         injector.Inject(manager);
 }
Ejemplo n.º 10
0
 public void Inject(IUiInjectionSource source, UiInjectionManager manager)
 {
     using (UiArchiveInjector injector = new UiArchiveInjector(_listing, _leafs, _conversion, _compression, source))
         injector.Inject(manager);
 }
Ejemplo n.º 11
0
 public void Inject(IUiInjectionSource source, UiInjectionManager manager)
 {
     throw new NotImplementedException();
     //using (UiWpdInjector injector = new UiWpdInjector(_listing, _leafs, _conversion, source))
     //    injector.Inject(manager);
 }
Ejemplo n.º 12
0
 public void Inject(IUiInjectionSource source, UiInjectionManager manager)
 {
     throw new NotImplementedException();
     //using (UiWpdInjector injector = new UiWpdInjector(_listing, _leafs, _conversion, source))
     //    injector.Inject(manager);
 }