我正在用ConfuserEx创建一个使用Xamarin.Forms的安卓应用程序。我想使用声明式模糊处理,就像在这个example中一样,这样我就可以更改每个类的模糊处理属性。
但是,Xamarin.Forms中的System.Reflection名称空间无法识别System.Reflection.ObfuscationAttribute类。我是否需要使用另一个NuGet包,或者我是否遗漏了什么?
否则,有没有一种方法可以以不同的方式在不同的类中包含或排除模糊功能?
发布于 2017-08-06 07:41:13
ConfuserEx仅查看属性的名称:
if (ca.TypeFullName != "System.Reflection.ObfuscationAttribute")因此,我将在PCL (Xamarin.Forms)项目本身中创建一个System.Reflection.ObfuscationAttribute类。
即
using System.Runtime.InteropServices;
namespace System.Reflection
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false), ComVisible(true)]
public sealed class ObfuscationAttribute : Attribute
{
//
// Fields
//
private bool m_strip = true;
private bool m_exclude = true;
private bool m_applyToMembers = true;
private string m_feature = "all";
//
// Properties
//
public bool ApplyToMembers
{
get
{
return this.m_applyToMembers;
}
set
{
this.m_applyToMembers = value;
}
}
public bool Exclude
{
get
{
return this.m_exclude;
}
set
{
this.m_exclude = value;
}
}
public string Feature
{
get
{
return this.m_feature;
}
set
{
this.m_feature = value;
}
}
public bool StripAfterObfuscation
{
get
{
return this.m_strip;
}
set
{
this.m_strip = value;
}
}
}
}https://stackoverflow.com/questions/45526655
复制相似问题