Ejemplo n.º 1
0
        public static void CopyAll(DirectoryInfo source, DirectoryInfo target, Inicio _ini, FtpClient ftp, ScreensGuardian _screen = null)
        {
            ScreensGuardian screenAUX = _screen;

            var _screens = _ini.config.Screens.ToArray();

            // Copy each subdirectory using recursion.
            foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
            {
                foreach (ScreensGuardian screen in _screens)
                {
                    if ("p" + screen.Code == diSourceSubDir.Name)
                    {
                        DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
                        CopyAll(diSourceSubDir, nextTargetSubDir, _ini, ftp, screen);
                        Log TgLog = new Log();
                        TgLog.SaveLog("DIRECTORIO COPIADO " + diSourceSubDir.Name);
                    }
                }
            }

            {
                Directory.CreateDirectory(screenAUX.LocalPath);
                //cambio gonzalo
                try
                {
                    Etc.DeleteFiles(screenAUX.LocalPath);
                    System.Threading.Thread.Sleep(2000);
                }
                catch (Exception ex)
                {
                    Log logaux = new Log();
                    logaux.SaveLog("ERROR CLEAR " + ex.Message);
                }

                // Copy each file into the new directory.
                foreach (FileInfo fi in source.GetFiles())
                {
                    //Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name);

                    fi.CopyTo(Path.Combine(screenAUX.LocalPath, fi.Name), true);
                    Log TgLog = new Log();
                    TgLog.SaveLog("ARCHIVO COPIADO - " + Path.Combine(screenAUX.LocalPath, fi.Name));
                }

                int idx = _ini.config.Screens.FindIndex(s => s.Code == screenAUX.Code);
                //guardar version nueva
                screenAUX.VersionActual  = screenAUX.VersionRemota.ToString();
                _ini.config.Screens[idx] = screenAUX;
                _ini.db.Save(_ini.config);
            }
        }
Ejemplo n.º 2
0
        public ConfiguracionFTP(Inicio _inicio)
        {
            ini  = _inicio;
            gLog = new Log();
            time = new Timer();



            tools = new Etc();
            InitializeComponent();

            LoadInitialValuesINICIO();
            gLog.SaveLog("--- Modo FTP ---");
        }