コード例 #1
0
ファイル: ParamTrainImpl.cs プロジェクト: wcp16/FreeTrainSDL
        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)PluginManager.GetContribution(idref);

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

            return(contrib);
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
ファイル: ParamTrainImpl.cs プロジェクト: wcp16/FreeTrainSDL
        /// <summary>
        ///
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        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);
        }
コード例 #4
0
        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)PluginManager.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);
        }