Esempio n. 1
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)));
                }
            }
        }
Esempio n. 2
0
        public static Mission NewMission(string missionId, int type, string name)
        {
            Mission mission = new Mission();

            mission.MissionId  = missionId;
            mission.FolderPath = RmmUtil.CommercialOfferingsPath + "Missions" + Path.DirectorySeparatorChar + missionId;

            Directory.CreateDirectory(RmmUtil.GamePath + mission.FolderPath);


            MissionInfo info = new MissionInfo
            {
                Type     = type,
                Name     = name,
                Campaign = HighLogic.SaveFolder
            };

            mission._info = info;

            mission.SaveMission();

            return(mission);
        }