//增加到dic中 static void HandleFileMetaToDic(string metafile, CDicMeta dicMetas) { Meta_t v = Meta_t.FromFile(metafile); if (v != null) { dicMetas.Add(v.uuid, v); } }
//如何快速处理meta? //"*.cs" public static void CreateMetaDic(string proj_path, CDicMeta dicMetas, string filt = "*.meta") { bool bAllMeta = filt == "*.meta"; string[] ss = Directory.GetFiles(proj_path, filt, SearchOption.AllDirectories); for (int i = 0; i < ss.Length; ++i) { //统一处理成unix文件名 string fn = ss[i].Replace('\\', '/'); HandleFileMetaToDic(bAllMeta ? fn : (fn + ".meta"), dicMetas); } Debug.Log(string.Format("****创建Meta字典****: {0}处理完毕,count={1}", proj_path, dicMetas.Count)); }
//"xGame" // proj_path: 目标工程路径,如 "G:/Moba1/workspace_602/GameRes - Android/Assets"; // 注意: 必须把dll里面的文件先挪到该工程路径下,同时,去除dll public void Run(string dll, string proj_path) { if (!_dll.IsOk()) { _dll.LoadDomainDllTypes(dll); } if (!_dllBack.IsOk()) { _dllBack.LoadDomainDllTypes("Assembly-CSharp"); } if (_dll.m_meta == null) { Debug.LogWarning(string.Format("[{0}] 未找到 m_meta", dll)); return; } //初始化... string patten = string.Format(@"m_Script: {{fileID: ([0-9\-]+), guid: {0}, type: ([0-9]+)}}", _dll.m_meta.uuid); rgx_11500000 = new Regex(patten); //if (m_refMetas.Count == 0) //CreateMetaDic("G:/Moba1/workspace_602/GameRes/Assets", m_refMetas); if (m_dstMetas.Count == 0) { //m_dstMetas.Clear(); CDicMeta.CreateMetaDic(proj_path, m_dstMetas, "*.cs"); } //ReplaceMissScriptInFile(proj_path + "/Resources/Exporter/UI/Battle/Prefabs/UGUI_ListForm2D.prefab"); //替换DLL引用 //ReplaceScriptRefDLLInFile(proj_path + "/Resources/Exporter/UI/Battle/Prefabs/UGUI_ListForm2D.prefab"); //string ff = "G:/Moba1/workspace_602/GameRes/Assets/Export/Effect/202/202_3_3.prefab"; //string ff = "G:/Moba1/workspace_602/GameRes/Assets/Export/Hero/Animations/212hero_0/jiansheng_Low.prefab"; //ReplaceMissScriptInFile(ff); //处理所有的prefab ReplaceProjectMissScriptInFile(proj_path, "*.prefab"); ReplaceProjectMissScriptInFile(proj_path, "*.asset"); Debug.Log("The end~"); }