示例#1
0
        private static void testStaticInfo_NegotiationParamsParser()
        {
            string securityFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Samples/negotiationparams_20140121.xml");
            string fileContent  = File.ReadAllText(securityFile, Encoding.UTF8);

            CodeTimer.CodeTimer.Initialize();
            QuotV5.StaticInfo.NegotiationParamsParser parser = new QuotV5.StaticInfo.NegotiationParamsParser();
            var securities = parser.Parse(fileContent);

            CodeTimer.CodeTimer.Time("NegotiationParamsParser", 10, () => { var ss = parser.Parse(fileContent); });
        }
示例#2
0
        protected override void OnScanData()
        {
            string filePath = GetFileFullPath();

            if (File.Exists(filePath))
            {
                try
                {
                    if (!FileModifyTimeChanged(filePath))
                    {
                        this.logHelper.LogDebugMsg("文件最后修改时间无变化,FilePath={0}", filePath);
                        return;
                    }
                    string fileContent = ReadAllText(filePath, encoding);

                    if (fileContent == this.lastScanFileContent)
                    {
                        return;
                    }

                    List <QuotV5.StaticInfo.NegotiationParams> securityInfos = parser.Parse(fileContent);

                    RaiseStaticInfoReadEvent(securityInfos);

                    this.lastScanFileContent = fileContent;
                }
                catch (Exception ex)
                {
                    this.logHelper.LogErrMsg(ex, "读取并解析静态信息文件异常,FilePath={0}", filePath);
                }
            }
            else
            {
                this.logHelper.LogInfoMsg("文件不存在:{0}", filePath);
            }
        }