diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-26 07:04:33 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-26 07:04:33 -0800 |
commit | 8a677d2d2320e96e4b70e994e978804a5cc358fc (patch) | |
tree | 25353095c2f3d5bbb940d47e8f612cafcdd4aa44 /src/DotNetOpenAuth.BuildTasks/CompareFiles.cs | |
parent | ce37861c9507e338fc81314898b3a30888310b55 (diff) | |
parent | 72f5ee12a341eaca93075fb0f4705bec7cc84631 (diff) | |
download | DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.zip DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.tar.gz DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.tar.bz2 |
Merge branch 'reports' into v3.3
Conflicts:
projecttemplates/WebFormsRelyingParty/Web.config
src/DotNetOpenAuth/OpenId/RelyingParty/PositiveAnonymousResponse.cs
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/CompareFiles.cs')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/CompareFiles.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/CompareFiles.cs b/src/DotNetOpenAuth.BuildTasks/CompareFiles.cs index 691df20..51fcee4 100644 --- a/src/DotNetOpenAuth.BuildTasks/CompareFiles.cs +++ b/src/DotNetOpenAuth.BuildTasks/CompareFiles.cs @@ -81,5 +81,32 @@ namespace DotNetOpenAuth.BuildTasks { return true; } + + /// <summary> + /// Tests whether a file is up to date with respect to another, + /// based on existence, last write time and file size. + /// </summary> + /// <param name="sourcePath">The source path.</param> + /// <param name="destPath">The dest path.</param> + /// <returns><c>true</c> if the files are the same; <c>false</c> if the files are different</returns> + internal static bool FastFileEqualityCheck(string sourcePath, string destPath) { + FileInfo sourceInfo = new FileInfo(sourcePath); + FileInfo destInfo = new FileInfo(destPath); + + if (sourceInfo.Exists ^ destInfo.Exists) { + // Either the source file or the destination file is missing. + return false; + } + + if (!sourceInfo.Exists) { + // Neither file exists. + return true; + } + + // We'll say the files are the same if their modification date and length are the same. + return + sourceInfo.LastWriteTimeUtc == destInfo.LastWriteTimeUtc && + sourceInfo.Length == destInfo.Length; + } } } |