private List <TempMatchInfo> parseSocketResponseDog(string response) { List <TempMatchInfo> infos = new List <TempMatchInfo>(); string temp = response.Substring(response.LastIndexOf("NA=Greyhounds;")); bool bBasketball = false; TempMatchInfo info = new TempMatchInfo(); while (temp.Contains(";")) { string semicolonString = temp.Substring(0, temp.IndexOf(";")); temp = temp.Substring(temp.IndexOf(";") + 1, temp.Length - temp.IndexOf(";") - 1); if (semicolonString == "NA=Greyhounds") { bBasketball = true; } else if (bBasketball) { if (semicolonString.Contains("NA=")) { string naString = semicolonString.Replace("NA=", string.Empty); info.name = naString; } else if (semicolonString.Contains("TU=")) { info.time = semicolonString.Replace("TU=", string.Empty); } else if (semicolonString.Contains("TD=")) { info.td = semicolonString.Replace("TD=", string.Empty); } else if (semicolonString.Contains("TM=")) { info.tm = semicolonString.Replace("TM=", string.Empty); } else if (semicolonString.Contains("TT=")) { info.tt = semicolonString.Replace("TT=", string.Empty); } else if (semicolonString.Contains("TS=")) { info.ts = semicolonString.Replace("TS=", string.Empty); } else if (semicolonString.Contains("ID=")) { string id = semicolonString.Replace("ID=", string.Empty); if (id.Contains("_")) { info.id = id; } } if (info.isComplete()) { info.sport = SPORT.Dog; infos.Add(info); info = new TempMatchInfo(); } } } return(infos); }
private List <TempMatchInfo> parseSocketResponseHorse(string response) { List <TempMatchInfo> infos = new List <TempMatchInfo>(); string temp = response.Substring(response.LastIndexOf("NA=Horse Racing;")); bool bSoccer = false; TempMatchInfo info = new TempMatchInfo(); while (temp.Contains(";")) { string semicolonString = temp.Substring(0, temp.IndexOf(";")); temp = temp.Substring(temp.IndexOf(";") + 1, temp.Length - temp.IndexOf(";") - 1); if (semicolonString == "NA=Horse Racing") { bSoccer = true; } else if (bSoccer) { if (semicolonString.Contains("NA=")) { string naString = semicolonString.Replace("NA=", string.Empty); info.name = naString; } else if (semicolonString.Contains("TU=")) { info.time = semicolonString.Replace("TU=", string.Empty); } else if (semicolonString.Contains("TD=")) { info.td = semicolonString.Replace("TD=", string.Empty); } else if (semicolonString.Contains("TM=")) { info.tm = semicolonString.Replace("TM=", string.Empty); } else if (semicolonString.Contains("TT=")) { info.tt = semicolonString.Replace("TT=", string.Empty); } else if (semicolonString.Contains("TS=")) { info.ts = semicolonString.Replace("TS=", string.Empty); } else if (semicolonString.Contains("ID=")) { string id = semicolonString.Replace("ID=", string.Empty); if (id.Contains("_")) { //info.id = Regex.Replace(id, "_\\d_\\d", string.Empty); info.id = id; } } if (info.isComplete()) { info.sport = SPORT.Horse; infos.Add(info); info = new TempMatchInfo(); } } } return(infos); }