static void Main(string[] args)
        {
            try
            {
                ArchivoTexto.Leer("Archivo.txt");
            }
            catch (FileNotFoundException e)
            {
                ArchivoTexto.Guardar(String.Format(AppDomain.CurrentDomain.BaseDirectory + "{0:yyyyMMdd-HHmm}.txt", DateTime.Now), String.Format("Error: {0}\nArchivo no encontrado: {1}", e.Message, e.FileName));
            }

            Console.WriteLine(ArchivoTexto.Leer(String.Format(AppDomain.CurrentDomain.BaseDirectory + "{0:yyyyMMdd-HHmm}.txt", DateTime.Now)));
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            string nombreArchivo = (@"C:\" + DateTime.Now.ToString("yyyyMMdd-HHmm") + ".txt");

            //string inners = "";
            try
            {
                MiClaseErrores aux = new MiClaseErrores(1);
            }
            catch (UnaException e)
            {
                ArchivoTexto.Guardar(nombreArchivo, e.Message);
            }

            Console.WriteLine(ArchivoTexto.Leer(nombreArchivo));
            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            string ruta = String.Format("{0}{1}{2}-{3}{4}.txt", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute);

            try
            {
                OtraClase aux = new OtraClase();
                aux.MiMetodoInstancia();  //1)Llama al metodo de la clase OtraClase...
            }
            catch (Exception e)
            { //9) Aca llega DivideByZero + UnaException + MiException
                if (!object.ReferenceEquals(e.InnerException, null))
                {
                    do
                    {
                        Console.WriteLine(e.Message);
                        ArchivoTexto.Guardar(ruta, e.Message);
                        e = e.InnerException;
                    } while (!object.ReferenceEquals(e, null));
                }
            }
            Console.ReadKey();
        }