修复在Unity 2019上的编译错误

before-split
walon 2025-05-24 12:55:53 +08:00
parent 1cd1b912ec
commit b2ba676ec1
3 changed files with 5 additions and 5 deletions

View File

@ -591,7 +591,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus
{ {
status = RenameStatus.Renamed, status = RenameStatus.Renamed,
signature = methodRecord != null ? methodRecord.signature : TypeSigUtil.ComputeMethodDefSignature(firstMethod), signature = methodRecord != null ? methodRecord.signature : TypeSigUtil.ComputeMethodDefSignature(firstMethod),
oldName = methodRecord != null ? methodRecord.oldName : firstMethod.Name, oldName = methodRecord != null ? methodRecord.oldName : (string)firstMethod.Name,
newName = newName, newName = newName,
}); });
} }

View File

@ -82,7 +82,7 @@ namespace Obfuz.Settings
} }
else else
{ {
s_Instance ??= CreateInstance<ObfuzSettings>(); s_Instance = s_Instance ?? CreateInstance<ObfuzSettings>();
} }
return s_Instance; return s_Instance;
} }

View File

@ -802,7 +802,7 @@ namespace Obfuz.Utils
public static ObfuzScope? GetObfuzIgnoreScope(IHasCustomAttribute obj) public static ObfuzScope? GetObfuzIgnoreScope(IHasCustomAttribute obj)
{ {
var ca = obj.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); var ca = obj.CustomAttributes.FirstOrDefault(c => c.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute");
if (ca == null) if (ca == null)
{ {
return null; return null;
@ -816,13 +816,13 @@ namespace Obfuz.Utils
TypeDef cur = typeDef; TypeDef cur = typeDef;
while (cur != null) while (cur != null)
{ {
var ca = cur.CustomAttributes?.FirstOrDefault(ca => ca.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute"); var ca = cur.CustomAttributes?.FirstOrDefault(c => c.AttributeType.FullName == "Obfuz.ObfuzIgnoreAttribute");
if (ca != null) if (ca != null)
{ {
var scope = (ObfuzScope)ca.ConstructorArguments[0].Value; var scope = (ObfuzScope)ca.ConstructorArguments[0].Value;
CANamedArgument inheritByNestedTypesArg = ca.GetNamedArgument("InheritByNestedTypes", false); CANamedArgument inheritByNestedTypesArg = ca.GetNamedArgument("InheritByNestedTypes", false);
bool inheritByNestedTypes = inheritByNestedTypesArg == null || (bool)inheritByNestedTypesArg.Value; bool inheritByNestedTypes = inheritByNestedTypesArg == null || (bool)inheritByNestedTypesArg.Value;
return cur == typeDef || inheritByNestedTypes ? scope : null; return cur == typeDef || inheritByNestedTypes ? (ObfuzScope?) scope : null;
} }
cur = cur.DeclaringType; cur = cur.DeclaringType;
} }