Skip to content

Commit 925c6f2

Browse files
committed
Fixes #7 - ArgumentException
1 parent e2a5bd4 commit 925c6f2

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

UniversalUnityHooks/AssemblyHelper.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ public void FetchAndLoadAll()
2727
var assembly = AssemblyDefinition.ReadAssembly(Path.GetFullPath(file));
2828
var allAttributes = Program.AttributesHelper.FindInAssembly(assembly);
2929
var filteredAttributes = Program.AttributesHelper.InstantiateAndInvoke(allAttributes, timer);
30-
foreach (var keyValuePair in filteredAttributes)
31-
Program.Attributes.Add(keyValuePair.Key, keyValuePair.Value);
30+
foreach (var kvp in filteredAttributes)
31+
{
32+
if (!Program.Attributes.ContainsKey(kvp.Key))
33+
{
34+
Program.Attributes.Add(kvp.Key, kvp.Value);
35+
}
36+
Program.Attributes[kvp.Key].AddRange(kvp.Value);
37+
}
3238
timer.Stop();
3339
Program.Chalker.WriteSuccess($"Loaded in assembly and {filteredAttributes.Sum(x=>x.Value.Count)} attribute(s) in {timer.GetElapsedMs}ms\r\n");
3440
}
3541
catch (Exception ex)
3642
{
37-
Program.Chalker.WriteError(ex.InnerException.StackTrace);
3843
timer.Stop();
3944
Program.Chalker.WriteError($"Could not load in assembly after {timer.GetElapsedMs}ms.");
4045
Program.Chalker.WriteError($"Message: {ex.Message}");

UniversalUnityHooks/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
[assembly: AssemblyCulture("")]
1212
[assembly: ComVisible(false)]
1313
[assembly: Guid("159d4d35-e53d-46df-9cb5-9f43fdea438f")]
14-
[assembly: AssemblyVersion("2.1.1.0")]
15-
[assembly: AssemblyFileVersion("2.1.1.0")]
14+
[assembly: AssemblyVersion("2.1.2.0")]
15+
[assembly: AssemblyFileVersion("2.1.2.0")]

0 commit comments

Comments
 (0)