本文整理汇总了C#中IParser.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IParser.GetType方法的具体用法?C# IParser.GetType怎么用?C# IParser.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParser
的用法示例。
在下文中一共展示了IParser.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeSettings
private void InitializeSettings()
{
_faxPath = new DirectoryInfo(_configuration.FaxPath);
_archivePath = new DirectoryInfo(_configuration.ArchivePath);
_analysisPath = new DirectoryInfo(_configuration.AnalysisPath);
string ocrPath = null;
if (_configuration.OCRSoftware == OcrSoftware.Tesseract)
{
if (string.IsNullOrWhiteSpace(_configuration.OCRSoftwarePath)) { ocrPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\tesseract"; }
}
else
{
if (string.IsNullOrWhiteSpace(_configuration.OCRSoftwarePath)) { ocrPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\cuneiform"; }
}
_ocrPath = new DirectoryInfo(ocrPath);
if (!_ocrPath.Exists)
{
throw new DirectoryNotFoundException(string.Format("The OCR software '{0}' was suggested to be found in path '{1}', which doesn't exist!", _configuration.OCRSoftware, _ocrPath.FullName));
}
// Import parser with the given name/alias
_parser = ExportedTypeLibrary.Import<IParser>(_configuration.AlarmFaxParserAlias);
Logger.Instance.LogFormat(LogType.Info, this, "Using parser '{0}'.", _parser.GetType().FullName);
}
示例2: InitializeParser
private void InitializeParser()
{
_parser = ExportedTypeLibrary.Import<IParser>(_configuration.AlarmFaxParserAlias);
Logger.Instance.LogFormat(LogType.Trace, this, Properties.Resources.UsingParserTrace, _parser.GetType().FullName);
}
示例3: FaxConfiguration
void IAlarmSource.Initialize(IServiceProvider serviceProvider)
{
_configuration = new FaxConfiguration(serviceProvider);
_faxPath = new DirectoryInfo(_configuration.FaxPath);
_archivePath = new DirectoryInfo(_configuration.ArchivePath);
_analysisPath = new DirectoryInfo(_configuration.AnalysisPath);
InitializeOcrSoftware();
// Import parser with the given name/alias
_parser = ExportedTypeLibrary.Import<IParser>(_configuration.AlarmFaxParserAlias);
Logger.Instance.LogFormat(LogType.Info, this, "Using parser '{0}'.", _parser.GetType().FullName);
}
示例4: RegisterPacketParser
/// <summary>
/// Register a packet parser to parse all packets with specific packet code.
/// </summary>
/// <param name="code">The packet code of packets that will be parsed.</param>
/// <param name="parser">The specified parser that will parse the packet specifically.</param>
public void RegisterPacketParser(int code, IParser parser)
{
if (_packetParsers.ContainsKey(code))
{
//Only one parser can be assigned for each packet code. Here we overrided a previous Parser
//and therefore inform about it as a Warning.
if (OnWarningOccured != null)
OnWarningOccured(_packetParsers[code], new Warning(string.Format("When registering an IParser of type {0} for packet code {1} a previous IParser was overriden of type {2}.",
parser.GetType().FullName, code, _packetParsers[code].GetType().FullName)));
//Override the previous parser.
_packetParsers[code] = parser;
}
else
_packetParsers.Add(code, parser);
MonitorExceptionOnObject(parser);
}