Esempio n. 1
0
        static void Main(string[] args)
        {
            string formatDoc;

            Console.WriteLine("Введите формат документа");
            formatDoc = Console.ReadLine();
            if (formatDoc == "xml")
            {
                XMLHandler xml = new XMLHandler();
                xml.Open();
                xml.Create();
                xml.Change();
                xml.Save();
            }
            else if (formatDoc == "txt")
            {
                TXTHandler txt = new TXTHandler();
                txt.Open();
                txt.Create();
                txt.Change();
                txt.Save();
            }
            else if (formatDoc == "doc")
            {
                DOCHandler doc = new DOCHandler();
                doc.Open();
                doc.Create();
                doc.Change();
                doc.Save();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            AbstractHandler doc = new DOCHandler();

            AllMethods(doc);
            doc.Save();
            TXTHandler txt = new TXTHandler();

            AllMethods(txt);
            try
            {
                AbstractHandler xml = Definition("xml");
                AllMethods(xml);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Ошибка: {e.Message}");
            }
            Console.ReadLine();
        }