static void Main(string[] args) { DOCHandler docFile = new DOCHandler(); docFile.Create(); docFile.Change(); docFile.Open(); docFile.Save(); Console.WriteLine(new string('-', 20)); TXTHandler txtFile = new TXTHandler(); txtFile.Create(); txtFile.Change(); txtFile.Open(); txtFile.Save(); Console.WriteLine(new string('-', 20)); XMLHandler xmlFile = new XMLHandler(); xmlFile.Create(); xmlFile.Change(); xmlFile.Open(); xmlFile.Save(); Console.WriteLine(new string('-', 20)); Console.ReadKey(); }
static void Main(string[] args) { AbstractHandler xml_file = new XMLHandler(); xml_file.Create(); xml_file.Open(); xml_file.Change(); xml_file.Save(); AbstractHandler txt_file = new TXTHandler(); txt_file.Create(); txt_file.Open(); txt_file.Change(); txt_file.Save(); AbstractHandler doc_file = new DOCHandler(); doc_file.Create(); doc_file.Open(); doc_file.Change(); doc_file.Save(); Console.ReadKey(); }
static void Main() { AbstractHandler xmlDocument = new XMLHandler(); Console.WriteLine("Вы выбрали работу с документом типа XML:"); xmlDocument.Create(); xmlDocument.Open(); xmlDocument.Change(); xmlDocument.Save(); Console.WriteLine("\n"); AbstractHandler txtDocument = new TXTHandler(); Console.WriteLine("Вы выбрали работу с документом типа TXT:"); txtDocument.Create(); txtDocument.Open(); txtDocument.Change(); txtDocument.Save(); Console.WriteLine("\n"); AbstractHandler docDocument = new DOCHandler(); Console.WriteLine("Вы выбрали работу с документом типа DOC:"); docDocument.Create(); txtDocument.Open(); docDocument.Change(); docDocument.Save(); // Delay Console.ReadKey(); }
public void DoSomething() { AbstractHandler handler; string doctype; Console.WriteLine("Chose document type"); doctype = Console.ReadLine(); switch (doctype) { case "xml": case "XML": { handler = new XMLHandler(); break; } case "txt": case "TXT": { handler = new TXTHandler(); break; } case "doc": case "DOC": { handler = new DOCHandler(); break; } default: { handler = null; Console.WriteLine("Wrong document type"); break; } } if (handler != null) { handler.Open(); handler.Create(); handler.Change(); handler.Save(); } Console.ReadKey(); }
public void DoSomething() { AbstractHandler handler; string doctype; Console.WriteLine("Chose document type"); doctype = Console.ReadLine(); switch (doctype) { case "xml": case "XML": { handler = new XMLHandler(); break; } case "txt": case "TXT": { handler = new TXTHandler(); break; } case "doc": case "DOC": { handler = new DOCHandler(); break; } default: { handler = null; Console.WriteLine("Wrong document type"); break; } } if (handler != null) { handler.Open(); handler.Create(); handler.Change(); handler.Save(); } Console.ReadKey(); }