Ejemplo n.º 1
0
        private static void testStaticInfo_CashAuctionParams()
        {
            string securityFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Samples/cashauctionparams_20140121.xml");
            string fileContent  = File.ReadAllText(securityFile, Encoding.UTF8);

            CodeTimer.CodeTimer.Initialize();
            QuotV5.StaticInfo.CashAuctionParamsParser parser = new QuotV5.StaticInfo.CashAuctionParamsParser();
            var paras = parser.Parse(fileContent);

            CodeTimer.CodeTimer.Time("ParseCashAuctionParams", 10, () => { var ss = parser.Parse(fileContent); });
        }
Ejemplo n.º 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.CashAuctionParams> 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);
            }
        }