当前位置: 首页>>代码示例>>C#>>正文


C# IParser.GetType方法代码示例

本文整理汇总了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);
        }
开发者ID:The-Stig,项目名称:AlarmWorkflow,代码行数:25,代码来源:FaxAlarmSource.cs

示例2: InitializeParser

 private void InitializeParser()
 {
     _parser = ExportedTypeLibrary.Import<IParser>(_configuration.AlarmFaxParserAlias);
     Logger.Instance.LogFormat(LogType.Trace, this, Properties.Resources.UsingParserTrace, _parser.GetType().FullName);
 }
开发者ID:OpenFireSource,项目名称:AlarmWorkflow,代码行数:5,代码来源:FaxAlarmSource.cs

示例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);
        }
开发者ID:Bolde,项目名称:AlarmWorkflow,代码行数:14,代码来源:FaxAlarmSource.cs

示例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);
        }
开发者ID:TheThing,项目名称:NetworkLibrary,代码行数:22,代码来源:Connection.cs


注:本文中的IParser.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。