Example #1
0
        public List <TrailOS_ST> GetTrails()
        {
            List <TrailOS_ST> retval = new List <TrailOS_ST>();

            String          targetStr;
            Regex           rex = new Regex("[^,]+");
            MatchCollection mts;

            mReader.ReadLine();
            while ((targetStr = mReader.ReadLine()) != null)
            {
                mts = rex.Matches(targetStr);
                TrailOS_ST stos = new TrailOS_ST();
                stos.equation = mts[1].Value.ToString();
                stos.result   = mts[2].Value.ToString();

                if (int.Parse(mts[3].Value.ToString()) == 1)
                {
                    stos.correctness = true;
                }
                else
                {
                    stos.correctness = false;
                }

                stos.memTarget = mts[4].Value.ToString();
                retval.Add(stos);
            }


            return(retval);
        }
Example #2
0
        private void readFixedFromFile(string path,
                                       ref List <TrailGroupOS> groups, int[] scheme, int begFromLine)
        {
            TabFetcher fet = new TabFetcher(path, "\\t");

            fet.Open();

            for (int k = 0; k < begFromLine; k++)
            {
                fet.GetLineBy();    //skip lines
            }
            groups = new List <TrailGroupOS>();
            //practise
            for (int i = 0; i < scheme.Length; i++)
            {
                TrailGroupOS group = new TrailGroupOS();
                for (int j = 0; j < scheme[i]; j++)
                {
                    List <String> line = fet.GetLineBy();
                    TrailOS_ST    st   = new TrailOS_ST();
                    st.equation = line[1];
                    st.result   = line[2];
                    if (Int32.Parse(line[3]) == 1)
                    {
                        st.correctness = true;
                    }
                    else
                    {
                        st.correctness = false;
                    }
                    st.memTarget = line[4];
                    group.mTrails.Add(st);
                }
                groups.Add(group);
            }
            fet.Close();
        }