Пример #1
0
 public StopTime Add(Weekday weekDay, int hour, int minute, string bus)
 {
     if (!mBuses.Contains(bus))
       {
     mBuses.Add(bus);
       }
       return mTimetables[weekDay.Ordinal].Add(hour, minute, bus);
 }
Пример #2
0
        private HtmlNode FindTimetableRecursive(HtmlNode node, TextWriter outText)
        {
            if (HtmlNodeType.Element.Equals(node.NodeType))
              {
            switch (node.Name)
            {
              case "table":
            if (mTitleFound)
            {
              foreach (HtmlAttribute attribute in node.Attributes.AttributesWithName("class"))
              {
                if (CLASS_TIMETABLE.Equals(attribute.Value))
                {
                  outText.WriteLine("Found timetable!");
                  return node;
                }
              }
            }
            break;

              case "td":
            foreach (HtmlAttribute attribute in node.Attributes.AttributesWithName("class"))
            {
              if (CLASS_TITLE.Equals(attribute.Value))
              {
                switch (node.InnerText)
                {
                  case TITLE_WEEKDAYS:
                  case TITLE_SATURDAY:
                  case TITLE_SUNDAY:
                    outText.WriteLine("Found " + node.InnerText + "!");
                    mWeekday = GetWeekdayEnum(node.InnerText);
                    mTitleFound = true;
                    break;
                }
              }
            }
            break;

              default:
            break;
            }
              }

              foreach (HtmlNode subnode in node.ChildNodes)
              {
            HtmlNode tableNode = FindTimetableRecursive(subnode, outText);
            if (tableNode != null)
            {
              return tableNode;
            }
              }

              node.RemoveAllChildren();
              return null;
        }