/// <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); } }
/// <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); }