Пример #1
0
        public void TrackArrival(MissionArrival arrival)
        {
            LoadMission(FolderPath);

            // find landings with indentical parts
            List <MissionLanding> overlappingLandings = new List <MissionLanding>();

            foreach (MissionLanding storedLanding in _landings)
            {
                foreach (MissionPart storedMissionPart in storedLanding.Parts)
                {
                    foreach (MissionPart missionPart in arrival.Parts)
                    {
                        if (storedMissionPart.flightID == missionPart.flightID)
                        {
                            overlappingLandings.Add(storedLanding);
                        }
                    }
                }
            }
            // delete landings with indentical parts
            foreach (MissionLanding overlappingLanding in overlappingLandings)
            {
                _landings.Remove(overlappingLanding);
            }

            _arrival = arrival;
            SaveMission();
        }
Пример #2
0
        public void TrackLaunch(MissionLaunch launch)
        {
            LoadMission(FolderPath);

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


            _launch = launch;
            SaveMission();
        }
Пример #3
0
        public void TrackLanding(MissionLanding landing)
        {
            LoadMission(FolderPath);

            // find landings with indentical parts
            List <MissionLanding> overlappingLandings = new List <MissionLanding>();

            foreach (MissionLanding storedLanding in _landings)
            {
                foreach (MissionPart storedMissionPart in storedLanding.Parts)
                {
                    foreach (MissionPart missionPart in landing.Parts)
                    {
                        if (storedMissionPart.flightID == missionPart.flightID)
                        {
                            overlappingLandings.Add(storedLanding);
                        }
                    }
                }
            }
            // delete landings with indentical parts
            foreach (MissionLanding overlappingLanding in overlappingLandings)
            {
                _landings.Remove(overlappingLanding);
            }

            // find arrival with identical parts
            bool overlappingArrival = false;

            if (_arrival != null)
            {
                foreach (MissionPart arrivalMissionPart in _arrival.Parts)
                {
                    foreach (MissionPart missionPart in landing.Parts)
                    {
                        if (arrivalMissionPart.flightID == missionPart.flightID)
                        {
                            overlappingArrival = true;
                        }
                    }
                }
            }
            // delete arrival with indentical parts
            if (overlappingArrival)
            {
                _arrival = null;
            }


            _landings.Add(landing);
            SaveMission();
        }
Пример #4
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)));
                }
            }
        }