static XGameUpdate.UpdateFileInfo GenFiles(string inputPath, bool isCry) { if (inputPath == null || inputPath.Equals("")) { return(null); } var fi = new XGameUpdate.UpdateFileInfo(); var dir = inputPath.Split('/'); //压缩出来的文件加个随机数 fi.name = dir[dir.Length - 1]; int randomNum = UnityEngine.Random.Range(0, 999999999); fi.packageName = fi.name + "_" + randomNum; ForeachFile(inputPath, (string f) => { Debug.LogWarning("genfile " + f); if (Path.GetExtension(f).Equals("meta")) { File.Delete(f); } else { if (isCry) { CryFile(f); } } }); var outPath = inputPath + "_" + randomNum + ".zip"; if (File.Exists(outPath)) { if (File.Exists(outPath + "_bk")) { File.Delete(outPath + "_bk"); } File.Move(outPath, outPath + "_bk"); } Debug.LogError("zipfile " + inputPath); DWTools.FastZipCompress(inputPath, outPath); fi.md5 = DWTools.GenMD5(outPath); fi.length = GetFileLength(outPath); return(fi); }
static long GenFile(string inputPath, bool isCry) { if (isCry) { CryFile(inputPath); } var filePath = inputPath + ".zip"; if (File.Exists(filePath)) { File.Delete(filePath); } DWTools.FastZipCompress(inputPath); var fileInfo = new FileInfo(filePath); return(fileInfo.Length); }