Exemplo n.º 1
0
        public void TrackDeparture(MissionDeparture departure)
        {
            LoadMission(FolderPath);

            // delete later tracked mission events
            _landings.Clear();

            _departure = departure;
            SaveMission();
        }
Exemplo n.º 2
0
        private void LoadMission(String FolderPath)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(RmmUtil.GamePath + Path.DirectorySeparatorChar + FolderPath + Path.DirectorySeparatorChar + MISSION_FILE);

            _info      = null;
            _launch    = null;
            _arrival   = null;
            _departure = null;
            _landings.Clear();

            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {
                if (node.Name == typeof(MissionInfo).Name)
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MissionInfo));
                    _info = (MissionInfo)ser.Deserialize(new XmlNodeReader(node));
                }

                if (node.Name == typeof(MissionLaunch).Name)
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MissionLaunch));
                    _launch = (MissionLaunch)ser.Deserialize(new XmlNodeReader(node));
                }

                if (node.Name == typeof(MissionArrival).Name)
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MissionArrival));
                    _arrival = (MissionArrival)ser.Deserialize(new XmlNodeReader(node));
                }

                if (node.Name == typeof(MissionDeparture).Name)
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MissionDeparture));
                    _departure = (MissionDeparture)ser.Deserialize(new XmlNodeReader(node));
                }

                if (node.Name == typeof(MissionLanding).Name)
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MissionLanding));
                    _landings.Add((MissionLanding)ser.Deserialize(new XmlNodeReader(node)));
                }
            }
        }