Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.Write("Enter 0 for open exist file or other for create new: ");
            var isNew = Console.ReadLine() != "0";

            string fileName = ReadFileName(args, isNew);

            var doc = AbstractHandler.CreateInstance(fileName);

            var type = doc switch
            {
                XMLHandler => "xml",
                DOCHandler => "doc",
                _ => "txt",
            };

            doc.Open();
            doc.Save();

            Console.WriteLine($"Type of file'{fileName}' is {type}");

            _ = Console.ReadKey();
        }