예제 #1
0
        private void SaveCurrent()
        {
            string       fileName = Chemins.CheminBackupServeur() + DateTime.Now.ToString("dd-MM-yyyy") + ".csv";
            bool         deja     = File.Exists(fileName);
            ObjectThread o_       = new ObjectThread(Constantes.PBAR_WAIT);

            o_.UpdateMaxBar(lIO.Count);

            foreach (IOEMDevice o in lIO)
            {
                Logs.WriteCsv(fileName, o);
                Constantes.LoadPatience(false);
            }
            if (!deja)
            {
                FileInfo     file = new FileInfo(fileName);
                ObjectThread o1   = new ObjectThread(dgv_backup);
                o1.WriteDataGridView(new object[] { file.Name });
            }
            File.Delete(Chemins.CheminDatabase() + "LogRecord.csv");
            File.Create(Chemins.CheminDatabase() + "LogRecord.csv");

            ObjectThread o2 = new ObjectThread(dgv_log);

            o2.ClearDataGridView(true);
            Utils.WriteLog("-- Sauvegarde du fichier courant effectuée");
            Constantes.LoadPatience(true);
        }
예제 #2
0
        private void ReadSelectFile()
        {
            List <IOEMDevice> l = Logs.ReadCsv(Chemins.CheminBackupServeur() + currentFile);
            ObjectThread      o = new ObjectThread(Constantes.PBAR_WAIT);

            o.UpdateMaxBar(l.Count);
            LoadLogs(l);
        }
예제 #3
0
 public void LoadFileBackup()
 {
     dgv_backup.Rows.Clear();
     string[] files = System.IO.Directory.GetFiles(Chemins.CheminBackupServeur(), "*.csv");
     foreach (string f in files)
     {
         FileInfo file = new FileInfo(f);
         if (file.Name != "LogRecord.csv")
         {
             dgv_backup.Rows.Add(new object[] { file.Name });
         }
     }
     ResetDataBackup();
 }
예제 #4
0
 private void supprimerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentFile != null ? currentFile.Trim().Length > 0 : false)
     {
         Utils.WriteLog("Demande de suppression du fichier " + currentFile + " du serveur");
         if (Messages.Question("Voulez-vous vraiment supprimer ce fichier?") == System.Windows.Forms.DialogResult.Yes)
         {
             String file = Chemins.CheminBackupServeur() + currentFile;
             if (File.Exists(file))
             {
                 File.Delete(file);
             }
             LoadFileBackup();
             dgv_log.Rows.Clear();
         }
         else
         {
             Utils.WriteLog("Suppression du fichier " + currentFile + " du serveur annulée");
         }
     }
 }