public virtual void Handle(object source, FileSystemEventArgs e) {
try {
bool isDirectory = false;
if (e.ChangeType == WatcherChangeTypes.Deleted) {
var path = this.fsFactory.CreateFileInfo(e.FullPath);
var obj = this.storage.GetObjectByLocalPath(path);
Guid guid = Guid.Empty;
if (obj != null) {
isDirectory = obj.Type == MappedObjectType.Folder;
guid = obj.Guid;
}
this.AddEventToList(e, guid, isDirectory);
} else {
bool? check = this.fsFactory.IsDirectory(e.FullPath);
if (check != null) {
isDirectory = (bool)check;
IFileSystemInfo fsInfo = isDirectory ? (IFileSystemInfo)this.fsFactory.CreateDirectoryInfo(e.FullPath) : (IFileSystemInfo)this.fsFactory.CreateFileInfo(e.FullPath);
Guid uuid = Guid.Empty;
try {
Guid? fsGuid = fsInfo.Uuid;
if (fsGuid != null) {
uuid = (Guid)fsGuid;
}
} catch(Exception) {
uuid = Guid.Empty;
}
this.AddEventToList(e, uuid, isDirectory);
}
}
} catch (Exception ex) {
Logger.Warn(string.Format("Processing file system event {0} produces exception => force crawl sync", e.ToString()), ex);
this.queue.AddEvent(new StartNextSyncEvent(true));
}
}