Пример #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);
 }
Пример #2
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++;
                 }
             }
         }
     }
 }