Esempio n. 1
0
        public static CodeInfo GetCodeInfo(CodeIdParser parser, DataLoader_Variety dataLoader_Variety)
        {
            string varietyId = parser.VarietyId;
            string suffix    = parser.Suffix;
            int    year      = parser.Year;
            int    month     = parser.Month;

            VarietyInfo varietyInfo = dataLoader_Variety.GetVariety(varietyId);

            if (varietyInfo == null)
            {
                return(null);
            }
            string   codeId      = parser.CodeId;
            string   codeName    = varietyInfo.Name + suffix;
            int      start       = parser.StartDay;
            int      end         = parser.EndDay;
            string   exchange    = varietyInfo.Exchange;
            string   varietyName = varietyInfo.Name;
            CodeInfo code        = new CodeInfo(parser.CodeId, codeName, varietyId, varietyName, start, end, exchange, "");

            code.ServerCode = GetServerCode(parser.CodeId, exchange);
            code.ShortCode  = parser.ShortCode;
            return(code);
        }
Esempio n. 2
0
        public DataLoader_Variety(string pluginPath)
        {
            PathUtils pathUtils = new PathUtils(pluginPath);
            string    path      = pathUtils.CatelogPath;

            string[] lines = File.ReadAllLines(path);

            this.allVarietyInfos    = new List <VarietyInfo>(lines.Length);
            this.dic_Id_VarietyInfo = new Dictionary <string, VarietyInfo>(lines.Length);
            for (int i = 0; i < lines.Length; i++)
            {
                VarietyInfo variety = GetVarietyInfo(lines[i]);
                if (variety == null)
                {
                    continue;
                }
                this.allVarietyInfos.Add(variety);
                this.dic_Id_VarietyInfo.Add(variety.Code, variety);
                if (this.dic_Exchange_Varieties.ContainsKey(variety.Exchange))
                {
                    this.dic_Exchange_Varieties[variety.Exchange].Add(variety);
                }
                else
                {
                    List <VarietyInfo> varieties = new List <VarietyInfo>();
                    varieties.Add(variety);
                    this.dic_Exchange_Varieties.Add(variety.Exchange, varieties);
                }
            }
        }
        private String GetCodeMarket(String code)
        {
            string      variety = GetVariety(code);
            VarietyInfo v       = dataLoader_Variety.GetVariety(variety);

            if (v == null)
            {
                return(null);
            }
            return(v.Exchange);
        }
Esempio n. 4
0
        private VarietyInfo GetVarietyInfo(string content)
        {
            string[] arr = content.Split(',');
            if (arr.Length < 3)
            {
                return(null);
            }
            VarietyInfo variety = new VarietyInfo();

            variety.Code     = arr[0].ToUpper();
            variety.Name     = arr[1];
            variety.Exchange = arr[2].ToUpper();
            return(variety);
        }