예제 #1
0
 public TobiiRecord(TobiiRecord TR)
 {
     time_ms  = TR.time_ms;
     zones    = TR.zones;
     fzones   = TR.fzones;
     CurFZone = TR.CurFZone;
 }
예제 #2
0
        public void TobiiCSVRead(string filename, List <TobiiRecord> tobiiList)
        {
            char separator = '\n';
            char delimiter = '\t';

            int  N_timestampCol = 0, N_firstZoneCol = 0;
            int  ZoneColCount = 53;
            long i = 0;

            using (StreamReader rd = new StreamReader(new FileStream(filename, FileMode.Open)))
            {
                string[] first_string_arr = { "" };
                first_string_arr    = rd.ReadLine().Split(delimiter);
                ZoneColCount        = ZoneColCountCalc(first_string_arr);
                AOIHitsColumnsCount = ZoneColCount;
                N_timestampCol      = SearchColFirst(first_string_arr, "Recording timestamp");
                N_firstZoneCol      = SearchColFirst(first_string_arr, "AOI hit [");

                bool EndOfFile = false;
                while (!EndOfFile)
                {
                    string[] str_arr = { "" };
                    string   big_str = "";
                    EndOfFile = ReadPartOfFile(rd, out big_str);

                    str_arr = big_str.Split(separator);
                    foreach (string s in str_arr)
                    {
                        string[] tmp = { "" };
                        i++;
                        tmp = s.Split(delimiter);
                        if (tmp.Count() < 3)
                        {
                            continue;
                        }
                        TobiiRecord TR = new TobiiRecord();
                        if (!long.TryParse(tmp[N_timestampCol], out TR.time_ms))
                        {
                            throw new Exception("Не могу преобразовать в timestamp строку  " + tmp[N_timestampCol]);
                        }

                        string[] Hits = new string[tmp.Count()];
                        try
                        {
                            Array.Copy(tmp, N_firstZoneCol, Hits, 0, ZoneColCount);
                        }
                        catch
                        { Console.WriteLine("!!!"); }
                        TR.zones = SearchCol(Hits, "1");
                        tobiiList.Add(TR);
                    }
                }
            }
        }