コード例 #1
0
ファイル: AlterationVM.cs プロジェクト: eatplayhate/versionr
 private void DiffWithCurrent()
 {
     if ((_newRecord.Attributes & Attributes.Binary) == Attributes.Binary)
     {
         MainWindow.ShowMessage("Binary differences", String.Format("File: {0} has binary differences, but you don't really want to see them.", _newRecord.CanonicalName));
     }
     else
     {
         string tmpNew = DiffTool.GetTempFilename();
         _area.GetMissingObjects(new Record[] { _newRecord }, null);
         _area.RestoreRecord(_newRecord, DateTime.UtcNow, tmpNew);
         _area.GetTaskFactory().StartNew(() =>
         {
             try
             {
                 DiffTool.Diff(tmpNew, String.Format("{0} ({1})", _newRecord.Name, _alteration.NewRecord),
                               Path.Combine(_area.Root.FullName, _newRecord.CanonicalName), String.Format("{0} (working copy)", _newRecord.Name),
                               _area.Directives.ExternalDiff, false);
             }
             finally
             {
                 File.Delete(tmpNew);
             }
         });
     }
 }
コード例 #2
0
ファイル: AlterationVM.cs プロジェクト: eatplayhate/versionr
 private void DiffWithPrevious()
 {
     if ((_priorRecord.Attributes & Attributes.Binary) == Attributes.Binary ||
         (_newRecord.Attributes & Attributes.Binary) == Attributes.Binary)
     {
         MainWindow.ShowMessage("Binary differences", String.Format("File: {0} has binary differences, but you don't really want to see them.", _newRecord.CanonicalName));
     }
     else
     {
         // Displaying modifications
         string tmpPrior = DiffTool.GetTempFilename();
         string tmpNew   = DiffTool.GetTempFilename();
         _area.GetMissingObjects(new Record[] { _priorRecord, _newRecord }, null);
         _area.RestoreRecord(_priorRecord, DateTime.UtcNow, tmpPrior);
         _area.RestoreRecord(_newRecord, DateTime.UtcNow, tmpNew);
         _area.GetTaskFactory().StartNew(() =>
         {
             try
             {
                 DiffTool.Diff(tmpPrior, String.Format("{0} ({1})", _priorRecord.Name, _alteration.PriorRecord),
                               tmpNew, String.Format("{0} ({1})", _newRecord.Name, _alteration.NewRecord),
                               _area.Directives.ExternalDiff, false);
             }
             finally
             {
                 File.Delete(tmpPrior);
                 File.Delete(tmpNew);
             }
         });
     }
 }