Exemplo n.º 1
0
        public MyData[] GetTxTArr()
        {
            var    MD   = new List <MyData>();
            string line = "";

            using (StreamReader sr = new StreamReader(path))
            {
                line = sr.ReadLine();
                while (line != null)
                {
                    if (line != "")
                    {
                        MyData element     = new MyData();
                        int    i           = 0;
                        string timespan    = "";
                        string index       = "";
                        string numOfParams = "";
                        string parms       = "";
                        if (line != "")
                        {
                            while (line[i] != ',')
                            {
                                timespan = timespan + line[i];
                                i++;
                            }
                            element.SetTimeSpan(timespan);
                            i++;
                            while (line[i] != ',')
                            {
                                index = index + line[i];
                                i++;
                            }
                            element.SetIndex(Convert.ToInt32(index));
                            i++;
                            while (line[i] != ',')
                            {
                                numOfParams = numOfParams + line[i];
                                i++;
                            }
                            i++;
                            int number = Convert.ToInt32(numOfParams);
                            element.SetNumOfParams(number);
                            List <double> ls = new List <double>();
                            for (int j = 0; j < number; j++)
                            {
                                while (line[i] != ',')
                                {
                                    parms = parms + line[i];
                                    i++;
                                    if (i == line.Length)
                                    {
                                        break;
                                    }
                                }
                                ls.Add(Convert.ToDouble(parms));
                                i++;
                                parms = "";
                            }
                            element.SetParameters(ls);
                        }
                        MD.Add(element);
                    }
                    line = sr.ReadLine();
                }
            }
            return(MD.ToArray());
        }
Exemplo n.º 2
0
 public void AddSingleData(MyData newData)
 {
     PD.AddSingleData(newData);
 }
Exemplo n.º 3
0
 private void TransferToDate(MyData newData)
 {
     newData.SetDate(DateTime.ParseExact(newData.GetTimeSpan(), pattern, null));
 }