internal object CreateTabCompletionSource(CommandLineArgumentsDefinition definition, CommandLineArgument argument) { ITabCompletionSource ret; if (this.CompletionSourceType.GetInterfaces().Contains(typeof(ISmartTabCompletionSource))) { var source = Activator.CreateInstance(CompletionSourceType) as ISmartTabCompletionSource; return(new ArgumentAwareWrapperSmartTabCompletionSource(definition, argument, source)); } else if (this.CompletionSourceType.IsSubclassOf(typeof(ArgumentAwareTabCompletionSource))) { ret = (ITabCompletionSource)Activator.CreateInstance(this.CompletionSourceType, definition, argument); } else if (this.CompletionSourceType.GetInterfaces().Contains(typeof(ITabCompletionSource))) { var toWrap = (ITabCompletionSource)Activator.CreateInstance(this.CompletionSourceType); ret = new ArgumentAwareWrapperTabCompletionSource(definition, argument, toWrap); } else { throw new InvalidArgDefinitionException("The type " + this.CompletionSourceType.FullName + " does not implement ITabCompletionSource or ITabCompletionSource. The target argument was " + argument.DefaultAlias); } return(ret); }
internal object CreateTabCompletionSource(CommandLineArgumentsDefinition definition, CommandLineArgument argument) { ITabCompletionSource ret; if(this.CompletionSourceType.GetInterfaces().Contains(typeof(ISmartTabCompletionSource))) { var source = Activator.CreateInstance(CompletionSourceType) as ISmartTabCompletionSource; return new ArgumentAwareWrapperSmartTabCompletionSource(definition, argument, source); } else if (this.CompletionSourceType.IsSubclassOf(typeof(ArgumentAwareTabCompletionSource))) { ret = (ITabCompletionSource)Activator.CreateInstance(this.CompletionSourceType, definition, argument); } else if (this.CompletionSourceType.GetInterfaces().Contains(typeof(ITabCompletionSource))) { var toWrap = (ITabCompletionSource)Activator.CreateInstance(this.CompletionSourceType); ret = new ArgumentAwareWrapperTabCompletionSource(definition, argument, toWrap); } else { throw new InvalidArgDefinitionException("The type " + this.CompletionSourceType.FullName + " does not implement ITabCompletionSource or ITabCompletionSource. The target argument was " + argument.DefaultAlias); } return ret; }