예제 #1
0
        /// <summary>
        /// 根据现有的ulrconfig对象来判断操作类型。存在就表示编辑,否则即添加
        /// </summary>
        /// <param name="urlconfig"></param>
        /// <returns></returns>
        public Operation CheckOperation(URLConfig urlconfig)
        {
            string xpath = string.Format(str_format, urlconfig.Site, urlconfig.SiteUrl, urlconfig.Channel, urlconfig.Charset);

            XmlNode xn = xmldoc.SelectSingleNode(xpath);

            if (xn is XmlNode)
            {
                return Operation.EDIT;
            }

            return Operation.ADD;
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["action"] == null || Request.QueryString["action"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["site"] == null || Request.QueryString["site"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["siteurl"] == null || Request.QueryString["siteurl"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["channel"] == null || Request.QueryString["channel"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["charset"] == null || Request.QueryString["charset"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["action"].ToString() == "delete")
            {
                URLConfig uc = new URLConfig();

                uc.Site = Request.QueryString["site"].ToString().Trim();

                uc.SiteUrl = Request.QueryString["siteurl"].ToString().Trim();

                uc.Channel = Request.QueryString["channel"].ToString().Trim();

                uc.Charset = Request.QueryString["charset"].ToString().Trim();

                UrlConfigManager ucm = new UrlConfigManager();

                ucm.RemoveChildNode(uc);

                Response.Redirect("index.aspx");
            }
        }
예제 #3
0
        /// <summary>
        /// 初始化站点配置的TextBox的值
        /// </summary>
        /// <param name="_urlconfig"></param>
        private void InitTextBox(URLConfig _urlconfig)
        {
            //tbSite.Text = _urlconfig.Site;
            //tbSiteUrl.Text = _urlconfig.SiteUrl;
            //tbChannel.Text = _urlconfig.Channel;
            //tbCharset.Text = _urlconfig.Charset;
            //tbProxy.Text = _urlconfig.Proxy;
            //tbPort.Text = _urlconfig.Port;
            //tbListFormat.Text = _urlconfig.ListFormat;
            //tbNextPage.Text = _urlconfig.ListNextPage;
            //tbNextPageReplace.Text = _urlconfig.ListNextPageReplace;
            //tbStartPageNo.Text = _urlconfig.StartPageNo;
            //tbEndPageNo.Text = _urlconfig.EndPageNo;
            //tbListStep.Text = _urlconfig.ListStep;
            //tbListContent.Text = _urlconfig.ListContent;
            //tbListContentReplace.Text = _urlconfig.ListContentReplace;
            //tbDetailLink.Text = _urlconfig.DetailLink;
            //tbTitleDetail.Text = _urlconfig.TitleDetail;
            //tbTitleDetailReplace.Text = _urlconfig.TitleDetailReplace;
            //tbAuthorDetail.Text = _urlconfig.AuthorDetail;
            //tbAuthorDetailReplace.Text = _urlconfig.AuthorDetailReplace;
            //tbDateDetail.Text = _urlconfig.DateDetail;
            //tbDateDetailReplace.Text = _urlconfig.DateDetailReplace;
            //tbContentDetail.Text = _urlconfig.ContentDetail;
            //tbContentDetailReplace.Text = _urlconfig.ContentDetailReplace;
            //tbContentList.Text = _urlconfig.ContentList;
            //tbContentListReplace.Text = _urlconfig.ContentListReplace;
            //tbTagDetail.Text = _urlconfig.TagDetail;
            //tbTagDetailReplace.Text = _urlconfig.TagDetailReplace;
            //tbSnatchDate.Text = _urlconfig.SnatchDate;
            //tbSnatchInterval.Text = _urlconfig.SnatchInterval;
            //tbSnatchFrequency.Text = _urlconfig.SnatchFrequency;

            //tabConrol1.SelectedIndex = 1;
        }
예제 #4
0
 /// <summary>
 /// 将DataGridViewRow转换成UrlConfig对象的属性值
 /// </summary>
 /// <param name="_urlconfig"></param>
 /// <param name="_row"></param>
 private void GridViewRowToUrlConfig(URLConfig _urlconfig, GridViewRow row)
 {
     _urlconfig.Site = ((TextBox)row.Cells[2].Controls[0]).Text;
     _urlconfig.SiteUrl = ((TextBox)row.Cells[3].Controls[0]).Text;
     _urlconfig.Channel = ((TextBox)row.Cells[4].Controls[0]).Text; ;
     _urlconfig.Charset = ((TextBox)row.Cells[5].Controls[0]).Text; ;
     _urlconfig.Proxy = ((TextBox)row.Cells[0].Controls[0]).Text;
     _urlconfig.Port = ((TextBox)row.Cells[1].Controls[0]).Text;
     _urlconfig.ListFormat = ((TextBox)row.Cells[6].Controls[0]).Text;
     _urlconfig.ListNextPage = ((TextBox)row.Cells[7].Controls[0]).Text;
     _urlconfig.ListNextPageReplace = ((TextBox)row.Cells[8].Controls[0]).Text;
     _urlconfig.StartPageNo = ((TextBox)row.Cells[9].Controls[0]).Text;
     _urlconfig.EndPageNo = ((TextBox)row.Cells[10].Controls[0]).Text;
     _urlconfig.ListStep = ((TextBox)row.Cells[10].Controls[0]).Text;
     _urlconfig.ListContent = ((TextBox)row.Cells[11].Controls[0]).Text;
     _urlconfig.ListContentReplace = ((TextBox)row.Cells[12].Controls[0]).Text;
     _urlconfig.DetailLink = ((TextBox)row.Cells[13].Controls[0]).Text;
     _urlconfig.TitleDetail = ((TextBox)row.Cells[14].Controls[0]).Text;
     _urlconfig.TitleDetailReplace = ((TextBox)row.Cells[15].Controls[0]).Text;
     _urlconfig.AuthorDetail = ((TextBox)row.Cells[16].Controls[0]).Text;
     _urlconfig.AuthorDetailReplace = ((TextBox)row.Cells[17].Controls[0]).Text;
     _urlconfig.DateDetail = ((TextBox)row.Cells[18].Controls[0]).Text;
     _urlconfig.DateDetailReplace = ((TextBox)row.Cells[19].Controls[0]).Text;
     _urlconfig.ContentDetail = ((TextBox)row.Cells[20].Controls[0]).Text;
     _urlconfig.ContentDetailReplace = ((TextBox)row.Cells[21].Controls[0]).Text;
     _urlconfig.ContentList = ((TextBox)row.Cells[22].Controls[0]).Text;
     _urlconfig.ContentListReplace = ((TextBox)row.Cells[23].Controls[0]).Text;
     _urlconfig.TagDetail = ((TextBox)row.Cells[24].Controls[0]).Text;
     _urlconfig.TagDetailReplace = ((TextBox)row.Cells[25].Controls[0]).Text;
     _urlconfig.SnatchDate = ((TextBox)row.Cells[26].Controls[0]).Text;
     _urlconfig.SnatchInterval = ((TextBox)row.Cells[27].Controls[0]).Text;
     _urlconfig.SnatchFrequency = ((TextBox)row.Cells[28].Controls[0]).Text;
 }
예제 #5
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            URLConfig _urlconfig = new URLConfig();
            string str_url = Server.MapPath("/") + "URLConfig.xml";
            UrlConfigManager configmager = new UrlConfigManager();
            GridViewRow row = GridView1.Rows[e.RowIndex];
            int currentRow = (int)row.DataItemIndex;
            DataSet dataset = new DataSet();
            dataset.ReadXml(str_url);
            DataRow dr;
            dr = dataset.Tables[0].Rows[currentRow];

            _urlconfig.Site = Encode(dr.ItemArray[1].ToString());
            _urlconfig.SiteUrl =Encode(dr.ItemArray[2].ToString());
            _urlconfig.Channel = Encode(dr.ItemArray[3].ToString());
            _urlconfig.Charset = Encode(dr.ItemArray[4].ToString());

            #region Ignore
            //_urlconfig.Site = Encode(dr["Site"].ToString());
            //_urlconfig.SiteUrl =Encode(dr["SiteUrl"].ToString());
            //_urlconfig.Channel = Encode(dr["Channel"].ToString());
            //_urlconfig.Charset = Encode(dr["Charset"].ToString());
            //_urlconfig.Proxy = Encode(dr["Proxy"].ToString());
            //_urlconfig.Port = Encode(dr["Port"].ToString());
            //_urlconfig.ListFormat = Encode(dr["ListFormat"].ToString());
            //_urlconfig.ListNextPage = Encode(dr["ListNextPage"].ToString());
            //_urlconfig.ListNextPageReplace = Encode(dr["ListNextPageReplace"].ToString());
            //_urlconfig.StartPageNo = Encode(dr["StartPageNo"].ToString());
            //_urlconfig.EndPageNo =Encode(dr["EndPageNo"].ToString());
            //_urlconfig.ListStep = Encode(dr["ListStep"].ToString());
            //_urlconfig.ListContent = Encode(dr["ListContent"].ToString());
            //_urlconfig.ListContentReplace = Encode(dr["ListContentReplace"].ToString());
            //_urlconfig.DetailLink = Encode(dr["DetailLink"].ToString());
            //_urlconfig.TitleDetail = Encode(dr["TitleDetail"].ToString());
            //_urlconfig.TitleDetailReplace = Encode(dr["TitleDetailReplace"].ToString());
            //_urlconfig.AuthorDetail = Encode(dr["AuthorDetail"].ToString());
            //_urlconfig.AuthorDetailReplace = Encode(dr["AuthorDetailReplace"].ToString());
            //_urlconfig.DateDetail = Encode(dr["DateDetail"].ToString());
            //_urlconfig.DateDetailReplace = Encode(dr["DateDetailReplace"].ToString());
            //_urlconfig.ContentDetail = Encode(dr["ContentDetail"].ToString());
            //_urlconfig.ContentDetailReplace =Encode(dr["ContentDetailReplace"].ToString());
            //_urlconfig.ContentList= Encode(dr["ContentList"].ToString());
            //_urlconfig.ContentListReplace =Encode(dr["ContentListReplace"].ToString());
            //_urlconfig.TagDetail=Encode(dr["TagDetail"].ToString());
            //_urlconfig.TagDetailReplace=Encode(dr["TagDetailReplace"].ToString());
            //_urlconfig.SnatchDate=Encode(dr["SnatchDate"].ToString());
            //_urlconfig.SnatchInterval=Encode(dr["SnatchInterval"].ToString());
            //_urlconfig.SnatchFrequency = Encode(dr["SnatchFrequency"].ToString());
            #endregion

            if (configmager.UpdateURLConfig(_urlconfig))
            {
                #region 配置urlconfig
                _urlconfig.Proxy = Encode(((TextBox)row.Cells[0].Controls[0]).Text);
                _urlconfig.Port = Encode(((TextBox)row.Cells[1].Controls[0]).Text);
                _urlconfig.Site = Encode(((TextBox)row.Cells[2].Controls[0]).Text);
                _urlconfig.SiteUrl = Encode(((TextBox)row.Cells[3].Controls[0]).Text);
                _urlconfig.Channel = Encode(((TextBox)row.Cells[4].Controls[0]).Text);
                _urlconfig.Charset = Encode(((TextBox)row.Cells[5].Controls[0]).Text);
                _urlconfig.ListFormat = Encode(((TextBox)row.Cells[6].Controls[0]).Text);
                _urlconfig.StartPageNo = Encode(((TextBox)row.Cells[7].Controls[0]).Text);
                _urlconfig.EndPageNo = Encode(((TextBox)row.Cells[8].Controls[0]).Text);
                _urlconfig.ListNextPage = Encode(((TextBox)row.Cells[9].Controls[0]).Text);
                _urlconfig.ListNextPageReplace = Encode(((TextBox)row.Cells[10].Controls[0]).Text);
                _urlconfig.ListStep = Encode(((TextBox)row.Cells[11].Controls[0]).Text);
                _urlconfig.ListContent = Encode(((TextBox)row.Cells[12].Controls[0]).Text);
                _urlconfig.ListContentReplace = Encode(((TextBox)row.Cells[13].Controls[0]).Text);
                _urlconfig.DetailLink = Encode(((TextBox)row.Cells[14].Controls[0]).Text);
                _urlconfig.TitleDetail = Encode(((TextBox)row.Cells[15].Controls[0]).Text);
                _urlconfig.TitleDetailReplace = Encode(((TextBox)row.Cells[16].Controls[0]).Text);
                _urlconfig.AuthorDetail = Encode(((TextBox)row.Cells[17].Controls[0]).Text);
                _urlconfig.AuthorDetailReplace = Encode(((TextBox)row.Cells[18].Controls[0]).Text);
                _urlconfig.DateDetail = Encode(((TextBox)row.Cells[19].Controls[0]).Text);
                _urlconfig.DateDetailReplace = Encode(((TextBox)row.Cells[20].Controls[0]).Text);
                _urlconfig.ContentDetail = Encode(((TextBox)row.Cells[21].Controls[0]).Text);
                _urlconfig.ContentDetailReplace = Encode(((TextBox)row.Cells[22].Controls[0]).Text);
                _urlconfig.ContentList = Encode(((TextBox)row.Cells[23].Controls[0]).Text);
                _urlconfig.ContentListReplace = Encode(((TextBox)row.Cells[24].Controls[0]).Text);
                _urlconfig.TagDetail = Encode(((TextBox)row.Cells[25].Controls[0]).Text);
                _urlconfig.TagDetailReplace = Encode(((TextBox)row.Cells[26].Controls[0]).Text);
                _urlconfig.SnatchDate = Encode(((TextBox)row.Cells[27].Controls[0]).Text);
                _urlconfig.SnatchInterval = Encode(((TextBox)row.Cells[28].Controls[0]).Text);
                _urlconfig.SnatchFrequency = Encode(((TextBox)row.Cells[29].Controls[0]).Text);

                #endregion

                //DataSet dataset = new DataSet();
                //dataset.ReadXml(str_url);
                //DataRow dr;
                //dr = dataset.Tables[0].Rows[currentRow];
                //dataset.Tables[0].Rows.Remove(dr);
                //dataset.WriteXml(str_url);

                configmager.UpdateURLConfig(_urlconfig);

                lbResult.Text = "更新成功";
            }
            else
            {
                lbResult.Text = "更新失败";
            }

            GridView1.EditIndex = -1;

            gvUrlConfig_Bind();
        }
예제 #6
0
        public URLConfig GetOneUrlConfig()
        {
            URLConfig _urlconfig = new URLConfig();

            XmlNodeList xnl = xmldoc.SelectSingleNode("/URLConfig").ChildNodes;

            foreach (XmlNode xnf in xnl)
            {
                _urlconfig.Site = Decode(xnf.Attributes["Name"].Value);
                _urlconfig.SiteUrl = Decode(xnf.Attributes["Url"].Value);
                _urlconfig.Channel = Decode(xnf.Attributes["Channel"].Value);
                _urlconfig.Charset = Decode(xnf.Attributes["Charset"].Value);

                XmlElement xe = (XmlElement)xnf;

                XmlNodeList xnf1 = xe.ChildNodes;
                foreach (XmlNode xn2 in xnf1)
                {
                    switch (xn2.Name)
                    {
                        case "Proxy":
                            _urlconfig.Proxy = Decode(xn2.Attributes["IP"].Value);
                            _urlconfig.Port = Decode(xn2.Attributes["Port"].Value);
                            break;
                        case "List":
                            _urlconfig.ListFormat = Decode(xn2.Attributes["Format"].Value);
                            _urlconfig.StartPageNo = Decode(xn2.Attributes["StartPageNo"].Value);
                            _urlconfig.EndPageNo = Decode(xn2.Attributes["EndPageNo"].Value);
                            _urlconfig.ListContent = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.ListContentReplace = Decode(xn2.Attributes["Replace"].Value);
                            _urlconfig.DetailLink = Decode(xn2.Attributes["DetailLink"].Value);
                            _urlconfig.ListStep = Decode(xn2.Attributes["ListStep"].Value);
                            break;
                        case "ListNextPage":
                            _urlconfig.ListNextPage = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.ListNextPageReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Title":
                            _urlconfig.TitleDetail = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.TitleDetailReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Author":
                            _urlconfig.AuthorDetail = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.AuthorDetailReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Date":
                            _urlconfig.DateDetail = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.DateDetailReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Content":
                            _urlconfig.ContentDetail = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.ContentDetailReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "ContentList":
                            _urlconfig.ContentList = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.ContentListReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Tag":
                            _urlconfig.TagDetail = Decode(xn2.Attributes["Pattern"].Value);
                            _urlconfig.TagDetailReplace = Decode(xn2.Attributes["Replace"].Value);
                            break;
                        case "Snatch":
                            _urlconfig.SnatchDate = Decode(xn2.Attributes["SnatchDate"].Value);
                            _urlconfig.SnatchInterval = Decode(xn2.Attributes["SnatchInterval"].Value);
                            _urlconfig.SnatchFrequency = Decode(xn2.Attributes["SnatchFrequency"].Value);
                            break;
                    }
                }
            }

            return _urlconfig;
        }
예제 #7
0
        /// <summary>
        /// 更新配置文件
        /// </summary>
        /// <param name="urlconfig"></param>
        /// <param name="str_path"></param>
        public bool UpdateURLConfig(URLConfig urlconfig)
        {
            bool flag = false;
            try
            {

                if (CheckOperation(urlconfig).ToString() == "EDIT")
                {
                    flag = RemoveChild(urlconfig);

                    if (flag)
                        return flag;
                }

                #region 添加配置文件
                XmlElement xe;
                // 根结点
                XmlElement xep = xmldoc.CreateElement("Site");
                xep.SetAttribute("Name", urlconfig.Site);
                xep.SetAttribute("Url", urlconfig.SiteUrl);
                xep.SetAttribute("Channel", urlconfig.Channel);
                xep.SetAttribute("Charset", urlconfig.Charset);

                // 代理服务器设置的节点
                // 标题结点
                xe = xmldoc.CreateElement("Proxy");
                xe.SetAttribute("IP", urlconfig.Proxy);
                xe.SetAttribute("Port", urlconfig.Port);
                xep.AppendChild(xe);

                // 列表节点
                xe = xmldoc.CreateElement("List");
                xe.SetAttribute("Format", urlconfig.ListFormat);
                xe.SetAttribute("StartPageNo", urlconfig.StartPageNo);
                xe.SetAttribute("EndPageNo", urlconfig.EndPageNo);
                xe.SetAttribute("Pattern", urlconfig.ListContent);
                xe.SetAttribute("Replace", urlconfig.ListContentReplace);
                xe.SetAttribute("DetailLink", urlconfig.DetailLink);
                xe.SetAttribute("ListStep", urlconfig.ListStep);
                xep.AppendChild(xe);
                //列表下一页节点
                xe = xmldoc.CreateElement("ListNextPage");
                xe.SetAttribute("Pattern", urlconfig.ListNextPage);
                xe.SetAttribute("Replace", urlconfig.ListNextPageReplace);
                xep.AppendChild(xe);

                // 标题结点
                xe = xmldoc.CreateElement("Title");
                xe.SetAttribute("Pattern", urlconfig.TitleDetail);
                xe.SetAttribute("Replace", urlconfig.TitleDetailReplace);
                xep.AppendChild(xe);

                // 作者节点
                xe = xmldoc.CreateElement("Author");
                xe.SetAttribute("Pattern", urlconfig.AuthorDetail);
                xe.SetAttribute("Replace", urlconfig.AuthorDetailReplace);
                xep.AppendChild(xe);

                // 发表日期节点
                xe = xmldoc.CreateElement("Date");
                xe.SetAttribute("Pattern", urlconfig.DateDetail);
                xe.SetAttribute("Replace", urlconfig.DateDetailReplace);
                xep.AppendChild(xe);

                // 内容节点
                xe = xmldoc.CreateElement("Content");
                xe.SetAttribute("Pattern", urlconfig.ContentDetail);
                xe.SetAttribute("Replace", urlconfig.ContentDetailReplace);
                xep.AppendChild(xe);

                // 内容分页列表节点
                xe = xmldoc.CreateElement("ContentList");
                xe.SetAttribute("Pattern", urlconfig.ContentList);
                xe.SetAttribute("Replace", urlconfig.ContentListReplace);
                xep.AppendChild(xe);

                // Tag节点
                xe = xmldoc.CreateElement("Tag");
                xe.SetAttribute("Pattern", urlconfig.TagDetail);
                xe.SetAttribute("Replace", urlconfig.TagDetailReplace);
                xep.AppendChild(xe);

                // 抓取配置节点
                xe = xmldoc.CreateElement("Snatch");
                xe.SetAttribute("SnatchDate", urlconfig.SnatchDate);
                xe.SetAttribute("SnatchInterval", urlconfig.SnatchInterval);
                xe.SetAttribute("SnatchFrequency", urlconfig.SnatchFrequency);
                xep.AppendChild(xe);

                root.AppendChild(xep);

                xmldoc.Save(str_path);
                #endregion
            }
            catch (Exception ex)
            {
                return false;
            }

            return true;
        }
예제 #8
0
        /// <summary>
        /// 删除指定的节点
        /// </summary>
        /// <param name="urlconfig"></param>
        /// <returns></returns>
        public bool RemoveChildNode(URLConfig urlconfig)
        {
            bool flag = false;

            try
            {
                string xpath = string.Format(str_format, urlconfig.Site, urlconfig.SiteUrl, urlconfig.Channel, urlconfig.Charset);
                XmlNode xn = xmldoc.SelectSingleNode(xpath);

                root.RemoveChild(xn);
                xmldoc.Save(str_path);
                flag = true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return flag;
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            str_path = Server.MapPath("~/URLConfig.xml");

            VerfyUser();

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["action"] == null || Request.QueryString["action"].ToString() == "")
                {
                    return;
                }

                if (Request.QueryString["site"] == null || Request.QueryString["site"].ToString() == "")
                {
                    return;
                }

                if (Request.QueryString["siteurl"] == null || Request.QueryString["siteurl"].ToString() == "")
                {
                    return;
                }

                if (Request.QueryString["channel"] == null || Request.QueryString["channel"].ToString() == "")
                {
                    return;
                }

                if (Request.QueryString["charset"] == null || Request.QueryString["charset"].ToString() == "")
                {
                    return;
                }

                URLConfig uc = new URLConfig();

                uc.Site = Encode(Request.QueryString["site"].ToString().Trim());

                uc.SiteUrl = Encode(Request.QueryString["siteurl"].ToString().Trim());

                uc.Channel = Encode(Request.QueryString["channel"].ToString().Trim());

                uc.Charset = Encode(Request.QueryString["charset"].ToString().Trim());

                if (Request.QueryString["action"].ToString() == "update")
                {
                    txt_site.Text = uc.Site;
                    txt_siteurl.Text = uc.SiteUrl;
                    txt_channel.Text = uc.Channel;
                    txt_charset.Text = uc.Charset;

                    UrlConfigManager ucm = new UrlConfigManager();

                    IList<URLConfig> configlist = ucm.GetUrlConfig();

                    foreach(URLConfig urlconfig in configlist)
                    {
                        if ((urlconfig.Site == uc.Site) && (urlconfig.SiteUrl == uc.SiteUrl) && (urlconfig.Channel == uc.Channel) && (urlconfig.Charset == uc.Charset))
                        {
                            #region
                            txt_proxy.Text = Encode(urlconfig.Proxy);
                            txt_port.Text = Encode(urlconfig.Port);
                            txt_listformat.Text = Encode(urlconfig.ListFormat);
                            txt_listnextpage.Text = Encode(urlconfig.ListNextPage);
                            txt_listnextpagereplace.Text = Encode(urlconfig.ListNextPageReplace);
                            txt_startno.Text = Encode(urlconfig.StartPageNo);
                            txt_endno.Text = Encode(urlconfig.EndPageNo);
                            txt_liststep.Text = Encode(urlconfig.ListStep);
                            txt_listcontent.Text = Encode(urlconfig.ListContent);
                            txt_listcontentreplace.Text = Encode(urlconfig.ListContentReplace);
                            txt_detaillink.Text = Encode(urlconfig.DetailLink);
                            txt_titledetail.Text = Encode(urlconfig.TitleDetail);
                            txt_titledetailreplace.Text = Encode(urlconfig.TitleDetailReplace);
                            txt_authordetail.Text = Encode(urlconfig.AuthorDetail);
                            txt_authordetailreplace.Text = Encode(urlconfig.AuthorDetailReplace);
                            txt_datedetail.Text = Encode(urlconfig.DateDetail);
                            txt_datedetailreplace.Text = Encode(urlconfig.DateDetailReplace);
                            txt_contentdetail.Text = Encode(urlconfig.ContentDetail);
                            txt_contentdetailreplace.Text = Encode(urlconfig.ContentDetailReplace);
                            txt_contentlist.Text = Encode(urlconfig.ContentList);
                            txt_contentlistreplace.Text = Encode(urlconfig.ContentListReplace);
                            txt_tagdetail.Text = Encode(urlconfig.TagDetail);
                            txt_tagdetailreplace.Text = Encode(urlconfig.TagDetailReplace);
                            txt_snatchdate.Text = Encode(urlconfig.SnatchDate);
                            txt_snatchinterval.Text = Encode(urlconfig.SnatchInterval);
                            txt_snatchfrequency.Text = Encode(urlconfig.SnatchFrequency);
                            #endregion
                        }
                    }

                }
            }
        }
예제 #10
0
        private void UpdateConfig()
        {
            #region 验证4个必填选项和action
            if (Request.QueryString["action"] == null || Request.QueryString["action"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["site"] == null || Request.QueryString["site"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["siteurl"] == null || Request.QueryString["siteurl"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["channel"] == null || Request.QueryString["channel"].ToString() == "")
            {
                return;
            }

            if (Request.QueryString["charset"] == null || Request.QueryString["charset"].ToString() == "")
            {
                return;
            }

            URLConfig urlconfig = new URLConfig();
            UrlConfigManager ucm = new UrlConfigManager();

            urlconfig.Site = Encode(Request.QueryString["site"].ToString().Trim());

            urlconfig.SiteUrl = Encode(Request.QueryString["siteurl"].ToString().Trim());

            urlconfig.Channel = Encode(Request.QueryString["channel"].ToString().Trim());

            urlconfig.Charset = Encode(Request.QueryString["charset"].ToString().Trim());

            ucm.RemoveChildNode(urlconfig);

            xmldoc = new XmlDocument();
            xmldoc.Load(str_path);

            root = xmldoc.SelectSingleNode("/URLConfig");

            URLConfig uc = new URLConfig();
            uc.Site = txt_site.Text ;
            uc.SiteUrl = txt_siteurl.Text;
            uc.Channel =  txt_channel.Text;
            uc.Charset =  txt_charset.Text ;

            uc.Proxy = Encode(txt_proxy.Text);
            uc.Port = Encode(txt_port.Text);
            uc.ListFormat = Encode(txt_listformat.Text);
            uc.ListNextPage = Encode(txt_listnextpage.Text);
            uc.ListNextPageReplace = Encode(txt_listnextpagereplace.Text);
            uc.StartPageNo = Encode(txt_startno.Text);
            uc.EndPageNo = Encode(txt_endno.Text);
            uc.ListStep = Encode(txt_liststep.Text);
            uc.ListContent = Encode(txt_listcontent.Text);
            uc.ListContentReplace = Encode(txt_listcontentreplace.Text);
            uc.DetailLink = Encode(txt_detaillink.Text);
            uc.TitleDetail = Encode(txt_titledetail.Text);
            uc.TitleDetailReplace = Encode(txt_titledetailreplace.Text);
            uc.AuthorDetail = Encode(txt_authordetail.Text);
            uc.AuthorDetailReplace = Encode(txt_authordetailreplace.Text);
            uc.DateDetail = Encode(txt_datedetail.Text);
            uc.DateDetailReplace = Encode(txt_datedetailreplace.Text);
            uc.ContentDetail = Encode(txt_contentdetail.Text);
            uc.ContentDetailReplace = Encode(txt_contentdetailreplace.Text);
            uc.ContentList = Encode(txt_contentlist.Text);
            uc.ContentListReplace = Encode(txt_contentlistreplace.Text);
            uc.TagDetail = Encode(txt_tagdetail.Text);
            uc.TagDetailReplace = Encode(txt_tagdetailreplace.Text);
            uc.SnatchDate = Encode(txt_snatchdate.Text);
            uc.SnatchInterval = Encode(txt_snatchinterval.Text);
            uc.SnatchFrequency = Encode(txt_snatchfrequency.Text);
            ucm.UpdateURLConfig(uc);
            #endregion
        }