示例#1
0
        void WriteLog(Work work, SaveStat saveStat)
        {
            string Filename = DateTime.Now.ToString("MM.dd.yyyy") + "JsonLog.json";

            if (File.Exists(Filename))
            {
                //Creating Json object
                JsonLog save1 = new JsonLog()
                {
                    LastUpdate = DateTime.Now.ToString("dd/mm/yy HH:mm"), FileSource = saveStat.source, FileDestination = saveStat.destination, FileSize = saveStat.totalsize, TaskName = work.informations.Name, CryptTime = saveStat.CryptTime
                };

                //Writing Json object in the file
                string jsonSerializedObj1 = JsonConvert.SerializeObject(save1, Formatting.Indented);
                System.IO.File.AppendAllText(Filename, jsonSerializedObj1);
            }
            else
            {
                //Creating Json object
                JsonLog save = new JsonLog()
                {
                    LastUpdate = DateTime.Now.ToString("dd/mm/yy HH:mm"), FileSource = saveStat.source, FileDestination = saveStat.destination, FileSize = saveStat.totalsize, TaskName = work.informations.Name, CryptTime = saveStat.CryptTime
                };

                //Writing Json object in the file
                string jsonSerializedObj = JsonConvert.SerializeObject(save, Formatting.Indented);
                File.WriteAllText(Filename, jsonSerializedObj);
            }
        }
示例#2
0
 //Launch all saves method
 public void saveM(Work work, ManualResetEvent ProcessVerif)
 {
     mutex.WaitOne();
     mirror   = new SaveStat();
     JsonLogM = new JsonLog();
     PathAsker(work);
     FileDetector(work);
     FileCopier(ProcessVerif, work, true);
     FileCopier(ProcessVerif, work, false);
     JsonLogM.CreateLog(work, mirror);
     mutex.ReleaseMutex();
 }
示例#3
0
 //method launching all necessary methods
 public void saveM(Work work, ManualResetEvent ProcessVerif)
 {
     mutex.WaitOne();
     //Object that allow to get the values for the Log files
     differential = new SaveStat();
     JsonLogD     = new JsonLog();
     PathAsker(work);
     FileDetector();
     FileCopier(ProcessVerif, work, true);
     FileCopier(ProcessVerif, work, false);
     JsonLogD.CreateLog(work, differential);
     mutex.ReleaseMutex();
 }