/// <summary> /// gathers all parameter converter methods in the type /// </summary> /// <param name="type">the type</param> /// <param name="invokingInstance">the instance to invoke the speech methods or null to create one with the parameterless constructor ( /// static methods doesnt need a invoking instance so leave this null)</param> public void GatherConverters(Type type, object invokingInstance = null) { var converters = Crawler.CrawlConverterTypes(this.AllCommands.Converters, true, type); foreach (var converter in converters) { converter.InvokingInstance = invokingInstance; this.AllCommands.Converters.Add(converter.Key, converter); } }
/// <summary> /// gathers all parameter converter methods in the types the containing type must have the SpeechEnabledAttribute and the methods the SpeechParameterConverterAttribute /// </summary> /// <param name="targetAssembly">the assembly</param> /// <param name="onlyPublicVisibleOnes">true: only exported types, false: all types</param> public void GatherConverters(Assembly targetAssembly, bool onlyPublicVisibleOnes = true) { Type[] types = onlyPublicVisibleOnes ? targetAssembly.GetExportedTypes() : targetAssembly.GetTypes(); var converters = Crawler.CrawlConverterTypes(this.AllCommands.Converters, false, types); foreach (var converter in converters) { this.AllCommands.Converters.Add(converter.Key, converter); } }