/// <summary>
        /// Le da formato al textBox para ingresar la URL e inicializa el archivo del historial
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void frmWebBrowser_Load(object sender, EventArgs e)
        {
            this.txtUrl.SelectionStart  = 0; //This keeps the text
            this.txtUrl.SelectionLength = 0; //from being highlighted
            this.txtUrl.ForeColor       = Color.Gray;
            this.txtUrl.Text            = frmWebBrowser.ESCRIBA_AQUI;

            archivos = new Archivos.Texto(frmHistorial.ARCHIVO_HISTORIAL);
        }
        public void TestGuardarTextoSinPermisos()
        {
            texto = new Texto();
            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Windows) +
                              "\\TestGuardarTextoSinPermisos.txt";

            string dataToBeSaved = "this cannot be saved";

            texto.Guardar(filePath, dataToBeSaved);
        }
        public static bool Guardar(Jornada jornada)
        {
            try{
                Texto t = new Archivos.Texto();

                return(t.Guardar(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\jornada.txt", jornada.ToString()));
            } catch (Exception e)
            {
                throw new ArchivosException(e);
            }
        }
Exemple #4
0
        private void frmHistorial_Load(object sender, EventArgs e)
        {
            Archivos.Texto archivos  = new Archivos.Texto(frmHistorial.ARCHIVO_HISTORIAL);
            List <string>  historial = new List <string>();

            archivos.Leer(out historial);

            foreach (string t in historial)
            {
                this.lstHistorial.Items.Add(t);
            }
        }
        public void TestLeerTextoPathInexistente()
        {
            texto = new Texto();
            string filePath = desktopPath + "\\TestLeerTextoPathInexistente.txt";

            string loadedData;

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            texto.Leer(filePath, out loadedData);
        }
        public void TestMethod3()
        {
            //arrange
            string ruta;
            Alumno a = new Alumno(1, "nicolas", "gonzalez", "12344543", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Legislacion);

            //act

            Archivos.Texto texto = new Archivos.Texto();
            ruta = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            texto.Guardar(ruta, a.ToString());

            //asert lo maneja expectedexception
        }
 public static bool Leer(Jornada jornada)
 {
     try{
         Texto  t = new Archivos.Texto();
         string datos;
         string archivo = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\jornada.txt";
         bool   s       = t.Leer(archivo, out datos);;
         Console.WriteLine(datos);
         return(s);
     }catch (Exception e)
     {
         throw new ArchivosException(e);
     }
 }
 /// <summary>
 /// Lee los datos de guardados de la jornada (en jornada.txt) y los retorna en una cadena.
 /// </summary>
 /// <returns></returns>
 public static string Leer()
 {
     try
     {
         Texto  t = new Archivos.Texto();
         string texto;
         string file_name = AppDomain.CurrentDomain.BaseDirectory + "\\Jornada.txt";
         t.Leer(file_name, out texto);
         return(texto);
     }
     catch (Exception ex)
     {
         throw new ArchivosException("Archivos Exception", ex);
     }
 }
        public void TestLeerYGuardarTextoDatosValidos()
        {
            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +
                              "\\TestLeerYGuardarTextoDatosValidos.txt";
            string dataToBeSaved = "this is some data";

            texto = new Texto();
            texto.Guardar(filePath, dataToBeSaved);

            string savedData;

            texto.Leer(filePath, out savedData);

            Assert.AreEqual(savedData, dataToBeSaved);
            File.Delete(filePath);
        }
Exemple #10
0
        public void TestLeerFalse()
        {
            string testLeer;

            testTexto = new Texto();
            string testPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\TestLeer.txt";

            try
            {
                testTexto.Leer(testPath, out testLeer);
            }
            catch (FileNotFoundException e)
            {
                Assert.IsInstanceOfType(e, typeof(FileNotFoundException));
            }
        }
Exemple #11
0
        public Turnos Leer()
        {
            Turnos          dato = new Turnos();
            FileStream      fs   = new FileStream(this.Ruta, FileMode.Open);
            BinaryFormatter ser  = new BinaryFormatter();

            try
            {
                dato = (Turnos)ser.Deserialize(fs);
            }
            catch (Exception e)
            {
                Texto error = new Texto();
                error.Guardar($"{e.Message} - Metodo: Binario.Leer()");
            }
            finally
            {
                fs.Close();
            }

            return(dato);
        }
Exemple #12
0
        public bool Guardar(Turnos turno)
        {
            bool            success = false;
            FileStream      fs      = new FileStream(this.Ruta, FileMode.Append);
            BinaryFormatter ser     = new BinaryFormatter();

            try
            {
                ser.Serialize(fs, turno);
                success = true;
            }
            catch (Exception e)
            {
                Texto error = new Texto();
                error.Guardar($"{e.Message} - Metodo: Binario.Guardar()");
                success = false;
            }
            finally
            {
                fs.Close();
            }
            return(success);
        }
Exemple #13
0
        private void btnTxt_Click(object sender, EventArgs e)
        {
            Archivos.Texto texto = new Archivos.Texto();
            string         datos;

            texto.Leer("patentes.txt", out datos);

            string[] patentes = datos.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            foreach (string patente in patentes)
            {
                try
                {
                    Patente p = new Patente();
                    p = p.ValidarPatente(patente);
                    VistaPatente.Invoke(p);
                    cola.Enqueue(p.ValidarPatente(p.CodigoPatente));
                }
                catch (Exception ex)
                {
                }
                IniciarSimulacion();
            }
        }
        //que onda esto?

        public static bool Guardar(Jornada jornada)
        {
            bool rta = false;

            try {
                string         a         = jornada.ToString();
                Archivos.Texto guardador = new Archivos.Texto();

                if (guardador.Guardar(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Jornada.txt", a))
                {
                    rta = true;
                }
                else
                {
                    rta = false;
                }
            }catch (Exception e)
            {
                throw new ArchivosException(e);
            }


            return(rta);
        }