|   | 
| 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<string, ConfusionDirectoryInfo> confuseFileSourcePathDict = new Dictionary<string, ConfusionDirectoryInfo>(); | 
|   | 
|     // 类型对应的文件路径 | 
|     public Dictionary<Type, string> typeToPathDict = new Dictionary<Type, string>(); | 
|     // 类型里需要被混淆的变量或者方法名称对应列表 | 
|     public Dictionary<Type, List<string>> confusionTypeDict = new Dictionary<Type, List<string>>(); | 
|     // 记录类型里最终被混淆成了什么内容, 用于反混淆的时候替换 | 
|     public Dictionary<Type, Dictionary<string, string>> confusionDict = new Dictionary<Type, Dictionary<string, string>>(); | 
|     // 记录类型里最终被混淆成了什么内容, 用于反混淆的时候替换 | 
|     public Dictionary<Type, Dictionary<string, string>> reConfusionDict = new Dictionary<Type, Dictionary<string, string>>(); | 
|     // 通过反射搜集到的文件路径 | 
|     public List<string> confusionScriptFilePath = new List<string>(); | 
|   | 
|     // 替换表生成路径 | 
|     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(); | 
|     } | 
| } |