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 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); }
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)); } }
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(); } }