// Testing purposes  only
        public static void run()
        {
            if (File.Exists("C:\\EVS\\experiments\\Exp1\\Sess1\\Tr1\\displayParser.log"))
            {
                File.Delete("C:\\EVS\\experiments\\Exp1\\Sess1\\Tr1\\displayParser.log");
            }
            TextWriter log = null;

            try
            {
                log = new StreamWriter("C:\\EVS\\experiments\\Exp1\\Sess1\\Tr1\\displayParser.log");


                DisplayFileParser parser = new DisplayFileParser("C:\\EVS\\experiments\\Exp1\\Sess1\\Tr1\\Exp1_Sess1_Tr5_disp.xml");

                Console.WriteLine(" validating file");
                if (parser.validate())
                {
                    Hashtable data = parser.retrieveGlobalDisplayData();
                    if (data == null)
                    {
                        log.WriteLine(" display data null");
                        return;
                    }
                    System.Collections.IDictionaryEnumerator itr = data.GetEnumerator();
                    while (itr.MoveNext())
                    {
                        Object value = itr.Value;
                        if (value is List <ObjectData> )
                        {
                            List <ObjectData> list = (List <ObjectData>)value;
                            foreach (ObjectData thisData in list)
                            {
                                log.WriteLine(thisData.objName + " : " + thisData.objFilePath + " : " + thisData.isTargetObject);
                            }
                        }
                        else
                        {
                            log.WriteLine(itr.Key.ToString() + " : " + itr.Value.ToString());
                        }
                    }
                }
                else
                {
                    log.WriteLine("not valid!!");
                }
            }
            finally
            {
                log.Flush();
                log.Close();
            }
        }
Beispiel #2
0
        //test  routine
        private static void testXmlParser(string displayFileName)
        {
            DisplayFileParser parser = new DisplayFileParser(displayFileName);

            if (parser.validate())
            {
                Console.WriteLine("Success");
                Hashtable data = parser.getDisplayData();
                if (data == null)
                {
                    Console.WriteLine(" No Data found ");
                    return;
                }

                System.Collections.IDictionaryEnumerator itr = data.GetEnumerator();
                while (itr.MoveNext())
                {
                    Console.WriteLine(itr.Entry.Key + "  : " + itr.Entry.Value);
                }
            }
        }
Beispiel #3
0
        private static void populateDisplayFormData()
        {
            try
            {
                parser = new DisplayFileParser(displayFileName);

                if (parser.validate())
                {
                    Hashtable displayData = parser.retrieveGlobalDisplayData();
                    if (displayData == null)
                    {
                        log.WriteLine(" display data null");
                        return;
                    }
                    if (displayData.ContainsKey("GridDisplay"))
                    {
                        formSetting.GridDisplay = Convert.ToInt32(displayData["GridDisplay"]);
                    }
                    if (displayData.ContainsKey("X"))
                    {
                        formSetting.DisplayX = Convert.ToInt32(displayData["X"]);
                    }

                    if (displayData.ContainsKey("Y"))
                    {
                        formSetting.DisplayY = Convert.ToInt32(displayData["Y"]);
                    }
                    if (displayData.ContainsKey("BGA"))
                    {
                        formSetting.BGA = Convert.ToInt32(displayData["BGA"]);
                    }
                    if (displayData.ContainsKey("BGR"))
                    {
                        formSetting.BGR = Convert.ToInt32(displayData["BGR"]);
                    }
                    if (displayData.ContainsKey("BGG"))
                    {
                        formSetting.BGG = Convert.ToInt32(displayData["BGG"]);
                    }
                    if (displayData.ContainsKey("BGB"))
                    {
                        formSetting.BGB = Convert.ToInt32(displayData["BGB"]);
                    }
                    if (displayData.ContainsKey("FGA"))
                    {
                        formSetting.FGA = Convert.ToInt32(displayData["FGA"]);
                    }
                    if (displayData.ContainsKey("FGR"))
                    {
                        formSetting.FGR = Convert.ToInt32(displayData["FGR"]);
                    }
                    if (displayData.ContainsKey("FGG"))
                    {
                        formSetting.FGG = Convert.ToInt32(displayData["FGG"]);
                    }
                    if (displayData.ContainsKey("FGB"))
                    {
                        formSetting.FGB = Convert.ToInt32(displayData["FGB"]);
                    }

                    objects.Add("gaze", "gaze.bmp");

                    System.Collections.IDictionaryEnumerator itr = displayData.GetEnumerator();
                    while (itr.MoveNext())
                    {
                        Object value = itr.Value;
                        if (value is List <ObjectData> )
                        {
                            List <ObjectData> list = (List <ObjectData>)value;
                            foreach (ObjectData thisData in list)
                            {
                                objects.Add(thisData.objName, thisData.objFilePath);
                                if (thisData.isTargetObject == 1)
                                {
                                    formSetting.addTargetObject(thisData.objName);
                                }

                                //     log.WriteLine(thisData.objName + " : " + thisData.objFilePath + " : " + thisData.isTargetObject);
                            }
                        }
                    }
                    enQueueTimeStampData();
                }
            }
            catch (Exception e)
            {
                // do nothing
                throw;
            }
            finally
            {
                parser.close();
            }
        }