Пример #1
0
        /// <summary>
        /// 读取主力合约映射文件
        /// </summary>
        /// <param name="strFile">映射文件</param>
        /// <param name="fmgr">期货管理器</param>
        private static void ReadRefIndex(string strFile, FutureManager fmgr)
        {
            FileStream fs = null;

            try
            {
                #region

                fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read);
                StreamReader reader = new StreamReader(fs, Encoding.UTF8);
                while (!reader.EndOfStream)
                {
                    string strline = reader.ReadLine();
                    // = 分割
                    string[] linelist = strline.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
                    if (linelist.Length == 2)
                    {
                        fmgr.AddRefFuture(linelist[0].Trim(), linelist[1].Trim());
                    }
                }
                #endregion
            }
            catch (Exception)
            {
                fmgr.Clear();
            }

            if (fs != null)
            {
                fs.Close();
            }
        }