public override void Matched(MatchCollection matches, uint posterID, uint victimID, DateTime now, MySqlConnection con, SingleNewscanRequestHandler handler, ParserResponse resp) { Dictionary<uint, String> uidToIgmNameCache = new Dictionary<uint, string>(); foreach(Match outerMatch in matches) { String absender; if(!uidToIgmNameCache.TryGetValue(victimID, out absender)) { MySqlCommand igmNameQry = new MySqlCommand("SELECT igmname FROM " + DBPrefix + "igm_data WHERE id=?igmid", con); igmNameQry.Parameters.Add("?igmid", MySqlDbType.UInt32).Value = victimID; Object obj = igmNameQry.ExecuteScalar(); absender = (String)obj; uidToIgmNameCache.Add(victimID, absender); } Transport t = new Transport( uint.Parse(outerMatch.Groups[1].Value), uint.Parse(outerMatch.Groups[2].Value), uint.Parse(outerMatch.Groups[3].Value), outerMatch.Groups[5].Value, absender, IWDBUtils.parsePreciseIWTime(outerMatch.Groups[4].Value) ); MatchCollection c = Regex.Matches(outerMatch.Groups[7].Value, @"\s(" + RessourcenName + @")\s+(" + Number + ")"); foreach(Match m in c) { t.SetRess(m.Groups[1].Value, int.Parse(m.Groups[2].Value, System.Globalization.NumberStyles.Any)); } t.ToDB(con, DBPrefix, handler.BesData, resp, "Übergabebericht"); } }
public override void Matched(System.Text.RegularExpressions.MatchCollection matches, uint posterID, uint victimID, DateTime now, MySql.Data.MySqlClient.MySqlConnection con, SingleNewscanRequestHandler handler, ParserResponse resp) { foreach (Match outerMatch in matches) { Transport t = new Transport( uint.Parse(outerMatch.Groups[1].Value), uint.Parse(outerMatch.Groups[2].Value), uint.Parse(outerMatch.Groups[3].Value), outerMatch.Groups[6].Value, outerMatch.Groups[5].Value, IWDBUtils.parsePreciseIWTime(outerMatch.Groups[4].Value) ); MatchCollection c = Regex.Matches(outerMatch.Groups[7].Value, @"\s(" + RessourcenName + @")\s+(" + Number + ")"); foreach (Match m in c) { t.SetRess(m.Groups[1].Value, int.Parse(m.Groups[2].Value, System.Globalization.NumberStyles.Any)); } t.ToDB(con, DBPrefix, handler.BesData, resp, "Transportbericht"); } }