/// <summary>
 /// Constructor de la clase Prestamo
 /// </summary>
 /// <param name="grupo">Grupo al que se realiza el prestamo</param>
 /// <param name="copias">Copias que se prestan</param>
 /// <param name="encargado">Usuario encargado del prestamo</param>
 /// <param name="ley">Ley que se está prestando</param>
 public Prestamo(Grupo grupo, int copias, Usuarios encargado, Leyes ley)
 {
     Ley           = ley;
     GrupoPrestado = grupo;
     Copias        = copias;
     Encargado     = encargado;
 }
        static void Main()
        {
            try
            {
                string archivo = "c:\\sysley\\Leyes.list";
                // Carga una lista
                // Carga la lista de leyes
                StreamReader lector   = new StreamReader(archivo);
                Leyes        ley      = null;
                Reglamento   regla    = null;
                string       linea    = lector.ReadLine();
                string[]     separado = null;
                int          i        = 0;
                while (linea != "" && linea != null)
                {
                    separado = linea.Split('|');
                    // Se empieza a leer en el espacio 3 por que es donde empieza el objeto
                    regla = new Reglamento(separado[5], separado[6], Convert.ToInt32(separado[7]));
                    ley   = new Clases.Leyes(separado[3], Convert.ToInt32(separado[4]), regla);
                    i     = 8;
                    if (separado.Length > 8)
                    {
                        while (i < separado.Length)
                        {
                            ley.Reglamentos.Agregar(new Reglamento(separado[i], separado[i + 1], Convert.ToInt32(separado[i + 2])));
                            i += 3;
                        }
                        Leyes.Agregar(ley);
                    }
                    linea = lector.ReadLine();
                }
                lector.Close();
                Leyes.Guardar();
                archivo = "c:\\sysley\\Reglamentos.list";
                // Carga la lista de reglamentos
                lector = new StreamReader(archivo);
                linea  = lector.ReadLine();
                while (linea != null)
                {
                    Reglamentos.Agregar(new Reglamento(linea));
                    linea = lector.ReadLine();
                }
                lector.Close();
                Reglamentos.Guardar();
                archivo = "c:\\sysley\\Usuarios.list";
                // Carga la lista de usuarios
                lector = new StreamReader(archivo);
                linea  = lector.ReadLine();
                while (linea != "" && linea != null)
                {
                    Usuarios.Agregar(new Clases.Usuarios(linea));
                    linea = lector.ReadLine();
                }
                lector.Close();
                Usuarios.Guardar();
                archivo = "c:\\sysley\\Grupos.list";
                // Carga la lista de grupos
                lector = new StreamReader(archivo);
                linea  = lector.ReadLine();
                while (linea != "" && linea != null)
                {
                    Grupos.Agregar(new Grupo(linea));
                    linea = lector.ReadLine();
                }
                lector.Close();
                Grupos.Guardar();
                lector = null;
                // Carga la pila de Prestamos
                archivo = "c:\\sysley\\Prestamos.pila";
                lector  = new StreamReader(archivo);
                linea   = lector.ReadLine();
                while (linea != "" && linea != null)
                {
                    string[] separados = linea.Split('|');

                    linea = lector.ReadLine();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                System.IO.Directory.CreateDirectory(@"c:\sysley");
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }