修复MonoBehavoiur和ScriptableObject的属性没有混淆的bug
parent
7a7ef72728
commit
a833cf26e1
|
@ -123,14 +123,14 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
};
|
||||
|
||||
private readonly CachedDictionary<TypeDef, bool> _computeDeclaringTypeDisableAllMemberRenamingCache;
|
||||
private readonly CachedDictionary<TypeDef, bool> _isInheritScriptCache;
|
||||
private readonly CachedDictionary<TypeDef, bool> _isSerializableCache;
|
||||
private readonly CachedDictionary<TypeDef, bool> _isInheritFromMonoBehaviourCache;
|
||||
private readonly CachedDictionary<TypeDef, bool> _isScriptOrSerializableTypeCache;
|
||||
|
||||
public UnityRenamePolicy()
|
||||
{
|
||||
_computeDeclaringTypeDisableAllMemberRenamingCache = new CachedDictionary<TypeDef, bool>(ComputeDeclaringTypeDisableAllMemberRenaming);
|
||||
_isInheritScriptCache = new CachedDictionary<TypeDef, bool>(MetaUtil.IsScriptType);
|
||||
_isSerializableCache = new CachedDictionary<TypeDef, bool>(MetaUtil.IsSerializableType);
|
||||
_isInheritFromMonoBehaviourCache = new CachedDictionary<TypeDef, bool>(MetaUtil.IsInheritFromMonoBehaviour);
|
||||
_isScriptOrSerializableTypeCache = new CachedDictionary<TypeDef, bool>(MetaUtil.IsScriptOrSerializableType);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
public override bool NeedRename(PropertyDef propertyDef)
|
||||
{
|
||||
TypeDef typeDef = propertyDef.DeclaringType;
|
||||
if (_isScriptOrSerializableTypeCache.GetValue(typeDef))
|
||||
if (_isSerializableCache.GetValue(typeDef))
|
||||
{
|
||||
bool isGetterPublic = propertyDef.GetMethod != null && propertyDef.GetMethod.IsPublic && !propertyDef.GetMethod.IsStatic;
|
||||
bool isSetterPublic = propertyDef.SetMethod != null && propertyDef.SetMethod.IsPublic && !propertyDef.SetMethod.IsStatic;
|
||||
|
|
|
@ -177,6 +177,11 @@ namespace Obfuz.Utils
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsSerializableType(TypeDef type)
|
||||
{
|
||||
return type.IsSerializable;
|
||||
}
|
||||
|
||||
public static bool IsScriptOrSerializableType(TypeDef type)
|
||||
{
|
||||
return type.IsSerializable || IsScriptType(type);
|
||||
|
|
Loading…
Reference in New Issue