void init4Upgrade4Publish() { AssetDatabase.Refresh(); Hashtable tmpResVer = ECLCreateVerCfg.create2Map("Assets/" + ECLProjectManager.data.name + "/upgradeRes4Publish"); Hashtable lastResVer = ECLProjectManager.getLastUpgradeMd5Ver(); string key = ""; ECLResInfor ri = null; Hashtable needUpgradeRes = new Hashtable(); foreach (DictionaryEntry cell in tmpResVer) { key = cell.Key.ToString().Replace("/upgradeRes/", "/upgradeRes4Publish/"); if (lastResVer [key] == null || string.Compare(cell.Value.ToString(), lastResVer [key].ToString()) != 0) { needUpgradeRes [key] = true; } } int count = datas.Count; for (int i = 0; i < count; i++) { ri = (ECLResInfor)(datas [i]); if (needUpgradeRes [ri.relativePath] != null) { ri.selected = true; } else { ri.selected = false; } } }
ArrayList getSelectedFiles() { selectedDatas.Clear(); ECLResInfor ri = null; int count = datas.Count; for (int i = 0; i < count; i++) { ri = (ECLResInfor)(datas [i]); if (ri.selected && !ri.isDir) { selectedDatas.Add(ri); } } return(selectedDatas); }
void showOneFile(ECLResInfor ri, bool canEdite, bool needFilter) { if (needFilter && searchKey != "") { if (!ri.path.ToLower().Contains(searchKey.ToLower())) { return; } } string fname = ri.relativePath; EditorGUILayout.BeginHorizontal(); { if (canEdite) { bool selected = GUILayout.Toggle(ri.selected, "", GUILayout.Width(20)); if (selected != ri.selected) { ri.selected = selected; if (ri.isDir) { ArrayList list = new ArrayList(); list.AddRange(datas); int count = list.Count; ECLResInfor res = null; for (int i = 0; i < count; i++) { res = (ECLResInfor)(list [i]); if (res.path.Contains(ri.path)) { res.selected = selected; } } } } } // EditorGUILayout.LabelField ("", GUILayout.Width (ri.tabs * 4)); // EditorGUILayout.SelectableLabel (StrEx.appendSpce ("v." + ri.ver, 6) + fname, GUILayout.Height (18)); EditorGUILayout.SelectableLabel(StrEx.appendSpce("", 6) + fname, GUILayout.Height(18)); } EditorGUILayout.EndHorizontal(); }
void init4PublishSetting(string oldPublishPath) { AssetDatabase.Refresh(); string publishVerPath = ""; if (string.IsNullOrEmpty(oldPublishPath)) { publishVerPath = Application.dataPath + "/" + ECLProjectManager.ver4Publish; } else { publishVerPath = oldPublishPath; } Hashtable oldSettingCfg = ECLProjectManager.fileToMap(publishVerPath); string key = ""; ECLResInfor ri = null; Hashtable needUpgradeRes = new Hashtable(); foreach (DictionaryEntry cell in oldSettingCfg) { key = cell.Key.ToString().Replace("/upgradeRes/", "/upgradeRes4Publish/"); needUpgradeRes [key] = true; } int count = datas.Count; for (int i = 0; i < count; i++) { ri = (ECLResInfor)(datas [i]); if (needUpgradeRes [ri.relativePath] != null) { ri.selected = true; } else { ri.selected = false; } } }
void initData(string path, int tabs) { //跳过不同平台的资源 #if UNITY_ANDROID if (Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX")) { return; } #elif UNITY_IOS if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX")) { return; } #elif UNITY_STANDALONE_WIN if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("StandaloneOSX")) { return; } #elif UNITY_STANDALONE_OSX if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone")) { return; } #elif UNITY_WEBGL if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX")) { return; } #endif ECLResInfor ri = new ECLResInfor(); path = path.Replace("\\", "/"); ri.path = path; ri.name = Path.GetFileName(path); ri.isDir = true; ri.selected = true; ri.tabs = tabs; ri.relativePath = ri.path.Replace(Application.dataPath + "/", ""); ri.publishPath = Utl.filterPath(ri.relativePath); ri.ver = ""; datas.Add(ri); string[] fileEntries = Directory.GetFiles(path); //因为Application.dataPath得到的是型如 "工程名称/Assets" int count = fileEntries.Length; string fileName = ""; string extension = ""; for (int i = 0; i < count; i++) { fileName = fileEntries [i]; extension = Path.GetExtension(fileName); if (ECLEditorUtl.isIgnoreFile(fileName)) { continue; } totalFiles++; ri = new ECLResInfor(); fileName = fileName.Replace("\\", "/"); ri.path = fileName; ri.name = Path.GetFileName(fileName); ri.isDir = false; ri.selected = true; ri.tabs = tabs + 1; ri.relativePath = ri.path.Replace(Application.dataPath + "/", ""); ri.publishPath = Utl.filterPath(ri.relativePath); ri.ver = Utl.MD5Encrypt(File.ReadAllBytes(fileName)); //MapEx.getString (resLastUpgradeVer, ri.publishPath); datas.Add(ri); selectedDatas.Add(ri); } string[] dirEntries = Directory.GetDirectories(path); count = dirEntries.Length; string dir = ""; for (int i = 0; i < count; i++) { initData(dirEntries [i], tabs + 1); } }