private void loadComposition(XmlElement e)
        {
            string    comp = e.InnerText;
            ArrayList a    = new ArrayList();

            while (comp.Length != 0)
            {
                char head = comp[0];
                comp = comp.Substring(1);

                if (Char.IsWhiteSpace(head))
                {
                    continue;                           // ignore whitespace
                }
                // otherwise look up a table
                TrainCarContribution car = (TrainCarContribution)cars[head];
                if (car == null)
                {
                    throw new FormatException("The following characters are undefined: " + head);
                }
                //! throw new FormatException("次の文字は定義されていません:"+head);
                a.Add(car);
            }

            compositions.Add(a.Count, a.ToArray(typeof(TrainCarContribution)));
        }
Beispiel #2
0
        private TrainCarContribution getCarType(XmlElement comp, string name)
        {
            XmlElement e = (XmlElement)comp.SelectSingleNode(name);

            if (e == null)
            {
                return(null);
            }

            string idref = e.Attributes["carRef"].Value;

            if (id == null)
            {
                throw new FormatException("carRef܂");
            }

            TrainCarContribution contrib = (TrainCarContribution)Core.plugins.getContribution(idref);

            if (contrib == null)
            {
                throw new FormatException(
                          string.Format("id='{0}'TrainCarRgr[V܂", idref));
            }

            return(contrib);
        }
Beispiel #3
0
        public override TrainCarContribution[] create(int length)
        {
            TrainCarContribution[] r = new TrainCarContribution[length];
            for (int i = 0; i < r.Length; i++)
            {
                r[i] = carBodyType;
            }

            if (carHeadType != null)
            {
                r[0] = carHeadType;
            }

            if (carTailType != null)
            {
                r[r.Length - 1] = carTailType;
            }

            return(r);
        }
        private TrainCarContribution getCarType(XmlElement e)
        {
            string idref = e.Attributes["ref"].Value;

            if (idref == null)
            {
                throw new FormatException("ref attribute is missing");
            }
            //! if(idref==null)	throw new FormatException("ref属性がありません");

            TrainCarContribution contrib = (TrainCarContribution)Core.plugins.getContribution(idref);

            if (contrib == null)
            {
                throw new FormatException(
                          string.Format("id='{0}' is missing TrainCar contribution", idref));
            }
            //! string.Format( "id='{0}'のTrainCarコントリビューションがありません", idref ));

            return(contrib);
        }