Example #1
0
        /// <summary>
        /// Read the record event collection into an XML file
        /// </summary>
        /// <param name="fPath">Path of file to read</param>
        /// <returns>File reading error flag: True = No Error / False = Error</returns>
        public bool Read_EventsCollectionFile(string fPath)
        {
            try
            {
                XmlDocument oXEventsCollection = new XmlDocument();
                oXEventsCollection.Load(fPath);

                Events = new List <CS_RecordEvent>();
                XmlNode xCollection = oXEventsCollection.SelectSingleNode("RecordEventsCollection");

                foreach (XmlNode xEvent in xCollection.ChildNodes)
                {
                    if (xEvent.Name.Equals("RecordEvent"))
                    {
                        CS_RecordEvent oEvent = new CS_RecordEvent();

                        if (oEvent.Read_RecordEventInfoXmlNode(xEvent))
                        {
                            XmlNode xSessionsList = xEvent.SelectSingleNode("Sessions");
                            oEvent.Sessions = new List <CS_RecordSession>();

                            foreach (XmlNode xSession in xSessionsList.ChildNodes)
                            {
                                if (xSession.Name.Equals("RecordSession"))
                                {
                                    CS_RecordSession oSession = new CS_RecordSession();

                                    if (oSession.Read_RecordSessionInfoXmlNode(xSession))
                                    {
                                        oEvent.Sessions.Add(oSession);
                                    }
                                }
                            }

                            XmlNode xActiveSession = xEvent.SelectSingleNode("ActiveSession");
                            oEvent.CurrentSession = oEvent.Get_RecordSession(xActiveSession.InnerText);

                            Events.Add(oEvent);
                        }
                    }
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }