public override void Solve(
IFileSystemInfo localFileInfo,
IObjectId remoteId,
ContentChangeType localContent = ContentChangeType.NONE,
ContentChangeType remoteContent = ContentChangeType.NONE)
{
if (localFileInfo is IDirectoryInfo) {
if (!this.DeleteLocalObjectIfHasBeenSyncedBefore(localFileInfo)) {
this.Storage.RemoveObject(this.Storage.GetObjectByLocalPath(localFileInfo));
throw new IOException(string.Format("Not all local objects under {0} have been synced yet", localFileInfo.FullName));
} else {
this.Storage.RemoveObject(this.Storage.GetObjectByLocalPath(localFileInfo));
}
} else if (localFileInfo is IFileInfo) {
var file = localFileInfo as IFileInfo;
file.Refresh();
var mappedFile = this.Storage.GetObjectByLocalPath(file);
if (file.Exists) {
if (mappedFile != null && file.LastWriteTimeUtc.Equals(mappedFile.LastLocalWriteTimeUtc)) {
file.Delete();
OperationsLogger.Info(string.Format("Deleted local file {0} because the mapped remote object {0} has been deleted", file.FullName, mappedFile.RemoteObjectId));
} else {
file.Uuid = null;
if (mappedFile == null) {
return;
}
OperationsLogger.Info(string.Format("Deletion of local file {0} skipped because of not yet uploaded changes", file.FullName));
}
} else {
if (mappedFile == null) {
return;
} else {
OperationsLogger.Info(string.Format("Deletion of local file {0} skipped because it has already been deleted", file.FullName));
}
}
this.Storage.RemoveObject(this.Storage.GetObjectByLocalPath(localFileInfo));
file.Refresh();
if (file.Exists) {
throw new IOException(string.Format("Deletion of local file {0} skipped because of not yet uploaded changes", localFileInfo.FullName));
}
}
}