/// <summary>
        /// Gets the event handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">
        /// The <see cref="GSeries.Filesystem.FilesysEventArgs"/> instance
        /// containing the event data.</param>
        /// <returns>
        /// The event handler. Returns <see cref="NopFilesysEventHandler"/>
        /// if no other handler matches.
        /// </returns>
        protected override IFilesysEventHandler GetEventHandler(IFilesys sender,
                                                                FilesysEventArgs args)
        {
            if (IsPathIgnored(args.VritualRawPath))
            {
                return(new NopFilesysEventHandler());
            }
            var handlerName = GetHandlerName(args.VritualRawPath);

            if (string.IsNullOrEmpty(handlerName))
            {
                return(new NopFilesysEventHandler());
            }
            else
            {
                // The decision depends solely on the first segment of the path.
                IFilesysEventHandler handler = null;
                try {
                    handler = _container.Resolve <IFilesysEventHandler>(handlerName);
                } catch (ResolutionFailedException) {
                    Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format(
                                           "Failed to resovle hanlder for the given path: {0}.",
                                           args.VritualRawPath.PathString));
                }
                if (handler == null)
                {
                    return(new NopFilesysEventHandler());
                }
                else
                {
                    return(handler);
                }
            }
        }
 /// <summary>
 /// Gets the event handler.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">
 /// The <see cref="GSeries.Filesystem.FilesysEventArgs"/> instance
 /// containing the event data.</param>
 /// <returns>
 /// The event handler. Returns <see cref="NopFilesysEventHandler"/>
 /// if no other handler matches.
 /// </returns>
 protected override IFilesysEventHandler GetEventHandler(IFilesys sender, 
     FilesysEventArgs args)
 {
     if (IsPathIgnored(args.VritualRawPath)) {
     return new NopFilesysEventHandler();
       }
       var handlerName = GetHandlerName(args.VritualRawPath);
       if(string.IsNullOrEmpty(handlerName)) {
     return new NopFilesysEventHandler();
       } else {
     // The decision depends solely on the first segment of the path.
     IFilesysEventHandler handler = null;
     try {
       handler = _container.Resolve<IFilesysEventHandler>(handlerName);
     } catch (ResolutionFailedException) {
       Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format(
     "Failed to resovle hanlder for the given path: {0}.",
     args.VritualRawPath.PathString));
     }
     if (handler == null) {
       return new NopFilesysEventHandler();
     } else {
       return handler;
     }
       }
 }
예제 #3
0
 /// <summary>
 /// Gets the event handler.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">
 /// The <see cref="GSeries.Filesystem.FilesysEventArgs"/> instance 
 /// containing the event data.</param>
 /// <returns>The event handler. Returns <see cref="NopFilesysEventHandler"/> 
 /// if no other handler matches.</returns>
 protected abstract IFilesysEventHandler GetEventHandler(IFilesys sender,
     FilesysEventArgs args);
 /// <summary>
 /// Gets the event handler.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">
 /// The <see cref="GSeries.Filesystem.FilesysEventArgs"/> instance
 /// containing the event data.</param>
 /// <returns>The event handler. Returns <see cref="NopFilesysEventHandler"/>
 /// if no other handler matches.</returns>
 protected abstract IFilesysEventHandler GetEventHandler(IFilesys sender,
                                                         FilesysEventArgs args);