static void ExportAssetBuild()
    {
        ExportHelp.ClearConsole();
        AssetDatabase.Refresh();
        string currentPath                     = Directory.GetCurrentDirectory() + "\\";
        List <AssetBundleBuild> builds         = new List <AssetBundleBuild>();
        DirectoryInfo           dinfo          = new DirectoryInfo(needExportResPath);
        List <FileInfo>         fs             = dinfo.GetFiles("*.*", SearchOption.AllDirectories).ToList().FindAll(m => !m.Name.EndsWith(".meta") && m.Name != "md5.txt");
        List <string>           needExportList = ExportHelp.MD5Comparison(needExportResPath, fs);

        if (needExportList.Count == 0)
        {
            Debug.Log("没有资源更新不需打包");
            return;
        }
        foreach (FileInfo file in fs)
        {
            AssetBundleBuild tbuild = new AssetBundleBuild();
            tbuild.assetBundleName = file.Name + suffixName;
            string fullName = file.FullName;
            fullName          = fullName.Replace(currentPath, "");
            fullName          = fullName.Replace("\\", "/");
            tbuild.assetNames = new string[] { fullName };
            builds.Add(tbuild);
        }
        ExportHelp.GoExport(builds.ToArray(), needExportList);
    }
Exemple #2
0
        public void SelRKDByDHoutExcel(string rkdh, string title, string alter, string spzt)
        {
            int       nuum   = 0;
            string    jgname = Session["jigou"].ToString();//Session:登录机构
            DataTable dtData = new DataTable();

            if (dtData.Rows.Count > 0)
            {
                string shtnl = "";
                // shtnl = "<meta http-equiv='content-type' content='application/ms-excel; charset=UTF-8'/>";
                shtnl = "<table border='1' cellspacing='1' cellpadding='1'>";
                shtnl = shtnl + "<tr align='center'>";
                shtnl = shtnl + "<td  colspan='11'><h2>" + title + "</h2></td>";
                shtnl = shtnl + "</tr>";
                shtnl = shtnl + "<tr align='center'>";
                shtnl = shtnl + "<td  colspan='11'>" + alter + "</td>";
                shtnl = shtnl + "</tr>";
                shtnl = shtnl + "<thead>";
                shtnl = shtnl + "<th>序号</th>";
                shtnl = shtnl + "<th>器材名称</th>";
                shtnl = shtnl + "<th>器材型号</th>";
                shtnl = shtnl + "<th>生产厂家</th>";
                shtnl = shtnl + "<th>数量</th>";
                shtnl = shtnl + "<th>单价</th>";
                shtnl = shtnl + "<th>来源</th>";
                shtnl = shtnl + "<th>报废提醒</th>";
                shtnl = shtnl + "<th>维保提醒</th>";
                shtnl = shtnl + "<th>审核状态</th>";
                shtnl = shtnl + "<th>备注</th>";
                shtnl = shtnl + "</thead><tbody>";
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    nuum  = nuum + 1;
                    shtnl = shtnl + "<tr>";
                    shtnl = shtnl + "<td>" + nuum.ToString() + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkmc"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rjxh"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkcj"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rknum"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkdj"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkly"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkbftx"] + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rkwbjl"] + "</td>";
                    shtnl = shtnl + "<td>" + spzt + "</td>";
                    shtnl = shtnl + "<td>" + dtData.Rows[i]["rknote"] + "</td>";
                    shtnl = shtnl + "</tr>";
                }
                shtnl = shtnl + "<tr align='center'>";
                shtnl = shtnl + "<td  colspan='11'>" + "<br/>" + "审批人:" + "_____________" + "领用人:" + "_____________" + "经手人:" + "_____________" + "日期:" + "_____________" + "<br/>" + "<br/>" + "</td>";
                shtnl = shtnl + "</tr>";
                shtnl = shtnl + "</tbody></table>";
                string bm       = DateTime.Now.ToString("yyyyMMddhhmmss");
                string filename = jgname + "入库单清单" + bm + ".xls";
                ExportHelp.ExportToExcel(filename, shtnl);
            }
        }
    /// <summary>
    /// 去打包
    /// </summary>
    /// <param name="_builds">打包的资源</param>
    /// <param name="updateList">变更的资源</param>
    public static void GoExport(AssetBundleBuild[] _builds, List <string> updateList)
    {
        if (_builds == null || _builds.Length == 0)
        {
            return;
        }
        string zipPath;
        string zipContent;
        string assetPath = WriteVersionToLocal(out zipPath, out zipContent);

        BuildPipeline.BuildAssetBundles(assetPath, _builds, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.Android);
        AssetDatabase.Refresh();
        Debug.Log("资源包创建成功");
        string updateResPath = ExportHelp.GetUpdateRes(assetPath, updateList);
        //创建压缩包
        //Zip.CreateZip(assetPath, zipPath);
        long zipSize = Zip.CreateZip(updateResPath, zipPath);

        WriteVersionListToLocal(zipContent, zipSize);
        AssetDatabase.Refresh();
        Debug.Log("zip创建成功");

        StartUpExe(zipContent);
    }