Ejemplo n.º 1
0
        private void __GetBlocks(XmlNode trackNode, Track track)
        {
            if (trackNode == null)
            {
                return;
            }

            foreach (XmlNode BlockNode in trackNode.SelectNodes("block"))
            {
                var BlockName     = BlockNode.Attributes["name"];
                var DirectionAttr = BlockNode.Attributes["direction"];

                if (BlockName == null)
                {
                    continue;
                }

                eBlockDirection Direction = eBlockDirection.Both;
                if (DirectionAttr != null && !Enum.TryParse(DirectionAttr.InnerText, true, out Direction))
                {
                    continue;
                }

                new Block(BlockName.InnerText, Direction, track);
            }
        }
Ejemplo n.º 2
0
        public Block(string name, eBlockDirection direction, Track track)
        {
            m_Name      = name;
            m_Direction = direction;
            m_Track     = track;

            if (track != null)
            {
                track.Blocks.Add(this);
            }

            if (track != null && track.Station != null && track.Station.ESTW != null && track.Station.ESTW.Area != null)
            {
                if (!track.Station.ESTW.Blocks.ContainsKey(m_Name))
                {
                    track.Station.ESTW.Blocks[m_Name] = new List <Block>();
                }

                track.Station.ESTW.Blocks[m_Name].Add(this);
            }
        }