首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ConfuserEx在Xamarin表单中进行声明式混淆

使用ConfuserEx在Xamarin表单中进行声明式混淆
EN

Stack Overflow用户
提问于 2017-08-06 05:45:36
回答 1查看 385关注 0票数 0

我正在用ConfuserEx创建一个使用Xamarin.Forms的安卓应用程序。我想使用声明式模糊处理,就像在这个example中一样,这样我就可以更改每个类的模糊处理属性。

但是,Xamarin.Forms中的System.Reflection名称空间无法识别System.Reflection.ObfuscationAttribute类。我是否需要使用另一个NuGet包,或者我是否遗漏了什么?

否则,有没有一种方法可以以不同的方式在不同的类中包含或排除模糊功能?

EN

回答 1

Stack Overflow用户

发布于 2017-08-06 07:41:13

ConfuserEx仅查看属性的名称

代码语言:javascript
复制
if (ca.TypeFullName != "System.Reflection.ObfuscationAttribute")

因此,我将在PCL (Xamarin.Forms)项目本身中创建一个System.Reflection.ObfuscationAttribute类。

代码语言:javascript
复制
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://github.com/yck1509/ConfuserEx/blob/3c9c29d9daf2f1259edf69054c5693d5d225a980/Confuser.Core/ObfAttrMarker.cs#L138

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45526655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档