using System.Collections.Generic; using UnityEngine; using UnityEditor; using System; public class ConfusionModel { private string LS_KEY_RECONFUSION_MAP_FILE = Application.dataPath + "ReConfuseMapFile"; // 通过Assembly找到需要被混淆的ClassType // 对这些ClassType的Field和Method根据配置建立索引 private const string PREV_FIX = "_"; private static int m_Seed = 0; public string NewContent { get { return string.Format("{0}{1}", PREV_FIX, m_Seed++); } } // 想要被混淆的文件夹路径 public Dictionary confuseFileSourcePathDict = new Dictionary(); // 类型对应的文件路径 public Dictionary typeToPathDict = new Dictionary(); // 类型里需要被混淆的变量或者方法名称对应列表 public Dictionary> confusionTypeDict = new Dictionary>(); // 记录类型里最终被混淆成了什么内容, 用于反混淆的时候替换 public Dictionary> confusionDict = new Dictionary>(); // 记录类型里最终被混淆成了什么内容, 用于反混淆的时候替换 public Dictionary> reConfusionDict = new Dictionary>(); // 通过反射搜集到的文件路径 public List confusionScriptFilePath = new List(); // 替换表生成路径 public string ReConfuseMapFileDir { get { return EditorPrefs.GetString(LS_KEY_RECONFUSION_MAP_FILE, Application.dataPath + "/ReConfusionMapFiles"); } set { EditorPrefs.SetString(LS_KEY_RECONFUSION_MAP_FILE, value); } } public ConfusionModel() { Reset(); } public void Reset() { m_Seed = 0; typeToPathDict.Clear(); confuseFileSourcePathDict.Clear(); confusionTypeDict.Clear(); confusionDict.Clear(); } }