static public void GenFileList() { DirectoryInfo dir = new DirectoryInfo(AssetBundleLoader.streamingRootPath); FileInfo[] files = dir.GetFiles("*.unity3d", SearchOption.AllDirectories); ResInf resInf = new ResInf(); var ver = VersionMgr.LoadAssetVersion(); #if UNITY_EDITOR resInf.version = GitTools.getVerInfo(); #else resInf.version = ver.version; #endif resInf.timeCreated = ver.timeCreated; resInf.whoCreated = ver.whoCreated; int startIdx = dir.FullName.Length; for (int i = 0; i < files.Length; ++i) { var file = files[i]; string md5 = CMD5.MD5File(file.FullName); long siz = file.Length; string path = file.FullName.Substring(startIdx).Replace("\\", "/").Substring(1); resInf.Assets.Add(path, new AssetInf(siz, md5)); } string savedPath = EditorStreamingAssetsPath + "/" + FILE_LIST; File.WriteAllText(savedPath, TinyJSON.JSON.Dump(resInf, true)); Log("Generate {0} success.\n => {1}", FILE_LIST, savedPath); }
static int MD5File(IntPtr L) { L.ChkArgsCount(1); var arg0 = L.ToLuaString(1); string o = CMD5.MD5File(arg0); L.PushString(o); return(1); }