private void SetLastModifiedDate(IDocument remoteDocument, string filepath, Dictionary<string, string[]> metadata)
{
try
{
if (remoteDocument.LastModificationDate != null)
{
File.SetLastWriteTimeUtc(filepath, (DateTime)remoteDocument.LastModificationDate);
}
else
{
string[] cmisModDate;
if (metadata.TryGetValue("cmis:lastModificationDate", out cmisModDate) && cmisModDate.Length == 3) // TODO explain 3 and 2 in following line
{
DateTime modDate = DateTime.Parse(cmisModDate[2]);
File.SetLastWriteTimeUtc(filepath, modDate);
}
}
}
catch (Exception e)
{
Logger.Debug(String.Format("Failed to set last modified date for the local file: {0}", filepath), e);
}
}