public void Test() { ExecuteHandlers <Result> handler = new ExecuteHandlers <Result>(); handler.AddCommand(new MyCommand()); handler.Execute(); }
/// <summary> /// Initializes a new instance of FileSearcher class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="pattern">The search pattern.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearcher(string folder, string pattern, ExecuteHandlers handlerOption) { CheckFolder(folder); CheckPattern(pattern); searcher = new FilePatternSearcher(folder, pattern, handlerOption); }
/// <summary> /// Initializes a new instance of FileSearcher class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="isValid">The delegate that determines algorithm of file selection.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearcher(string folder, Func <FileInfo, bool> isValid, ExecuteHandlers handlerOption) { CheckFolder(folder); CheckDelegate(isValid); searcher = new FileDelegateSearcher(folder, isValid, handlerOption); }
public ScriptInterpreter GetLoaderOfFiletype(string type) { lock (ExecuteHandlers) { SystemExecHandler handler; if (ExecuteHandlers.TryGetValue(type, out handler)) { return(null); } } return(new AIMLScriptIntperForFiletype(type, this)); }
Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { while (ExecuteHandlers.Count > 0) { var first = ExecuteHandlers.Dequeue(); first(commandData, ref message, elements); } while (InvokeHandlers.Count > 0) { var first = InvokeHandlers.Dequeue(); first(commandData.Application); } return(Result.Succeeded); }
public FileDelegateSearcher(string folder, Func <FileInfo, bool> isValid, ExecuteHandlers handlerOption) : base(folder, handlerOption) { this.isValid = isValid; }
public FileCancellationPatternSearcher(string folder, string pattern, CancellationToken token, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) : base(folder, token, handlerOption, suppressOperationCanceledException) { this.pattern = pattern; }
/// <summary> /// Initializes a new instance of FileSearchMultiple class. /// </summary> /// <param name="folders">Start search directories.</param> /// <param name="isValid">The delegate that determines algorithm of file selection.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <param name="suppressOperationCanceledException">Determines whether necessary suppress OperationCanceledException if it possible.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearchMultiple(List <string> folders, Func <FileInfo, bool> isValid, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) { CheckFolders(folders); CheckDelegate(isValid); CheckTokenSource(tokenSource); searchers = new List <FileSearchBase>(); this.suppressOperationCanceledException = suppressOperationCanceledException; foreach (var folder in folders) { searchers.Add(new FileCancellationDelegateSearch(folder, isValid, handlerOption, false, tokenSource.Token)); } this.tokenSource = tokenSource; }
/// <summary> /// Initializes a new instance of FileSearchMultiple class. /// </summary> /// <param name="folders">Start search directories.</param> /// <param name="pattern">The search pattern.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearchMultiple(List <string> folders, string pattern, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption) : this(folders, pattern, tokenSource, handlerOption, true) { }
/// <summary> /// Initialize a new instance of DirectorySearch class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="pattern">The search pattern.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where DirectoriesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public DirectorySearcher(string folder, string pattern, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption) : this(folder, pattern, tokenSource, handlerOption, true) { }
/// <summary> /// Initialize a new instance of DirectorySearch class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="isValid">The delegate that determines algorithm of directory selection.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where DirectoriesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public DirectorySearcher(string folder, Func <DirectoryInfo, bool> isValid, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption) : this(folder, isValid, tokenSource, ExecuteHandlers.InCurrentTask, true) { }
public FileCancellationSearcherBase(string folder, CancellationToken token, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) : base(folder, handlerOption) { this.token = token; this.SuppressOperationCanceledException = suppressOperationCanceledException; }
/// <summary> /// Initializes a new instance of FileSearcher class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="isValid">The delegate that determines algorithm of file selection.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearcher(string folder, Func <FileInfo, bool> isValid, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption) : this(folder, isValid, tokenSource, handlerOption, true) { }
public FilePatternSearcher(string folder, string pattern, ExecuteHandlers handlerOption) : base(folder, handlerOption) { this.pattern = pattern; }
public FileCancellationDelegateSearcher(string folder, Func <FileInfo, bool> isValid, CancellationToken token, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) : base(folder, token, handlerOption, suppressOperationCanceledException) { this.isValid = isValid; }
/// <summary> /// Initialize a new instance of DirectorySearch class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="isValid">The delegate that determines algorithm of directory selection.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where DirectoriesFound event handlers are executed.</param> /// <param name="suppressOperationCanceledException">Determines whether necessary suppress OperationCanceledException if it possible.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public DirectorySearcher(string folder, Func <DirectoryInfo, bool> isValid, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) { CheckFolder(folder); CheckDelegate(isValid); CheckTokenSource(tokenSource); searcher = new DirectoryCancellationDelegateSearcher(folder, isValid, tokenSource.Token, handlerOption, suppressOperationCanceledException); this.tokenSource = tokenSource; }
public FileSearcherBase(string folder, ExecuteHandlers handlerOption) { this.folder = folder; this.handlerOption = handlerOption; taskHandlers = new ConcurrentBag <Task>(); }
/// <summary> /// Initialize a new instance of DirectorySearch class. /// </summary> /// <param name="folder">The start search directory.</param> /// <param name="pattern">The search pattern.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where DirectoriesFound event handlers are executed.</param> /// <param name="suppressOperationCanceledException">Determines whether necessary suppress OperationCanceledException if it possible.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public DirectorySearcher(string folder, string pattern, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) { CheckFolder(folder); CheckPattern(pattern); CheckTokenSource(tokenSource); searcher = new DirectoryCancellationPatternSearcher(folder, pattern, tokenSource.Token, handlerOption, suppressOperationCanceledException); this.tokenSource = tokenSource; }
/// <summary> /// Initializes a new instance of FileSearchMultiple class. /// </summary> /// <param name="folders">Start search directories.</param> /// <param name="isValid">The delegate that determines algorithm of file selection.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearchMultiple(List <string> folders, Func <FileInfo, bool> isValid, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption) : this(folders, isValid, tokenSource, handlerOption, true) { }
public DirectoryCancellationSearcherBase(string folder, CancellationToken token, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) { this.folder = folder; this.token = token; this.handlerOption = handlerOption; this.SuppressOperationCanceledException = suppressOperationCanceledException; taskHandlers = new ConcurrentBag <Task>(); }
/// <summary> /// Initializes a new instance of FileSearchMultiple class. /// </summary> /// <param name="folders">Start search directories.</param> /// <param name="pattern">The search pattern.</param> /// <param name="tokenSource">Instance of CancellationTokenSource for search process cancellation possibility.</param> /// <param name="handlerOption">Specifies where FilesFound event handlers are executed.</param> /// <param name="suppressOperationCanceledException">Determines whether necessary suppress OperationCanceledException if it possible.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public FileSearchMultiple(List <string> folders, string pattern, CancellationTokenSource tokenSource, ExecuteHandlers handlerOption, bool suppressOperationCanceledException) { CheckFolders(folders); CheckPattern(pattern); CheckTokenSource(tokenSource); searchers = new List <FileSearchBase>(); this.suppressOperationCanceledException = suppressOperationCanceledException; foreach (var folder in folders) { searchers.Add(new FileCancellationPatternSearch(folder, pattern, handlerOption, false, tokenSource.Token)); } this.tokenSource = tokenSource; }