0

我使用Xamarin.Forms創建了一個使用ConfuserEx模糊處理的Android應用程序。我想使用像這樣的example這樣的聲明性混淆處理,所以我可以爲每個類更改混淆屬性。使用ConfuserEx在Xamarin表單中聲明性模糊處理

但是,Xamarin.Forms中的System.Reflection名稱空間不能識別System.Reflection.ObfuscationAttribute類。我需要使用另一個NuGet包嗎?還是我錯過了一些東西?

否則,有沒有一種方法可以用不同的方法在不同的類中包含或排除混淆功能?

回答

0

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://github.com/yck1509/ConfuserEx/blob/3c9c29d9daf2f1259edf69054c5693d5d225a980/Confuser.Core/ObfAttrMarker.cs#L138

+0

我試圖重命名功能添加到使用此方法的類,它並沒有改變任何東西。我是否需要在我的.crproj文件中放置任何東西以便ConfuserEx識別我也在使用聲明性模糊處理? – cvanbeek