add: add EncryptFieldAttribute
parent
0f6207b0ae
commit
685f5f5530
|
@ -29,6 +29,7 @@ namespace Obfuz.ObfusPasses.CleanUp
|
|||
return;
|
||||
var toRemove = new List<CustomAttribute>();
|
||||
customAttributes.RemoveAll("Obfuz.ObfuzIgnoreAttribute");
|
||||
customAttributes.RemoveAll("Obfuz.EncryptFieldAttribute");
|
||||
}
|
||||
|
||||
public override void Process()
|
||||
|
|
|
@ -29,6 +29,14 @@ namespace Obfuz.ObfusPasses.FieldEncrypt
|
|||
|
||||
public override bool NeedEncrypt(FieldDef field)
|
||||
{
|
||||
if (MetaUtil.HasEncryptFieldAttribute(field))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (MetaUtil.HasObfuzIgnoreAttribute(field) || MetaUtil.HasObfuzIgnoreAttribute(field.DeclaringType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var rule = _configParser.GetFieldRule(field);
|
||||
return rule != null;
|
||||
}
|
||||
|
|
|
@ -788,5 +788,10 @@ namespace Obfuz.Utils
|
|||
{
|
||||
return obj.CustomAttributes.Any(ca => ca.AttributeType.FullName == "System.Runtime.CompilerServices.CompilerGeneratedAttribute");
|
||||
}
|
||||
|
||||
public static bool HasEncryptFieldAttribute(IHasCustomAttribute obj)
|
||||
{
|
||||
return obj.CustomAttributes.Any(ca => ca.AttributeType.FullName == "Obfuz.EncryptFieldAttribute");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Obfuz
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
||||
public class EncryptFieldAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 30f22110938816d4cb7e9cc9a176fd1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue