public override void Export(IDocumentComponent docs, string destDirFullPath) { this.exporter.Export(docs, destDirFullPath); var packingService = new PackingService(); packingService.Pack(destDirFullPath, docs.Name); }
public override void Export(IDocumentComponent docs, string destDirFullPath) { this.exporter.Export(docs, destDirFullPath); var encryptingService = new EncryptingService(); encryptingService.Encrypt(destDirFullPath); }
/// <summary> /// Точка входа в программу. /// </summary> /// <param name="args">Аргументы командной строки.</param> private static void Main(string[] args) { IRepository repo = new FakeRepository(); IDocumentComponent doc = repo.Load(); Console.WriteLine(doc.Description); IExporter exporter = new PackingDecorator(new EncryptingDecorator(new LocalStorageFakeExporter())); exporter.Export(doc, DestinationDirectoryPath); }
/// <summary> /// Найти документ или комплект документов. /// </summary> /// <param name="document">Документ/комплект.</param> /// <param name="name">Имя документа/комплекта.</param> /// <returns>Документ/комплект. Если не найден, то null.</returns> private IDocumentComponent?TryGetDocument(IDocumentComponent document, string name) { if (document.Name.Equals(name)) { return(document); } else { IEnumerable <IDocumentComponent> docs = document.Children; return(docs.Select(doc => this.TryGetDocument(doc, name)) .FirstOrDefault(found => found != null)); } }
public void Export(IDocumentComponent document, string destDirFullPath) { IEnumerable <string> documentNames = document.GetFileNames(); foreach (var name in documentNames) { IDocumentComponent?doc = this.TryGetDocument(document, name); if (doc != null) { Console.WriteLine($"Файл {doc.Name} экспортирован в папку {destDirFullPath}."); } } }
public void Add(IDocumentComponent doc) { this.documents.Add(doc); }
public void AddComponent(IDocumentComponent documentComponent) { Console.WriteLine("Cannot add to leaf..."); }
public void AddComponent(IDocumentComponent documentComponent) { DocumentComponents.Add(documentComponent); }
public void AddComponent(IDocumentComponent documentComponent) { }
public abstract void Export(IDocumentComponent docs, string destDirFullPath);