fix build errors on Linux
This commit is contained in:
parent
0ce8939988
commit
169ce01810
|
@ -56,7 +56,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
if (this.MethodNames.Any())
|
||||
{
|
||||
MethodReference methodRef = RewriteHelper.AsMethodReference(instruction);
|
||||
if (methodRef is not null && methodRef.DeclaringType.FullName == this.FullTypeName && this.MethodNames.Contains(methodRef.Name))
|
||||
if (methodRef != null && methodRef.DeclaringType.FullName == this.FullTypeName && this.MethodNames.Contains(methodRef.Name))
|
||||
{
|
||||
string eventName = methodRef.Name.Split(new[] { '_' }, 2)[1];
|
||||
this.MethodNames.Remove($"add_{eventName}");
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
if (this.FieldNames.Any())
|
||||
{
|
||||
FieldReference fieldRef = RewriteHelper.AsFieldReference(instruction);
|
||||
if (fieldRef is not null && fieldRef.DeclaringType.FullName == this.FullTypeName && this.FieldNames.Contains(fieldRef.Name))
|
||||
if (fieldRef != null && fieldRef.DeclaringType.FullName == this.FullTypeName && this.FieldNames.Contains(fieldRef.Name))
|
||||
{
|
||||
this.FieldNames.Remove(fieldRef.Name);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
// detect Harmony
|
||||
if (type.Scope is not AssemblyNameReference { Name: "0Harmony" } scope)
|
||||
if (!(type.Scope is AssemblyNameReference scope) || scope.Name != "0Harmony")
|
||||
return false;
|
||||
|
||||
// rewrite Harmony 1.x type to Harmony 2.0 type
|
||||
|
|
Loading…
Reference in New Issue