summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
diff options
context:
space:
mode:
authorspacechase0 <spacechase0@users.noreply.github.com>2020-08-17 20:28:51 -0400
committerspacechase0 <spacechase0@users.noreply.github.com>2020-08-17 20:28:51 -0400
commitf012dae8728df55ab8803de1f269aee480ccc49b (patch)
tree10831bd416cf63b821ef583b9dd20fc5d6b634fb /src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
parent6afb80676becc337f7c381d71171d36c53e219ee (diff)
downloadSMAPI-f012dae8728df55ab8803de1f269aee480ccc49b.tar.gz
SMAPI-f012dae8728df55ab8803de1f269aee480ccc49b.tar.bz2
SMAPI-f012dae8728df55ab8803de1f269aee480ccc49b.zip
Fix harmony attributes not workign cross-platform
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/AssemblyLoader.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
index dbb5f696..c8c1ca08 100644
--- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -292,6 +292,19 @@ namespace StardewModdingAPI.Framework.ModLoading
IEnumerable<TypeReference> typeReferences = module.GetTypeReferences().OrderBy(p => p.FullName);
foreach (TypeReference type in typeReferences)
this.ChangeTypeScope(type);
+
+ // rewrite types using custom attributes
+ foreach (TypeDefinition type in module.GetTypes())
+ {
+ foreach (var attr in type.CustomAttributes)
+ {
+ foreach (var conField in attr.ConstructorArguments)
+ {
+ if (conField.Value is TypeReference typeRef)
+ this.ChangeTypeScope(typeRef);
+ }
+ }
+ }
}
// find or rewrite code