Exemple #1
0
        //Verificar directorio, si no existe lo crea.


        public void SyncAsync(string _remotePath)
        {
            string Path = _remotePath;
            int    Qty  = 0;

            if (checkRemoteFolder(Path, ftpClient))
            {
                try
                {
                    DownloadFilesAsync(ftpClient, Path);
                    CloseConnection();
                    gLog.SaveLog("Se sincronizo archivos");
                }
                catch (Exception ex)
                {
                    gLog.SaveLog("No se logro sincronizar --" + ex.Message);
                    //throw;
                }

                //si hubo descargas
                //Falta descargar JSON
                if (Downloaded)
                {
                    try
                    {
                        //CreateBS();
                        Etc.KillApp(ini.config.Reproductor);                         //Cierra el reproductor
                        System.Threading.Thread.Sleep(3000);
                        //CopyTemporalToDirAsync(TemporalStorage, ini.config.CarpetaRaiz); //Copia el directorio temporal a la carpeta raiz


                        //GUSTAVO
                        CopyTemporalToDirAsync2(TemporalStorage, ini.config.CarpetaRaiz);                         //Copia el directorio temporal a la carpeta raiz


                        //OpenApp(ini.config.Reproductor);
                        //CloseBS();
                        Downloaded = false;
                        syncingOff();
                    }
                    catch (Exception ex)
                    {
                        gLog.SaveLog(ex.Message);
                        //Debug.WriteLine(ex.Message);
                        //throw;
                    }

                    //gustavo copya el json a la carpeta final antes de borrar la temporal
                    try
                    {
                        CopyJsonPlayList(TemporalStorage, ini.config.CarpetaRaiz);                        //Copia el json PLayList del directorio temporal a la carpeta raiz
                    }
                    catch (Exception ex)
                    {
                        gLog.SaveLog("ERROR COPY PlayList.json " + ex.Message);
                    }
                    //cambio gonzalo
                    try
                    {
                        Etc.DeleteFiles(TemporalStorage);
                    }
                    catch (Exception ex)
                    {
                        gLog.SaveLog("ERROR CLEAR TEMPORAL " + ex.Message);
                    }
                }

                Etc.OpenApp(ini.config.Reproductor);
            }
            else
            {
            }
        }