예제 #1
0
        private void ProcessTextLine(string[] lines, char[] charSeparators, int i)
        {
            string    line = lines[i];
            StockInfo s    = new StockInfo();

            string[] token = line.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
            token[0] = token[0].Trim();
            token[1] = token[1].Trim();
            token[2] = token[2].Trim();
            if (!Regex.IsMatch(token[0], @"-F$") && !Regex.IsMatch(token[0], @"\d\d\d"))  //!Regex.IsMatch(token[0], @"\d\d\d") &&
            {
                //Array.BinarySearch(ignoreArr, token[0]) < 0
                //if ( !ignoreArr.Contains(token[0]) && !Regex.IsMatch(token[0], @"IF$"))


                s.StockName     = token[0];
                s.ChangePercent = decimal.TryParse(token[1], out decimal tmpresult) ? tmpresult : 0;
                s.ClosedPrice   = decimal.TryParse(token[2], out tmpresult) ? tmpresult : 0;

                if (!Regex.IsMatch(token[0], @"-W"))
                {
                    stockDataList.Add(s);
                }

                //if (token[0] == "ALL-W1")
                //    Console.WriteLine("Find Advance: " + token[0]);

                //remove search by binarySearch coz array is not sorted
                //int inList100 = Array.BinarySearch(set100Arr, token[0]);
                //int inList50 = Array.BinarySearch(set50Arr, token[0]);

                if (set100Arr.Contains(token[0]))
                {
                    stockDataListS100.Add(s);
                }
                else if (set50Arr.Contains(token[0]))
                {
                    stockDataListS50.Add(s);
                }
                else if (Regex.IsMatch(token[0], @"-W"))
                {
                    /*StockInfo ss = new StockInfo();
                     * ss.StockName = s.StockName.Substring(0, s.StockName.IndexOf('-'));
                     * ss.ChangePercent =  s.ChangePercent;
                     * ss.ClosedPrice =  s.ClosedPrice;*/
                    stockDataListWar.Add(s);
                    //stockDataListWar.Add(ss);
                }
                else if (Regex.IsMatch(token[0], @"^S50"))
                {
                    stockDataListS50DW.Add(s);
                }
                else if (Regex.IsMatch(token[0], @"\d\d\d"))
                {
                    stockDataListAllDW.Add(s);
                }
                else
                {
                    stockDataListExcludeS100.Add(s);
                }

                if (customArr.Contains(token[0]))
                {
                    stockDataListCustom.Add(s);
                }
            }
        }