Пример #1
0
 static bool GuardarPlanTxt(this Planeta <Satelite> plan)
 {
     try
     {
         StreamWriter sw = new StreamWriter("planeta.txt");
         sw.WriteLine(plan.ToString());
         sw.Close();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #2
0
        public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
        {
            try
            {
                using (StreamWriter sw = File.AppendText("planeta.txt"))
                {
                    sw.WriteLine(plan.ToString());
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error al guardar archivo .txt", e);
            }

            return(true);
        }
Пример #3
0
        public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
        {
            string pathEscritorio = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\planeta.txt";

            try
            {
                StreamWriter f = new StreamWriter(pathEscritorio, true);
                f.WriteLine(plan);
                f.Close();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #4
0
        public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
        {
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(Environment.GetFolderPath
                                                                              (Environment.SpecialFolder.Desktop) + "\\Guardarplantxt.txt", true))
            {
                try
                {
                    sw.WriteLine(plan.ToString(), true);
                    return(true);
                }

                catch (Exception e)
                {
                    throw e;
                }
            }
        }
Пример #5
0
        public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
        {
            bool aux = false;

            if (plan != null)
            {
                try
                {
                    string       desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    StreamWriter sw      = new StreamWriter(Path.Combine(desktop, "planeta.txt"));
                    sw.WriteLine(plan.ToString());
                    sw.Close();
                    aux = true;
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            return(aux);
        }
        public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
        {
            string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            if (!(plan is null))
            {
                bool         append = File.Exists(Path.Combine(desktop, "planetas.txt"));
                StreamWriter sw     = new StreamWriter(Path.Combine(desktop, "planetas.txt"), append);
                try
                {
                    sw.WriteLine(plan.ToString());
                    return(true);
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message, e);
                }
                finally
                {
                    sw.Close();
                }
            }
            return(false);
        }
Пример #7
0
 public static bool GuardarPlanTxt(this Planeta <Satelite> plan)
 {
     return(true);
 }