public static void CheckScriptsQuiet() { List <string> difList = new List <string>(); List <string> checkFiles = new List <string>(); string[] csFiles = Directory.GetFiles(Application.dataPath, "*.cs", SearchOption.AllDirectories); string ManifestFile = Application.dataPath + "/Plugins/Android/AndroidManifest.xml"; string[] jarFiles = Directory.GetFiles(Application.dataPath, "*.jar", SearchOption.AllDirectories); checkFiles.AddRange(csFiles); checkFiles.AddRange(jarFiles); checkFiles.Add(ManifestFile); int i = 0; CustomBuildLog fl = new CustomBuildLog(); foreach (string f in checkFiles) { string path = f.Replace('\\', '/'); string md5 = ResCommon.GetFileMD5(path); if (lastestCSMD5.ContainsKey(path)) { if (lastestCSMD5[path] != md5) { difList.Add(path); } } else { difList.Add(path); } i++; newBuildLog.AddData(new FileMD5Data(path, md5)); EditorUtility.DisplayProgressBar("安卓打包", "检查脚本 " + f, (float)i / (float)csFiles.Length); } EditorUtility.ClearProgressBar(); if (difList.Count > 0) { BuildQuietScriptDiff(); } else { BuildQuietResources(); } string json = JsonMapper.ToJson(difList); FileUtilTool.DelFile(diffLogFile); FileUtilTool.WriteFile(diffLogFile, json); }
public static string GetMD5SecondForFile(string file, string relative, string time) { string md5 = ResCommon.GetFileMD5(file); string fileName = file.Replace("\\", "/"); fileName = fileName.Replace(relative + "/", ""); MD2 md2 = new MD2(); md2.fileName = fileName; md2.hashCode = md5; md2.time = time.ToString(); return(JsonMapper.ToJson(md2)); }
//[MenuItem("Package/测试/生成场景文件のMD5", false, 4)] public static void GenMD5() { List <string> md5s = new List <string>(); string[] files = Directory.GetFiles("test/", "*.*", SearchOption.AllDirectories); foreach (var k in files) { md5s.Add(k + "\t" + ResCommon.GetFileMD5(k)); //if(!k.EndsWith(".manifest")) //{ // byte[] bs = File.ReadAllBytes(k); // AssetBundle ab = AssetBundle.LoadFromMemory(bs); // string []assetNames = ab.GetAllAssetNames(); //} } FileUtilTool.WriteFile("testscenes.md5", string.Join("\r\n", md5s.ToArray())); }
public static List <AssetbundleJsonData> GetMD5ForFolder(string folder, string relative) { List <AssetbundleJsonData> data = new List <AssetbundleJsonData>(); string[] files = Directory.GetFiles(folder, "*", SearchOption.AllDirectories); EditorUtility.DisplayProgressBar("生成MD5", "...", 0); int i = 0; foreach (string file in files) { bool find = false; foreach (var k in keyNotInclude) { if (Path.GetFileName(file) == k) { find = true; } } if (find) { continue; } string md5 = ResCommon.GetFileMD5(file); //Debug.Log("MD5 :" + file + ": " + resFolder); string ffile = file.Replace("\\", "/"); string fileName = ffile.Replace(relative + "/", ""); //Debug.Log("MD5 :" + fileName); FileInfo fileInfo = new FileInfo(file); AssetbundleJsonData jData = new AssetbundleJsonData(fileName, md5, fileInfo.Length); i++; EditorUtility.DisplayProgressBar("生成MD5", file, (float)i / (float)files.Length); data.Add(jData); } EditorUtility.ClearProgressBar(); return(data); }
public RecordInfo(string fileName) { this.fileName = fileName; this.md5 = ResCommon.GetFileMD5(fileName); }
public static void CheckScripts() { List <string> difList = new List <string>(); List <string> checkFiles = new List <string>(); string[] csFiles = Directory.GetFiles(Application.dataPath, "*.cs", SearchOption.AllDirectories); string ManifestFile = Application.dataPath + "/Plugins/Android/AndroidManifest.xml"; string[] jarFiles = Directory.GetFiles(Application.dataPath, "*.jar", SearchOption.AllDirectories); checkFiles.AddRange(csFiles); checkFiles.AddRange(jarFiles); checkFiles.Add(ManifestFile); int i = 0; CustomBuildLog fl = new CustomBuildLog(); foreach (string f in checkFiles) { string path = f.Replace('\\', '/'); string md5 = ResCommon.GetFileMD5(path); if (lastestCSMD5.ContainsKey(path)) { if (lastestCSMD5[path] != md5) { difList.Add(path); } } else { difList.Add(path); } //Debug.Log(f + " md5:" + md5); i++; newBuildLog.AddData(new FileMD5Data(path, md5)); EditorUtility.DisplayProgressBar("安卓打包", "检查脚本 " + f, (float)i / (float)csFiles.Length); } EditorUtility.ClearProgressBar(); if (difList.Count > 0) { if (EditorUtility.DisplayDialog("安卓打包", string.Format("本次打包含程序和资源更新\r\n 原资源版本号:{0}", versionRes), "继续", "取消")) { ShowScriptDiff(difList); } } else { if (EditorUtility.DisplayDialog("安卓打包", string.Format("本次打包只包含资源更新\r\n 原资源版本号:{0}", versionRes), "继续", "取消")) { CheckResources(); } } //Debug.Log("diff list :"); //foreach (string str in difList) //{ // Debug.Log(str); //} string json = JsonMapper.ToJson(difList); FileUtilTool.DelFile(diffLogFile); FileUtilTool.WriteFile(diffLogFile, json); }