Esempio n. 1
0
        /// <summary>
        /// 生成AB资源文件列表
        /// </summary>
        public static void CreateAssetBundleFileInfo()
        {
            string abRootPath  = GetExportPath();
            string abFilesPath = abRootPath + AppSetting.ABFiles;

            if (File.Exists(abFilesPath))
            {
                File.Delete(abFilesPath);
            }

            var abFileList = new List <string>(Directory.GetFiles(abRootPath, "*" + AppSetting.ExtName, SearchOption.AllDirectories));

            abFileList.Add(abRootPath + AppSetting.MineGameName);
            FileStream   fs = new FileStream(abFilesPath, FileMode.CreateNew);
            StreamWriter sw = new StreamWriter(fs);

            DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2018, 1, 1));
            int      ver       = ((int)((DateTime.Now - startTime).TotalMinutes));

            sw.WriteLine(ver + "|" + DateTime.Now.ToString("u"));
            for (int i = 0; i < abFileList.Count; i++)
            {
                string file  = abFileList[i];
                long   size  = 0;
                string md5   = MD5Utils.MD5File(file, out size);
                string value = file.Replace(abRootPath, string.Empty).Replace("\\", "/");
                sw.WriteLine(value + "|" + md5 + "|" + size);
            }
            sw.Close();
            fs.Close();
            ToolsHelper.Log("资源版本Version:" + ver + "  已复制到剪切板");
            ToolsHelper.Log("ABFiles文件生成完成");
            ToolsHelper.CopyString(ver.ToString());
        }