Ejemplo n.º 1
0
        public void GetFiles()
        {
            string aux = "", nombre;

            string[] archivos = Directory.GetFiles(Path);
            foreach (var archivo in archivos)
            {
                nombre = archivo.Substring(0, archivo.Length - 4);//para eliminar el ".txt"

                aux = "";
                for (int i = nombre.Length - 1; nombre[i] != '\\' && i >= 0; --i)
                {
                    aux += nombre[i];
                }
                nombre = "";
                for (int i = aux.Length - 1; i >= 0; --i)
                {
                    nombre += aux[i];
                }

                Pacientes nom = new Pacientes();
                nom.name = nombre;
                arbol.insertar(nom);


                string[] contenido = File.ReadAllLines(archivo);
                int      contador  = 0;
                foreach (string linea in contenido)
                {
                    if (contador == 0)
                    {
                        nom.edad = int.Parse(linea);
                        contador++;
                    }
                    else if (contador == 1)
                    {
                        nom.coronavirus = linea;
                        contador++;
                    }
                    else if (contador >= 2)
                    {
                        nom.expediente += linea;
                    }
                }
            }
        }