本文整理汇总了C#中Chorus.VcsDrivers.Mercurial.FileInRevision.CreateTempFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileInRevision.CreateTempFile方法的具体用法?C# FileInRevision.CreateTempFile怎么用?C# FileInRevision.CreateTempFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chorus.VcsDrivers.Mercurial.FileInRevision
的用法示例。
在下文中一共展示了FileInRevision.CreateTempFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CollectChangesInFile
private void CollectChangesInFile(FileInRevision fileInRevision, string parentRev, List<IChangeReport> changes)
{
var handler = _fileHandlerCollection.GetHandlerForDiff(fileInRevision.FullPath);
//find, for example, a handler that can handle .lift dictionary, or a .wav sound file
if (handler.CanDiffFile(fileInRevision.FullPath))//review: isn't that just asking again?
{
if (parentRev != null && fileInRevision.ActionThatHappened == FileInRevision.Action.Modified)
{
var parentFileInRevision = new FileInRevision(parentRev, Path.Combine(Repository.PathToRepo, fileInRevision.FullPath),
fileInRevision.ActionThatHappened);
//pull the files out of the repository so we can read them
// using (var targetFile = fileInRevision.CreateTempFile(Repository))
// using (var parentFile = parentFileInRevision.CreateTempFile(Repository))
{
//run the differ which the handler provides, adding the changes to the cumulative
//list we are gathering for this whole revision
changes.AddRange(handler.Find2WayDifferences(parentFileInRevision, fileInRevision, Repository));
}
}
else
{
try
{
using (var targetFile = fileInRevision.CreateTempFile(Repository))
{
changes.AddRange(handler.DescribeInitialContents(fileInRevision, targetFile));
}
}
catch (Exception error)
{
changes.Add(new DefaultChangeReport(fileInRevision,
"Error retrieving historical version. "+error.Message));
}
}
}
else
{
switch (fileInRevision.ActionThatHappened)
{
case FileInRevision.Action.Added:
changes.Add(new DefaultChangeReport(fileInRevision, "Added"));
break;
case FileInRevision.Action.Modified:
var parentFileInRevision = new FileInRevision(parentRev, Path.Combine(Repository.PathToRepo, fileInRevision.FullPath),
FileInRevision.Action.Parent);
changes.Add(new DefaultChangeReport(parentFileInRevision, fileInRevision, "Changed"));
break;
case FileInRevision.Action.Deleted:
changes.Add(new DefaultChangeReport(fileInRevision, "Deleted"));
break;
default:
Debug.Fail("Found unexpected FileInRevision Action.");
break;
}
}
}