我有一個這樣的 JSON 類:public class UpdateCheck{ public bool UpdatesAvailable { get; set; } public string LinkOfNewVersion { get; set; }}但是當我使用 ConfuserEx 混淆我的程序集時, UpdatesAvailableand的值是空的:/LinkOfNewVersion我已經嘗試了以下所有方法:在我的 JSON 類上方添加[Obfuscation(Exclude = false, Feature = "-rename")]屬性:[Obfuscation(Exclude = false, Feature = "-rename")]public class UpdateCheck{ public bool UpdatesAvailable { get; set; } public string LinkOfNewVersion { get; set; }}在我的 JSON 類上方添加[Serializable]屬性:[Serializable]public class UpdateCheck{ public bool UpdatesAvailable { get; set; } public string LinkOfNewVersion { get; set; }}在我的 JSON 類上方添加兩個屬性:[Serializable][Obfuscation(Exclude = false, Feature = "-rename")]public class UpdateCheck{ public bool UpdatesAvailable { get; set; } public string LinkOfNewVersion { get; set; }}但是我嘗試過的所有方法都失敗了:/我的混淆屬性: <rule pattern="true" preset="maximum" inherit="false"> <protection id="anti ildasm" /> <protection id="anti tamper" /> <protection id="constants" /> <protection id="ctrl flow" /> <protection id="anti dump" /> <protection id="anti debug" /> <protection id="invalid metadata" /> <protection id="ref proxy" /> <protection id="resources" /> <protection id="typescramble" /> <protection id="rename" /> </rule>當我從 ConfuserEx 配置文件中刪除“重命名”保護時,我的程序集會像這樣崩潰:
2 回答

慕尼黑8549860
TA貢獻1818條經驗 獲得超11個贊
嘗試使用JsonProperty屬性將字段名稱設置為其固定值:
public class UpdateCheck
{
[JsonProperty("UpdatesAvailable")]
public bool UpdatesAvailable { get; set; }
[JsonProperty("LinkOfNewVersion")]
public string LinkOfNewVersion { get; set; }
}

楊__羊羊
TA貢獻1943條經驗 獲得超7個贊
您必須專門刪除“名稱”和“類型爭奪”選項。使用“無”以上的任何預設都包括“名稱”,這是主要問題。我在沒有這兩個的情況下使用最大預設,沒有關于 Json 的問題。
- 2 回答
- 0 關注
- 705 瀏覽
添加回答
舉報
0/150
提交
取消