CmisSync.Lib.SelectiveIgnore.SelectiveIgnoreEventTransformer.Handle C# (CSharp) Method

Handle() public method

public Handle ( ISyncEvent e ) : bool
e ISyncEvent
return bool
        public override bool Handle(ISyncEvent e) {
            if (e is FSMovedEvent) {
                var movedEvent = e as FSMovedEvent;
                if (this.IsInsideIgnoredPath(movedEvent.OldPath) && !this.IsInsideIgnoredPath(movedEvent.LocalPath)) {
                    this.queue.AddEvent(new FSEvent(WatcherChangeTypes.Created, movedEvent.LocalPath, movedEvent.IsDirectory));
                    return true;
                } else if (this.IsInsideIgnoredPath(movedEvent.LocalPath) && !this.IsInsideIgnoredPath(movedEvent.OldPath)) {
                    this.queue.AddEvent(new FSEvent(WatcherChangeTypes.Deleted, movedEvent.OldPath, movedEvent.IsDirectory));
                    return true;
                }
            }

            if (e is ContentChangeEvent) {
                var contentChangeEvent = e as ContentChangeEvent;
                if (contentChangeEvent.Type != ChangeType.Deleted) {
                    var state = IgnoredState.NOT_IGNORED;
                    var cmisObject = contentChangeEvent.CmisObject;
                    if (cmisObject is IFolder) {
                        state = this.ignores.IsIgnored(cmisObject as IFolder);
                    } else if (cmisObject is IDocument) {
                        state = this.ignores.IsIgnored(cmisObject as IDocument);
                    }

                    if (state == IgnoredState.INHERITED) {
                        this.queue.AddEvent(new ContentChangeEvent(ChangeType.Deleted, contentChangeEvent.ObjectId));
                        return true;
                    }
                }
            }

            return false;
        }