Пример #1
0
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="loadAll">是否全部加载标记</param>
        public static bool Load()
        {
            String sPath = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";

            if (!File.Exists(sPath))
            {
                List <KwItem> items = DataCenter.EMSecurityService.GetKwItems();
                Dictionary <String, KwItem> availableItems = EMSecurityService.GetAvailableItems(items);
                StringBuilder sb = new StringBuilder();
                foreach (String key in availableItems.Keys)
                {
                    kwItems2[availableItems[key].Innercode] = availableItems[key];
                    sb.Append(key + "," + availableItems[key].Name + "," + availableItems[key].Pingyin + "," + availableItems[key].Marketcode + "," + availableItems[key].Type.ToString() + "," + availableItems[key].State.ToString() + "\r\n");
                }
                CFileA.Write(Application.StartupPath + "\\codes.txt", sb.ToString());
                EMSecurityService.KwItems = availableItems;
                CFileA.Write(sPath, JsonConvert.SerializeObject(EMSecurityService.KwItems));
                SecurityService.ImportSecurities(EMSecurityService.KwItems);
                return(false);
            }
            else
            {
                EMSecurityService.KwItems = JsonConvert.DeserializeObject <Dictionary <String, KwItem> >(File.ReadAllText(sPath, Encoding.Default));
                foreach (String key in KwItems.Keys)
                {
                    kwItems2[KwItems[key].Innercode] = KwItems[key];
                }
                SecurityService.ImportSecurities(EMSecurityService.KwItems);
                return(true);
            }
        }
Пример #2
0
        /// <summary>
        /// 启动服务
        /// </summary>
        /// <param name="fileName">文件名</param>
        public static void StartService()
        {
            ReadPlots();
            m_userCookieService   = new UserCookieService();
            m_exportService       = new ExportService();
            m_userSecurityService = new UserSecurityService();
            m_eMSecurityService   = new EMSecurityService();
            bool loadAll = EMSecurityService.Load();

            //BlockService.Load(loadAll);
            CFTService.Start();
            SecurityService.Start();
        }