/// <summary> /// 处理网站的主方法 /// </summary> /// <param name="sdPath">.sdsite的文件夹路径如zha\zhangling\projectname</param> /// <param name="projName">.sdsite的名projName</param> public bool ExecuteSdsite(string partPath, string projName) { try { string sdPath = AnyFilePath.GetTempFolderAbsolutePath(partPath) + projName + ".sdsite"; //打开网站 SdsiteDocument = new SdsiteXmlDocument(sdPath); SdsiteDocument.Load(); _dealwithFileOrFolder = new DealWithFileOrFolder(); _dealwithFileOrFolder.SdsitesPath = partPath; #region add by zhangling on 2008年6月23日 //得到项目的创建时间 string _createTime = SdsiteDocument.DocumentElement.GetAttribute("createTime"); DateTime dt; if (DateTime.TryParse(_createTime, out dt)) { _projCreateTime = DateTime.Parse(_createTime); } _projCreateTime = dt; //得到项目的发布时间 string _pubTime = SdsiteDocument.DocumentElement.GetAttribute("pubTime"); DateTime _publishDt; if (DateTime.TryParse(_pubTime, out _publishDt)) { _publishTime = DateTime.Parse(_pubTime); } _publishTime = _publishDt; #endregion FolderXmlElement channelRootEle = SdsiteDocument.RootChannel; //做相应处理 SearchAndProcess(channelRootEle); ///移动.sdsite ///modified by zhangling on 2008年6月12日 string sourceFilePath = AnyFilePath.GetTempFolderAbsolutePath(partPath) + projName + ".sdsite"; string targetFilePath = AnyFilePath.GetSdsitesFolderAbsolutePath(partPath) + projName + ".sdsite"; FileService.FileMove(sourceFilePath, targetFilePath); //删除时出错 FolderService.FolderDelete(AnyFilePath.GetTempFolderAbsolutePath(partPath)); return(true); } catch (Exception ex) { ExceptionService.WriteExceptionLog(ex); return(false); } }
//SdsiteXmlDocument sdsiteDocument; /// <summary> /// 开始生成网站 /// </summary> /// <returns></returns> public bool StartBuild(string partPath, string projName) { string sdPath = AnyFilePath.GetSdsitesFolderAbsolutePath(partPath); string buildPath = AnyFilePath.GetWebAbsolutePath(partPath); toHtmlHelperObj = new ToHtmlHelper(sdPath, buildPath); resStartPath = sdPath + @"Root\" + @"Resource"; resToPath = buildPath + @"\Resource"; buildFile = new BuildFile(); buildFile.SdsiteDocument = toHtmlHelperObj.SdsiteXmlDocument; buildFile.ToHtmlHelperObj = toHtmlHelperObj; FolderXmlElement channelRootEle = toHtmlHelperObj.SdsiteXmlDocument.RootChannel; //string sdPath = AnyFilePath.GetSdsitesFolderAbsolutePath(partPath) + projName + ".sdsite"; ////打开网站 //this.sdsiteDocument = new SdsiteXmlDocument(sdPath); //this.sdsiteDocument.Load(); //buildFile = new BuildFile(); //buildFile.SdsiteDocument = this.sdsiteDocument; //buildFile.BuildFilePath = partPath; //FolderXmlElement channelRootEle = this.sdsiteDocument.RootChannel; try { SearchAndProcess(channelRootEle); return(true); } catch (Exception Ex) { ExceptionService.WriteExceptionLog(Ex); return(false); } }