static void Main(string[] args) { /*1*/ // Save a document as fb2 file using "Save" dialog DocumentManager docManager = new Fb2DocumentManager(); docManager.Save(new XDocument(), "asd.fb2"); // Or use the IDocStorage interface to save a document IDocStorage storage = docManager.CreateStorage(); storage.Save("asd.fb2", new XDocument()); /*2*/ storage = docManager.CreateStorage(DocumentManager.StorageFormat.Docx); storage.Save("asd.docx", new XDocument()); /*3*/ docManager = new DocumentManagerGeneric <Fb2DocStorage>(); storage = docManager.CreateStorage(); storage.Save("asd.fb2", new XDocument()); /*4*/ // инициализация переменной фабрики Fb2-реализацией docManager = new DocumentManagerGenericAdapter(); storage = docManager.CreateStorage <DocxDocStorage>(); storage.Save("asd4.docx", new XDocument()); }
public bool Save(XDocument document, String _name) { // using Factory method to create a new document storage IDocStorage storage = this.CreateStorage(); storage.Save(_name, document); return(true); }
static void Main(string[] args) { DocumentManager docManager = new DocumentGeneric <DocXDocStorage>(); IDocStorage storage = docManager.CreateStorage(); storage.Load("asd.docx"); storage.Print("asd.docx", new XDocument()); docManager = new DocumentGeneric <EpubDocStorage>(); storage = docManager.CreateStorage(); storage.Save("qwert.epub", new XDocument()); docManager = new DocumentGeneric <HtmlDocStorage>(); storage = docManager.CreateStorage(); storage.Close("qwert.html", new XDocument()); Console.ReadLine(); }