本文整理汇总了C#中IResourceLoader.FindClass方法的典型用法代码示例。如果您正苦于以下问题:C# IResourceLoader.FindClass方法的具体用法?C# IResourceLoader.FindClass怎么用?C# IResourceLoader.FindClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResourceLoader
的用法示例。
在下文中一共展示了IResourceLoader.FindClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadTokenizerFactory
// (there are no tests for this functionality)
private TokenizerFactory LoadTokenizerFactory(IResourceLoader loader, string cname)
{
Type clazz = loader.FindClass(cname /*, typeof(TokenizerFactory) */);
try
{
TokenizerFactory tokFactory = (TokenizerFactory)Activator.CreateInstance(clazz,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
null, new object[] { tokArgs }, CultureInfo.InvariantCulture);
if (tokFactory is IResourceLoaderAware)
{
((IResourceLoaderAware)tokFactory).Inform(loader);
}
return tokFactory;
}
catch (Exception e)
{
throw e;
}
}
示例2: LoadSynonyms
/// <summary>
/// Load synonyms with the given <seealso cref="SynonymMap.Parser"/> class.
/// </summary>
private SynonymMap LoadSynonyms(IResourceLoader loader, string cname, bool dedup, Analyzer analyzer)
{
Encoding decoder = Encoding.UTF8;
SynonymMap.Parser parser;
Type clazz = loader.FindClass(cname /*, typeof(SynonymMap.Parser) */);
try
{
parser = (SynonymMap.Parser)Activator.CreateInstance(clazz,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
null, new object[] { dedup, expand, analyzer }, CultureInfo.InvariantCulture);
}
catch (Exception e)
{
throw e;
}
if (File.Exists(synonyms))
{
parser.Parse(new StreamReader(loader.OpenResource(synonyms), decoder));
}
else
{
IEnumerable<string> files = SplitFileNames(synonyms);
foreach (string file in files)
{
parser.Parse(new StreamReader(loader.OpenResource(synonyms), decoder));
}
}
return parser.Build();
}