public TransportViewModel(TransportInfo info, bool isFirst = false) { this.IsFirst = isFirst; this.TransportInfo = info; }
private static TransportInfo GetTransportInfo(string firstRow, string secondRow) { var ti = new TransportInfo(); ti.Origin = TransferPointNameRegex.Match(firstRow).Groups[1].Value; if (String.IsNullOrEmpty(ti.Origin)) { ti.Origin = ThruTransferPointNameRegex.Match(firstRow).Groups[1].Value; ti.IsPassThru = true; } if (TransferPointTypeRegex.Match(firstRow).Groups[1].Value == "目的地") { // 目的地 return ti; } ti.LineColor = GetColorFromHexString(LineColorRegex.Match(secondRow).Groups[1].Value); ti.LineName = LineNameRegex.Match(secondRow).Groups[1].Value; ti.DepartureTime = DepartureTimeRegex.Match(secondRow).Groups[1].Value; ti.ArrivalTime = ArrivalTimeRegex.Match(secondRow).Groups[1].Value; ti.Fare = FareRegex.Match(secondRow).Groups[1].Value; var details = DetailRegex.Match(secondRow); ti.Detail = Tags.Replace(details.Groups[1].Value + details.Groups[2].Value, ""); return ti; }