Ejemplo n.º 1
0
        public static bool LoadGlobalSetting()
        {
            PlateInfo[] plateInfos = LoadConfigSetting(GlobalSetting.ConfigFilePath);
            if (plateInfos == null)
            {
                return(false);
            }

            if (LoadingGlobalSetting != null)
            {
                LoadingGlobalSetting(null, EventArgs.Empty);
            }

            s_SecurityDictionary.Clear();
            s_PriceDictionary.Clear();
            GlobalStockManager.Clear();

            s_PlateInfos = plateInfos;

            for (int iIndex = 0; iIndex < s_PlateInfos.Length; iIndex++)
            {
                PlateInfo plateInfo = s_PlateInfos[iIndex];

                for (int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++)
                {
                    VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2];

                    StockManager stockManager = new StockManager();
                    stockManager.StockPlate   = plateInfo.Name;
                    stockManager.StockVariety = varietyInfo.Name;

                    for (int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++)
                    {
                        FileInfo FileInfo = varietyInfo.FileInfos[iIndex3];

                        StockInfo stockInfo = new StockInfo();
                        if (StockInfo.LoadFileFormatForMetaStock(FileInfo.StockName, FileInfo.StockSymbol, FileInfo.FilePath, ref stockInfo) == true)
                        {
                            stockManager.AddStockInfo(stockInfo);
                        }
                    }

                    GlobalStockManager.AddStockManager(stockManager);
                }
            }

            s_IsLoadGlobalSetting = true;

            if (LoadedGlobalSetting != null)
            {
                LoadedGlobalSetting(null, EventArgs.Empty);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static StockManager GetStockManagerByPlateAndVariety(string strPlate, string strVariety)
        {
            Dictionary <string, StockManager> outStockManagerByVariety = null;

            if (m_StockManagerVarietyByPlate.TryGetValue(strPlate, out outStockManagerByVariety) == true)
            {
                StockManager outStockManager = null;
                if (outStockManagerByVariety.TryGetValue(strVariety, out outStockManager) == true)
                {
                    return(outStockManager);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加股票
        /// </summary>
        /// <param name="stockManager"></param>
        public static void AddStockManager(StockManager stockManager)
        {
            Dictionary <string, StockManager> outStockManagerByVariety = null;

            if (m_StockManagerVarietyByPlate.TryGetValue(stockManager.StockPlate, out outStockManagerByVariety) == false)
            {
                outStockManagerByVariety = new Dictionary <string, StockManager>();

                m_StockManagerVarietyByPlate.Add(stockManager.StockPlate, outStockManagerByVariety);
            }

            outStockManagerByVariety.Add(stockManager.StockVariety, stockManager);

            m_StockManagerHashSet.Add(stockManager);

            m_PlateArray.Add(stockManager.StockPlate);

            m_StockVarietyByPlate.Add(stockManager.StockPlate, stockManager.StockVariety);
        }
Ejemplo n.º 4
0
        public static bool LoadGlobalSetting()
        {
            PlateInfo[] plateInfos = LoadConfigSetting( GlobalSetting.ConfigFilePath );
            if ( plateInfos == null )
                return false;

            if ( LoadingGlobalSetting != null )
                LoadingGlobalSetting( null, EventArgs.Empty );

            s_SecurityDictionary.Clear();
            s_PriceDictionary.Clear();
            GlobalStockManager.Clear();

            s_PlateInfos = plateInfos;

            for ( int iIndex = 0; iIndex < s_PlateInfos.Length; iIndex++ )
            {
                PlateInfo plateInfo = s_PlateInfos[iIndex];

                for ( int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++ )
                {
                    VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2];

                    StockManager stockManager = new StockManager();
                    stockManager.StockPlate = plateInfo.Name;
                    stockManager.StockVariety = varietyInfo.Name;

                    for ( int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++ )
                    {
                        FileInfo FileInfo = varietyInfo.FileInfos[iIndex3];

                        StockInfo stockInfo = new StockInfo();
                        if ( StockInfo.LoadFileFormatForMetaStock( FileInfo.StockName, FileInfo.StockSymbol, FileInfo.FilePath, ref  stockInfo ) == true )
                            stockManager.AddStockInfo( stockInfo );
                    }

                    GlobalStockManager.AddStockManager( stockManager );
                }
            }

            s_IsLoadGlobalSetting = true;

            if ( LoadedGlobalSetting != null )
                LoadedGlobalSetting( null, EventArgs.Empty );

            return true;
        }