public override bool Handle(ISyncEvent e) {
string reason;
try {
var nameEvent = e as IFilterableNameEvent;
if (nameEvent != null && nameEvent.Name != null) {
if (nameEvent.IsDirectory) {
if (this.ignoredFolderNameFilter.CheckFolderName(nameEvent.Name, out reason)) {
this.Queue.AddEvent(new RequestIgnoredEvent(e, reason, this));
Logger.Info(reason);
return true;
}
} else {
if (this.ignoredFileNameFilter.CheckFile(nameEvent.Name, out reason)) {
this.Queue.AddEvent(new RequestIgnoredEvent(e, reason, this));
Logger.Info(reason);
return true;
}
}
}
var pathEvent = e as IFilterableRemotePathEvent;
if (pathEvent != null && pathEvent.RemotePath != null) {
if (this.ignoredFoldersFilter.CheckPath(pathEvent.RemotePath, out reason)) {
this.Queue.AddEvent(new RequestIgnoredEvent(e, reason, this));
Logger.Info(reason);
return true;
}
string[] folderNames = pathEvent.RemotePath.Split('/');
foreach (var name in folderNames) {
if (this.invalidFolderNameFilter.CheckFolderName(name, out reason)) {
this.Queue.AddEvent(new RequestIgnoredEvent(e, reason, this));
Logger.Info(reason);
return true;
}
}
}
var localFolderObjectEvent = e as FolderEvent;
if (localFolderObjectEvent != null) {
if (this.symlinkFilter.IsSymlink(localFolderObjectEvent.LocalFolder, out reason)) {
Logger.Info(reason);
return true;
}
}
var localFileObjectEvent = e as FileEvent;
if (localFileObjectEvent != null) {
if (this.symlinkFilter.IsSymlink(localFileObjectEvent.LocalFile, out reason)) {
Logger.Info(reason);
return true;
}
}
} catch (System.IO.DirectoryNotFoundException) {
} catch (System.IO.FileLoadException) {
} catch (System.NullReferenceException) {
}
return false;
}
}