public bool LocalFileHasChanged(string path)
{
string normalizedPath = Normalize(path);
// Calculate current checksum.
string currentChecksum = null;
try
{
currentChecksum = Checksum(path);
}
catch (IOException)
{
Logger.Warn("IOException while reading file checksum: " + path
+ " File is probably being edited right now, so skip it. See https://github.com/nicolas-raoul/CmisSync/issues/245");
return false;
}
// Read previous checksum from database.
string previousChecksum = null;
string command = "SELECT checksum FROM files WHERE path=@path";
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("path", normalizedPath);
previousChecksum = (string)ExecuteSQLFunction(command, parameters);
if (!currentChecksum.Equals(previousChecksum))
Logger.Info("Checksum of " + path + " has changed from " + previousChecksum + " to " + currentChecksum);
return !currentChecksum.Equals(previousChecksum);
}