コード例 #1
0
 /// <summary>
 /// Loads from an string containing all tags representing
 /// </summary>
 /// <param name="strXML"></param>
 /// <returns></returns>
 private bool fromXML(string strXML)
 {
     try
     {
         cBaseXML inXML = new cBaseXML(strXML);
         // get task info
         this.task_id = inXML.NodeData(tags[(int)TagNames.TaskID]);
         // get shape
         this.shape = (TaskShapes)GetShape(inXML.NodeData(tags[(int)TagNames.Shape]));
         // get back color
         this.back_color = GetColor(inXML.NodeData(tags[(int)TagNames.BackColor]));
         // get border color
         this.border_color = GetColor(inXML.NodeData(tags[(int)TagNames.BorderColor]));
         // get target location
         this.target_location = GetPoint(inXML.NodeData(tags[(int)TagNames.TargetLocation]));
         // get cursor location
         this.cursor_location = GetPoint(inXML.NodeData(tags[(int)TagNames.CursorLocation]));
         // get cursor location
         this.target_size = GetSize(inXML.NodeData(tags[(int)TagNames.TargetSize]));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
 /// <summary>
 /// sets the content of the object from a cBaseXL object
 /// if object contains more than one trace data first one will be used for instantitaion
 /// </summary>
 /// <param name="traceXML">cbaseXML object contaning one trace point data</param>
 private void SetFromXML(cBaseXML traceXML)
 {
     try
     {
         SetFromInnerText(traceXML.NodeData(TracePoint.thetag));
     }
     catch { }
 }
コード例 #3
0
        /// <summary>
        /// Creates a cBaseXML object based on the instance data
        /// </summary>
        /// <returns></returns>
        private cBaseXML toXML()
        {
            cBaseXML meXML = new cBaseXML();

            meXML.Add(tags[(int)TagNames.TaskID], this.task_id, true);
            meXML.Add(tags[(int)TagNames.Shape], this.shape.ToString(), true);
            meXML.Add(tags[(int)TagNames.BackColor],
                      this.back_color.R.ToString() + "," + this.back_color.G.ToString() + "," + this.back_color.B.ToString(), true);
            meXML.Add(tags[(int)TagNames.BorderColor],
                      this.border_color.R.ToString() + "," + this.border_color.G.ToString() + "," + this.border_color.B.ToString(), true);
            meXML.Add(tags[(int)TagNames.TargetLocation],
                      this.target_location.X.ToString() + "," + this.target_location.Y.ToString(), true);
            meXML.Add(tags[(int)TagNames.CursorLocation],
                      this.cursor_location.X.ToString() + "," + this.cursor_location.Y.ToString(), true);
            meXML.Add(tags[(int)TagNames.TargetSize],
                      this.target_size.Width.ToString() + "," + this.target_size.Height.ToString(), true);
            return(meXML);
        }
コード例 #4
0
 /// <summary>
 /// loads a file from the given full file path
 /// </summary>
 /// <param name="FilePath">Full file path of the XML file</param>
 /// <returns>TRUE if load is successful, FALSE otherwise</returns>
 public bool LoadFromFile(string FilePath)
 {
     try
     {
         cBaseXML newTest = new cBaseXML();
         if (newTest.LoadFromFile(FilePath))
         {
             string innerXML = newTest.ToString();
             this.XML = innerXML;
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return(false);
     }
 }
コード例 #5
0
 /// <summary>
 /// Loads from an string containing all tags representing
 /// </summary>
 /// <param name="strXML"></param>
 /// <returns></returns>
 private bool fromXML(string strXML)
 {
     try
     {
         cBaseXML inXML = new cBaseXML(strXML);
         // get the user info
         this.user_id = inXML.NodeData(tags[(int)TagNames.User]);
         // get task id
         this.task_id = inXML.NodeData(tags[(int)TagNames.TaskID]);
         // get input device
         this.input_device = GetDevice(inXML.NodeData(tags[(int)TagNames.InputDevice]));
         // get screen resolution
         this.test_screen = GetScreenSize(inXML.NodeData(tags[(int)TagNames.TestScreenResolution]));
         // get if test completed
         this.test_completed = Convert.ToBoolean(inXML.NodeData(tags[(int)TagNames.TestCompleted]));
         // finally get all the mouse trace points
         cBaseXML   trcXML = new cBaseXML(inXML.NodeData(tags[(int)TagNames.MouseTrail]));
         string     trc    = "notyet";
         TracePoint tp;
         do
         {
             // update trace
             trc = trcXML.NodeData(TracePoint.TheTag);
             if (trc != "")
             {
                 tp = new TracePoint(trc);
                 this.AddTracePoint(tp);
                 trcXML.Remove(TracePoint.TheTag);
             }
         } while (trc != "");
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #6
0
        /// <summary>
        /// Creates a cBaseXML object based on the instance data
        /// </summary>
        /// <returns></returns>
        private cBaseXML toXML()
        {
            cBaseXML meXML = new cBaseXML();

            meXML.Add(tags[(int)TagNames.User], this.user_id, true);
            meXML.Add(tags[(int)TagNames.TaskID], this.task_id, true);
            meXML.Add(tags[(int)TagNames.InputDevice], this.input_device.ToString(), true);
            meXML.Add(tags[(int)TagNames.TestScreenResolution],
                      this.test_screen.Width.ToString() + "," + this.test_screen.Height.ToString(), true);
            meXML.Add(tags[(int)TagNames.MouseTrail], ",", true); // add blank and replace this with points later
            cBaseXML trailXML = null;

            if (points_collected != null && points_collected.Count > 0)
            {
                trailXML = new cBaseXML();
                foreach (TracePoint trailpoint in points_collected)
                {
                    trailXML.Add(TracePoint.TheTag, trailpoint.ToString(), false);
                }
                meXML.Add(tags[(int)TagNames.MouseTrail], trailXML.ToString(), true);
            }
            meXML.Add(tags[(int)TagNames.TestCompleted], this.TestCompleted.ToString(), true);
            return(meXML);
        }
コード例 #7
0
 public TracePoint(cBaseXML traceXML)
 {
     SetFromXML(traceXML);
 }