diff --git a/WowPacketParser/Hotfix/HotfixStore.cs b/WowPacketParser/Hotfix/HotfixStore.cs index 6da2633443..8ffe32d5c7 100644 --- a/WowPacketParser/Hotfix/HotfixStore.cs +++ b/WowPacketParser/Hotfix/HotfixStore.cs @@ -41,7 +41,7 @@ public static class HotfixStoreMgr { public static event Action OnRecordReceived; - private static Dictionary _stores = new Dictionary(); + private static readonly Dictionary _stores = new Dictionary(); public static IHotfixStore GetStore(DB2Hash hash) { @@ -81,4 +81,4 @@ public static void LoadStores(Assembly asm) } } } -} \ No newline at end of file +} diff --git a/WowPacketParser/SQL/Builder.cs b/WowPacketParser/SQL/Builder.cs index 8c9ac63447..eea876b224 100644 --- a/WowPacketParser/SQL/Builder.cs +++ b/WowPacketParser/SQL/Builder.cs @@ -97,26 +97,27 @@ public static void DumpSQL(string prefix, string fileName, string header) .Where(y => y.GetCustomAttributes().OfType().Any()) .ToList(); - var i = 0; - foreach (var method in builderMethods) + for (int i = 1; i <= builderMethods.Count; i++) { + var method = builderMethods[i - 1]; var attr = method.GetCustomAttribute(); if (attr.CheckVersionMismatch) { if (!((ClientVersion.Expansion == ClientType.WrathOfTheLichKing && - Settings.TargetedDatabase == TargetedDatabase.WrathOfTheLichKing) - || - (ClientVersion.Expansion == ClientType.Cataclysm && - Settings.TargetedDatabase == TargetedDatabase.Cataclysm) - || - (ClientVersion.Expansion == ClientType.WarlordsOfDraenor && - Settings.TargetedDatabase == TargetedDatabase.WarlordsOfDraenor) - || - (ClientVersion.Expansion == ClientType.Legion && - Settings.TargetedDatabase == TargetedDatabase.Legion))) + Settings.TargetedDatabase == TargetedDatabase.WrathOfTheLichKing) + || + (ClientVersion.Expansion == ClientType.Cataclysm && + Settings.TargetedDatabase == TargetedDatabase.Cataclysm) + || + (ClientVersion.Expansion == ClientType.WarlordsOfDraenor && + Settings.TargetedDatabase == TargetedDatabase.WarlordsOfDraenor) + || + (ClientVersion.Expansion == ClientType.Legion && + Settings.TargetedDatabase == TargetedDatabase.Legion))) { - Trace.WriteLine($"Error: Couldn't generate SQL output of {method.Name} since the targeted database and the sniff version don't match."); + Trace.WriteLine( + $"{i}/{builderMethods.Count} - Error: Couldn't generate SQL output of {method.Name} since the targeted database and the sniff version don't match."); continue; } } @@ -128,14 +129,15 @@ public static void DumpSQL(string prefix, string fileName, string header) if (attr.Gameobjects) parameters.Add(gameObjects); - Trace.WriteLine($"{++i}/{builderMethods.Count} - Write {method.Name}"); + Trace.WriteLine($"{i}/{builderMethods.Count} - Write {method.Name}"); try { store.WriteData(method.Invoke(null, parameters.ToArray()).ToString()); } catch (TargetInvocationException e) { - ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + Trace.WriteLine($"{i}/{builderMethods.Count} - Error: Failed writing {method.Name}"); + Trace.TraceError(e.InnerException?.ToString() ?? e.ToString()); } }