Ejemplo n.º 1
0
 public void Run(TxtEditor editor)
 {
     if (!editor.File.SavedToHard)
     {
         var record = new AutoSaveRecord {
             CreateDate    = DateTime.Now,
             FileName      = editor.File.Name,
             FilePath      = editor.File.Path,
             SavedFileName = $"{_directory}\\{Guid.NewGuid()}.ats"
         };
         TxtProcessor.WriteToFile(
             record.SavedFileName,
             editor.File.Text);
     }
 }
Ejemplo n.º 2
0
 public void Run(IEnumerable <TxtEditor> editors)
 {
     Records = new List <AutoSaveRecord>();
     foreach (var edt in editors)
     {
         if (edt.AutoSave && edt.File.SavedToHard)
         {
             TxtProcessor.WriteToFile(edt.File.Path, edt.File.Text);
             continue;
         }
         else if (edt.AutoSave && !edt.File.SavedToHard)
         {
             var record = new AutoSaveRecord {
                 CreateDate    = DateTime.Now,
                 FileName      = edt.File.Name,
                 FilePath      = edt.File.Path,
                 SavedFileName = $"{_directory}\\{Guid.NewGuid()}.ats"
             };
             TxtProcessor.WriteToFile(record.SavedFileName, edt.File.Text);
             Records.Add(record);
         }
     }
 }