Exemple #1
0
        public Create_EventType(pCreateType cEvent)
            : base(cEvent.UnitID)
        {
            this.unitBase = cEvent.UnitBase;
            this.owner = cEvent.Owner;
            Parameters = null;
            subplatforms = new List<string>();
            for (int i = 0; i < cEvent.Platforms.Count; i++)
                if (UnitFacts.Data.ContainsKey(cEvent.Platforms[i]))
                {
                    
                    if (SubplatformRecords.RecordDocking(this.UnitID, cEvent.Platforms[i]) == true)
                    { 
                        subplatforms.Add(cEvent.Platforms[i]);
                    }
                }
                else throw new ApplicationException("Cannot add undefined subplatform '" +
                    cEvent.Platforms[i] + "' to unit '" + cEvent.UnitID + "'");

        }
Exemple #2
0
        /// <summary>
        /// Retrieves a create unit command from the scenario 
        /// </summary>
        public override pCreateType pGetCreate()
        {
            string unitID = "Unknown object";
            pCreateType c;
            try
            {
                reader.Read();// pass the CreateEvent tag
                unitID = pGetString();
                string unitKind = pGetString();
                string owner = pGetString();
                c = new pCreateType(unitID, unitKind, owner);
                while ("Subplatform" == reader.Name)
                {
                    c.DockFromList(pGetStringList(commaRegex));
                }

                reader.ReadEndElement();
            }
            catch (System.Exception e)
            {
                throw new ApplicationException("Error reading Create command for " +
                    unitID + ": ", e);
            }

            return c;
        }