Ejemplo n.º 1
0
 public int[] SubirANube()
 {
     int[] arreglo = new int[2];
     if (InterfaceHttp.InsertarSolucion(miSolucion))
     {
         subidos = 0;
         todos   = 0;
         Fichero padre = new Fichero();
         padre.IdFichero = miSolucion.IdProyecto;
         padre.TipoRaiz  = 0;
         padre.Nombre    = miSolucion.Nombre;
         padre.Ruta      = miSolucion.Ruta;
         todos++;
         int response = Int32.Parse(InterfaceHttp.CrearDirectorio(miSolucion.Ruta));
         if (response == 1)
         {
             subidos++;
         }
         subirFicheros(padre, miSolucion.Ficheros);
         arreglo[0] = todos;
         arreglo[1] = subidos;
     }
     else
     {
         arreglo[0] = -1;
         arreglo[1] = -1;
     }
     return(arreglo);
 }
Ejemplo n.º 2
0
 private void Padrificar(Fichero padre, ObservableCollection <Fichero> lista)
 {
     if (lista != null)
     {
         int     cont;
         Fichero f;
         for (cont = 0; cont < lista.Count; cont++)
         {
             f = lista[cont];
             if (f.IsFolder)
             {
                 f.Parent    = padre;
                 f.Ruta      = padre.Ruta + "/" + padre.Nombre;
                 f.RutaLocal = padre.RutaLocal + "//" + padre.Nombre;
                 Padrificar(f, f.Ficheros);
             }
             else
             {
                 f.Parent    = padre;
                 f.Ruta      = padre.Ruta + "/" + padre.Nombre;
                 f.RutaLocal = padre.RutaLocal + "//" + padre.Nombre;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public void AsignarPadres()
        {
            Fichero padre = new Fichero();

            padre.IdFichero = miSolucion.IdProyecto;
            padre.TipoRaiz  = 0;
            padre.Nombre    = miSolucion.Nombre;
            padre.RutaLocal = miSolucion.RutaLocal;
            Padrificar(padre, miSolucion.Ficheros);
        }
Ejemplo n.º 4
0
        public ObservableCollection <Fichero> LeerArbol()
        {
            ObservableCollection <Fichero> lista = new ObservableCollection <Fichero>();

            if (pos < solucion.Length && solucion[pos] == '{')
            {
                //comeinza en el primer identificador
                pos++;
                while (pos < solucion.Length && solucion[pos] != '}')
                {
                    Fichero f = new Fichero();
                    f.Nombre = ObtenerIdentificador();
                    if (solucion[pos] == '{')
                    {
                        f.IsFolder = true;
                        f.Ficheros = LeerArbol();
                    }
                    else
                    {
                        f.IsFolder = false;
                    }
                    try { lista.Add(f); }
                    catch { }
                    if (pos < solucion.Length & solucion[pos] == '}')
                    {
                        pos++;
                        break;
                    }

                    if (pos < solucion.Length & solucion[pos] == ',')
                    {
                        //brincar coma
                        pos++;
                    }
                }
            }
            return(lista);
        }
Ejemplo n.º 5
0
 private void subirFicheros(Fichero padre, ObservableCollection <Fichero> lista)
 {
     if (lista != null)
     {
         int     cont;
         Fichero f;
         for (cont = 0; cont < lista.Count; cont++)
         {
             f = lista[cont];
             string dir = padre.Ruta + "/" + f.Nombre;
             f.Ruta = padre.Ruta + "/" + f.Nombre;
             todos++;
             if (f.IsFolder)
             {
                 //mkdir
                 int response = Int32.Parse(InterfaceHttp.CrearDirectorio(dir));
                 if (response == 1)
                 {
                     subidos++;
                 }
                 subirFicheros(f, f.Ficheros);
             }
             else
             {
                 //leerArchivo
                 f.LeerArchivo();
                 //subirArchivo
                 int response = Int32.Parse(InterfaceHttp.EscribirArchivo(dir, f.ConvertirParaNube()));
                 if (response == 1)
                 {
                     subidos++;
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 public adminFicheros(Fichero cur)
 {
     currentFichero = cur;
 }