public static void DroppedByParser(uint entry, uint typeId, uint subTypeId, List <String> content) { WriteSQL(typeId, entry, String.Format("-- Parsing {0} loot for entry {1}", Def.GetStreamName(typeId, subTypeId), entry)); WriteSQL(typeId, entry, String.Format("DELETE FROM `{0}` WHERE item = {1};", Def.GetDBName(typeId, subTypeId), entry)); WowheadSerializer serializer = new WowheadSerializer(content, typeId, subTypeId); foreach (Dictionary <String, Object> objectInto in serializer.Objects) { try { WowheadObject wowheadObject = new WowheadObject(objectInto); UInt32 lootId = wowheadObject.GetId(); String name = wowheadObject.GetName(); Int32 maxcount = 1; // NYI Int32 mincount = 1; // NYI Double pct = (wowheadObject.GetCount() / (Double)wowheadObject.GetOutOf()) * 100.0f; pct = Math.Round(pct, 3); String stringPct = pct.ToString().Replace(",", "."); // needs to be changed otherwise SQL errors String str = String.Format("INSERT INTO `{0}` VALUES ( '{1}', '{2}', '{3}', '{4}', '{5}', '{6}' , '{7}'); -- {8}", Def.GetDBName(typeId, subTypeId), lootId, entry, stringPct, 1, 0, mincount, maxcount, name); WriteSQL(typeId, entry, str); } catch (Exception e) { Console.WriteLine(e.Message); } } WriteSQL(typeId, entry, String.Format("-- Parsed {0} loot for entry {1}", Def.GetStreamName(typeId, subTypeId), entry)); WriteSQL(typeId, entry, ""); Console.WriteLine("{0}% - Parsed {1} data for entry {2}", Math.Round(++datad / (Double)commandList.Count * 100, 2), Def.GetStreamName(typeId, subTypeId), entry); }
public static void DroppedByParser(uint entry, uint typeId, uint subTypeId, List<String> content) { StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendLine(String.Format("-- Parsing {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry)); strBuilder.AppendLine(String.Format("DELETE FROM `{0}` WHERE item = {1};", Defines.GetDBName(typeId, subTypeId), entry)); WowheadSerializer serializer = new WowheadSerializer(content, typeId, subTypeId); foreach (Dictionary<String, Object> objectInto in serializer.Objects) { try { WowheadObject wowheadObject = new WowheadObject(objectInto); UInt32 lootId = wowheadObject.GetId(); String name = wowheadObject.GetName(); Int32 maxcount = 1; // NYI Int32 mincount = 1; // NYI Double pct = (wowheadObject.GetCount() / (Double)wowheadObject.GetOutOf()) * 100.0f; pct = Math.Round(pct, 3); String stringPct = pct.ToString().Replace(",", "."); // needs to be changed otherwise SQL errors String str = String.Format("INSERT INTO `{0}` VALUES ( '{1}', '{2}', '{3}', '{4}', '{5}', '{6}' , '{7}'); -- {8}", Defines.GetDBName(typeId, subTypeId), lootId, entry, stringPct, 1, 0, mincount, maxcount, name); strBuilder.AppendLine(str); } catch (Exception e) { Console.WriteLine(e.Message); } } strBuilder.AppendLine(String.Format("-- Parsed {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry)); strBuilder.AppendLine(""); WriteSQL(typeId, entry, strBuilder.ToString()); Console.WriteLine("{0}% - Parsed {1} data for entry {2}", Math.Round(++dataDone / (Double)commandList.Count * 100, 2), Defines.GetStreamName(typeId, subTypeId), entry); }