Ejemplo n.º 1
0
        public void Publish_Uses_Sln_File_If_None_Is_Given()
        {
            using (var publish = new Publish(this.logger.Object, this.progressFactory.Object))
            {
                publish.Output = "C:\\dev\\Zatoichi\\Zatoichi.Common.Infrastructure\\published";

                // Hackerooni
                var dr = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory)?.Parent?.Parent?.Parent?.Parent;
                publish.Execute(dr.FullName);
            }
        }
        public void CreateHtml(string idStr, string siteDir, string uploadImgDir, string uploadFileUrl, string uploadMediaUrl, string siteURL)
        {
            Publish       publish;      // HTML发布处理
            PublishParam  publishParam; // 发布参数配置
            List <string> lstMenu;

            if (!string.IsNullOrEmpty(idStr.Trim()))
            {
                publish = new Publish(this.SiteID, siteDir, siteURL);
                publish.UploadImgUrl = uploadImgDir;
                publish.MediasUrl    = uploadMediaUrl;
                publish.FilesUrl     = uploadFileUrl;
                publishParam         = new PublishParam();
                lstMenu = new List <string>();

                publish.IsDisplayProgress = false;         // 不显示发布进度条
                publishParam.IsSiteIndex  = true;          // 站点首页
                publishParam.IsMenuIndex  = true;          // 栏目首页
                publishParam.IsMenuList   = true;          // 栏目列表
                publishParam.IsContent    = true;          // 内容页
                publishParam.UnPublished  = false;         // 只生成未生成页面
                lstMenu.Add(this.NodeCode);

                publishParam.Type             = PublishType.ContentIDEnum;
                publishParam.PublishTypeParam = new string[] { idStr };             //内容ID 多个ID可由 , 分隔
                publishParam.LstMenu          = lstMenu;

                try
                {
                    publish.Execute(publishParam);      // 执行发布
                    LogContent   = "内容记录 " + HttpContext.Current.Request.Form["hidLogTitle"] + " 发布HTML 成功。";
                    LogException = string.Empty;
                }
                catch (Exception ex)
                {
                    LogException = ex.Message;
                }
            }
        }