Ejemplo n.º 1
0
        private void TestPaing(XmlDocument ixml)
        {
            string           str5;
            string           absoluteAddress = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           wordsBegin      = (ixml.DocumentElement.SelectSingleNode("//paingBegin") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//paingBegin").InnerText;
            string           wordsEnd        = (ixml.DocumentElement.SelectSingleNode("//paingEnd") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//paingEnd").InnerText;
            string           code            = (ixml.DocumentElement.SelectSingleNode("//testContent") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//testContent").InnerText;
            CollectionCommon common          = new CollectionCommon();

            if (!string.IsNullOrEmpty(common.GetPaing(code, wordsBegin, wordsEnd)))
            {
                str5 = common.ConvertToAbsluteUrl(common.GetPaing(code, wordsBegin, wordsEnd), absoluteAddress);
            }
            else
            {
                str5 = "没有截取到下一页URL,请加载源代码重新设置下。";
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", str5);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
Ejemplo n.º 2
0
        private void TestLink(XmlDocument ixml)
        {
            string           str        = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           wordsBegin = (ixml.DocumentElement.SelectSingleNode("//linkBegin") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//linkBegin").InnerText;
            string           wordsEnd   = (ixml.DocumentElement.SelectSingleNode("//linkEnd") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//linkEnd").InnerText;
            string           code       = (ixml.DocumentElement.SelectSingleNode("//testContent") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//testContent").InnerText;
            CollectionCommon common     = new CollectionCommon();
            ArrayList        list       = common.GetArray(code, wordsBegin, wordsEnd);
            StringBuilder    builder    = new StringBuilder();

            for (int i = 0; i < list.Count; i++)
            {
                builder.Append(common.ConvertToAbsluteUrl(list[i].ToString(), str.ToString()) + "\r\n");
            }
            string str5 = builder.ToString();

            if (string.IsNullOrEmpty(str5))
            {
                str5 = "没有截取到链接列表,请加载源代码重新设置下。";
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", str5);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
Ejemplo n.º 3
0
        private void TestList(XmlDocument ixml)
        {
            string           uriString = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           coding    = (ixml.DocumentElement.SelectSingleNode("//codeType") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//codeType").InnerText.Trim();
            string           startStr  = (ixml.DocumentElement.SelectSingleNode("//listBegin") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//listBegin").InnerText;
            string           overStr   = (ixml.DocumentElement.SelectSingleNode("//listEnd") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//listEnd").InnerText;
            CollectionCommon common    = new CollectionCommon();
            Uri    url      = new Uri(uriString);
            string httpPage = common.GetHttpPage(url, coding);
            string str6     = common.GetInterceptionString(httpPage, startStr, overStr);

            if (string.IsNullOrEmpty(str6))
            {
                str6 = "没有截取到列表页,请加载源代码重新设置下。";
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", str6);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
Ejemplo n.º 4
0
        private void TestShowContent(XmlDocument ixml)
        {
            string           uriString = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           coding    = (ixml.DocumentElement.SelectSingleNode("//codeType") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//codeType").InnerText.Trim();
            CollectionCommon common    = new CollectionCommon();
            Uri    url      = new Uri(uriString);
            string httpPage = common.GetHttpPage(url, coding);

            if (string.IsNullOrEmpty(httpPage))
            {
                httpPage = "没有获取到内容页,请检查内容页URL是否正确,如果不正确请返回列表页设置重新设置。";
            }
            else
            {
                this.Session["ShowCode"] = httpPage;
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", httpPage);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
        protected void BtnField_Click(object sender, EventArgs e)
        {
            CollectionCommon common = new CollectionCommon();
            Uri    url      = new Uri(this.TxtListAddress.Text);
            string coding   = this.CodingType(this.RadlCodeType.SelectedValue);
            string httpPage = common.GetHttpPage(url, coding);
            string str3     = common.GetInterceptionString(httpPage, this.TxtFieldBegin.Text, this.TxtFieldEnd.Text);

            if (!string.IsNullOrEmpty(str3))
            {
                if (this.ChkDesignated.Checked)
                {
                    this.TxtShowCode.Text = this.TxtDesignated.Text;
                }
                else
                {
                    if (this.RadContent.Checked)
                    {
                        this.TxtShowCode.Text = str3;
                    }
                    if (this.RadKeyWord.Checked)
                    {
                        this.TxtShowCode.Text = CollectionCommon.CreateKeyWord(str3, DataConverter.CLng(this.TxtKeyWord.Text));
                    }
                    if (this.RadDate.Checked)
                    {
                        this.TxtShowCode.Text = DataConverter.CDate(str3).ToString();
                    }
                }
            }
        }
        protected void BtnTestList_Click(object sender, EventArgs e)
        {
            CollectionCommon common      = new CollectionCommon();
            string           contentCode = this.GetContentCode();

            this.TxtShowCode.Text = common.GetInterceptionString(contentCode, this.TxtListBegin.Text, this.TxtListEnd.Text);
        }
Ejemplo n.º 7
0
        private static string FilterRule(int filterRuleId, CollectionCommon collectionCommon, string testContent)
        {
            if (filterRuleId > 0)
            {
                CollectionFilterRuleInfo infoById = CollectionFilterRules.GetInfoById(filterRuleId);
                if (!infoById.IsNull)
                {
                    switch (infoById.FilterType)
                    {
                    case 1:
                        if (!string.IsNullOrEmpty(infoById.BeginCode))
                        {
                            testContent = testContent.Replace(infoById.BeginCode, infoById.Replace);
                        }
                        return(testContent);

                    case 2:
                    {
                        string str = collectionCommon.GetInterceptionString(testContent, infoById.BeginCode, infoById.EndCode, true, true);
                        if (!string.IsNullOrEmpty(str))
                        {
                            testContent = testContent.Replace(str, "");
                        }
                        return(testContent);
                    }
                    }
                }
            }
            return(testContent);
        }
        private string GetContentCode()
        {
            CollectionCommon common = new CollectionCommon();
            Uri    url    = new Uri(this.TxtListAddress.Text);
            string coding = this.CodingType(this.RadlCodeType.SelectedValue);

            return(common.GetHttpPage(url, coding));
        }
        protected void BtnPaingType1_Click(object sender, EventArgs e)
        {
            CollectionCommon common = new CollectionCommon();
            Uri    url      = new Uri(this.TxtListAddress.Text);
            string coding   = this.CodingType(this.RadlCodeType.SelectedValue);
            string httpPage = common.GetHttpPage(url, coding);

            this.TxtShowCode.Text = common.ConvertToAbsluteUrl(common.GetPaing(httpPage, this.TxtPaingBegin.Text, this.TxtPaingEnd.Text), url.ToString());
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = BasePage.RequestInt32("ItemId");

            if (id <= 0)
            {
                AdminPage.WriteErrMsg("<li>ItemID不存在!");
            }
            CollectionItemInfo infoById = CollectionItem.GetInfoById(id);

            if (infoById.IsNull)
            {
                AdminPage.WriteErrMsg("<li>当前采集项目不存在!");
            }
            this.LblItemName.Text = infoById.ItemName;
            this.m_itemId         = infoById.ItemId;
            this.m_ModelId        = infoById.ModelId;
            this.m_NodeId         = infoById.NodeId;
            string str = BasePage.RequestString("Action", "Add");

            if (!base.IsPostBack)
            {
                this.RptModelList.DataSource = Field.GetFieldList(infoById.ModelId, false);
                this.RptModelList.DataBind();
                if (str == "Modify")
                {
                    this.BtnCancel1.Visible = true;
                }
                this.SmpNavigator.CurrentNode = string.Concat(new object[] { "<a title=\"采集项目设置\" href=\"ConfigStep1.aspx?Action=Modify&ItemId=", this.m_itemId, "&ModelId=", this.m_ModelId.ToString(), "&NodeId=", this.m_NodeId.ToString(), "\">采集项目设置</a> >> <a title=\"列表页采集设置\" href=\"ConfigStep2.aspx?Action=Modify&amp;ItemID=", id.ToString(), "\">列表页采集设置</a> >> <span style='color:red;'>内容页采集设置</span>" });
            }
            this.HdnAction.Value = str;
            CollectionCommon common = new CollectionCommon();
            Uri    url      = new Uri(infoById.Url);
            string httpPage = common.GetHttpPage(url, infoById.CodeType);
            CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId);

            if (info2.IsNull)
            {
                AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的列表规则不存在!");
            }
            string    code = common.GetInterceptionString(httpPage, info2.ListBeginCode, info2.ListEndCode);
            ArrayList list = common.GetArray(code, info2.LinkBeginCode, info2.LinkEndCode);

            if (list.Count < 1)
            {
                AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的链接规则设置错误无法捕捉到链接组!");
            }
            Uri uri2 = new Uri(common.ConvertToAbsluteUrl(list[0].ToString(), infoById.Url));

            this.Session["ShowCode"] = common.GetHttpPage(uri2, infoById.CodeType);
        }
        protected void BtnReplace2_Click(object sender, EventArgs e)
        {
            string contentCode = this.GetContentCode();

            contentCode = this.FilterItem(contentCode);
            string text = this.TxtReplace.Text;

            if (string.IsNullOrEmpty(this.TxtReplace.Text))
            {
                text = "";
            }
            string oldValue = new CollectionCommon().GetInterceptionString(contentCode, this.TxtFilterBegin.Text, this.TxtFilterEnd.Text, true, true);

            this.TxtShowCode.Text = contentCode.Replace(oldValue, text);
        }
        protected void BtnTestLink_Click(object sender, EventArgs e)
        {
            CollectionCommon common = new CollectionCommon();
            Uri           url       = new Uri(this.TxtListAddress.Text);
            string        coding    = this.CodingType(this.RadlCodeType.SelectedValue);
            string        httpPage  = common.GetHttpPage(url, coding);
            string        code      = common.GetInterceptionString(httpPage, this.TxtListBegin.Text, this.TxtListEnd.Text);
            ArrayList     list      = common.GetArray(code, this.TxtLinkBegin.Text, this.TxtLinkEnd.Text);
            StringBuilder builder   = new StringBuilder();

            for (int i = 0; i < list.Count; i++)
            {
                builder.Append(common.ConvertToAbsluteUrl(list[i].ToString(), url.ToString()) + "\r\n");
            }
            this.TxtShowCode.Text = builder.ToString();
        }
Ejemplo n.º 13
0
 private static string CommonFilter(string filterRuleId, string filter, CollectionCommon collectionCommon, string testContent)
 {
     if (filterRuleId.IndexOf(',') > 0)
     {
         foreach (string str in filterRuleId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
         {
             testContent = FilterRule(DataConverter.CLng(str), collectionCommon, testContent);
         }
     }
     else
     {
         testContent = FilterRule(DataConverter.CLng(filterRuleId), collectionCommon, testContent);
     }
     testContent = StringHelper.FilterScript(testContent, filter);
     return(testContent);
 }
Ejemplo n.º 14
0
 protected void BtnReplace_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.TxtShowCode.Text))
     {
         AdminPage.WriteErrMsg("测试文本框不能为空!");
     }
     if (this.RadFilterType1.Checked)
     {
         this.TxtShowCode.Text = this.TxtShowCode.Text.Replace(this.TxtFilterBegin.Text, this.TxtReplace.Text);
     }
     else
     {
         string str = new CollectionCommon().GetInterceptionString(this.TxtShowCode.Text, this.TxtFilterBegin.Text, this.TxtFilterEnd.Text, true, true);
         if (!string.IsNullOrEmpty(str))
         {
             this.TxtShowCode.Text = this.TxtShowCode.Text.Replace(str, this.TxtReplace.Text);
         }
         else
         {
             this.TxtShowCode.Text = this.TxtReplace.Text;
         }
     }
 }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_ItemId    = BasePage.RequestInt32("ItemId");
            this.m_FieldName = BasePage.RequestString("FieldName");
            this.m_FieldType = BasePage.RequestString("FieldType");
            string str = BasePage.RequestString("FieldAlias");

            if (this.m_ItemId <= 0)
            {
                AdminPage.WriteErrMsg("<li>ItemID不存在!");
            }
            if (string.IsNullOrEmpty(this.m_FieldName))
            {
                AdminPage.WriteErrMsg("<li>字段名称不存在!");
            }
            if (string.IsNullOrEmpty(this.m_FieldType))
            {
                AdminPage.WriteErrMsg("<li>字段类型不能为空!");
            }
            this.LblFieldName.Text = str + "[" + this.m_FieldType + "]";
            FieldType none = FieldType.None;

            if (Enum.IsDefined(typeof(FieldType), this.m_FieldType))
            {
                none = (FieldType)Enum.Parse(typeof(FieldType), this.m_FieldType);
            }
            else
            {
                AdminPage.WriteErrMsg("<li>不是系统字段类型!");
            }
            CollectionItemInfo infoById = CollectionItem.GetInfoById(this.m_ItemId);

            if (infoById.IsNull)
            {
                AdminPage.WriteErrMsg("<li>当前采集项目不存在!");
            }
            CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId);

            if (info2.IsNull)
            {
                AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的列表规则不存在!");
            }
            CollectionCommon common = new CollectionCommon();
            Uri    url      = new Uri(infoById.Url);
            string httpPage = common.GetHttpPage(url, infoById.CodeType);
            string code     = common.GetInterceptionString(httpPage, info2.ListBeginCode, info2.ListEndCode);

            try
            {
                ArrayList list = common.GetArray(code, info2.LinkBeginCode, info2.LinkEndCode);
                if ((this.Session["ShowCode"] != null) && !string.IsNullOrEmpty(this.Session["ShowCode"].ToString()))
                {
                    this.TxtShowCode.Text = this.Session["ShowCode"].ToString();
                }
                else
                {
                    Uri uri2 = new Uri(common.ConvertToAbsluteUrl(list[0].ToString(), infoById.Url));
                    this.TxtShowCode.Text    = common.GetHttpPage(uri2, infoById.CodeType);
                    this.Session["ShowCode"] = this.TxtShowCode.Text;
                }
                this.HdnTestContent.Value = this.TxtShowCode.Text;
                StringBuilder builder = new StringBuilder();
                builder.Append("<select name='ArrContentUrl' onchange=\"testContentLink(this.options[this.selectedIndex].value)\">");
                string str4 = "";
                for (int i = 0; i < list.Count; i++)
                {
                    str4 = common.ConvertToAbsluteUrl(list[i].ToString(), url.ToString());
                    builder.Append(" <option value='" + str4 + "'>" + str4 + "</option>");
                }
                this.m_Url = common.ConvertToAbsluteUrl(list[0].ToString(), url.ToString());
                builder.Append("</select>&nbsp;&nbsp;<a href='" + this.m_Url + "' id='contentLink' target='_blank' >查看原始网页</a>");
                this.LblArrContentUrl.Text = builder.ToString();
                this.m_CodeType            = infoById.CodeType;
            }
            catch (ArgumentOutOfRangeException exception)
            {
                AdminPage.WriteErrMsg("<li>" + exception.Message + "</li>");
            }
            this.ListFilterRuleID.Items.Add(new ListItem("不设置过滤", "0"));
            this.ListFilterRuleID.AppendDataBoundItems = true;
            this.ListFilterRuleID.DataSource           = CollectionFilterRules.GetList(0, 0);
            this.ListFilterRuleID.DataBind();
            if (!base.IsPostBack)
            {
                CollectionFieldRuleInfo info3 = CollectionFieldRules.GetInfoById(infoById.ItemId, this.m_FieldName);
                if (!info3.IsNull)
                {
                    this.TxtFieldBegin.Text = info3.BeginCode;
                    this.TxtFieldEnd.Text   = info3.EndCode;
                    this.TxtKeyWord.Text    = info3.SpecialSetting;
                    this.SavePhoto.Checked  = DataConverter.CBoolean(info3.SpecialSetting);
                    foreach (ListItem item in this.ListFilterRuleID.Items)
                    {
                        if (StringHelper.FoundCharInArr(info3.FilterRuleId, item.Value))
                        {
                            item.Selected = true;
                        }
                    }
                    foreach (ListItem item2 in this.ListFilterSelect.Items)
                    {
                        if (StringHelper.FoundCharInArr(info3.PrivateFilter, item2.Value))
                        {
                            item2.Selected = true;
                        }
                    }
                }
                FieldType type2 = none;
                if (type2 == FieldType.KeywordType)
                {
                    this.LblKeyWord.Visible  = true;
                    this.TxtKeyWord.Visible  = true;
                    this.ValeKeyWord.Visible = true;
                }
                else if (type2 == FieldType.ContentType)
                {
                    this.TabTitle1.Visible = true;
                    this.SavePhoto.Visible = true;
                    this.RadlPaingType.Attributes.Add("onclick", "javascript:ListPaing(0);");
                    this.RadlPaingType1.Attributes.Add("onclick", "javascript:ListPaing(1);");
                    this.RadlPaingType2.Attributes.Add("onclick", "javascript:ListPaing(2);");
                    this.RadlPaingType3.Attributes.Add("onclick", "javascript:ListPaing(3);");
                    this.RadlPaingType4.Attributes.Add("onclick", "javascript:ListPaing(4);");
                    if (info3.UsePaging)
                    {
                        CollectionPagingRuleInfo info4 = CollectionPagingRules.GetInfoById(infoById.ItemId, 1);
                        this.TxtPaingBegin.Text = info4.PagingBeginCode;
                        this.TxtPaingEnd.Text   = info4.PagingEndCode;
                        switch (info4.PagingType)
                        {
                        case 0:
                            this.RadlPaingType.Checked = true;
                            break;

                        case 1:
                            this.RadlPaingType1.Checked = true;
                            break;

                        case 2:
                            this.RadlPaingType2.Checked = true;
                            break;

                        case 3:
                            this.RadlPaingType3.Checked = true;
                            break;

                        case 4:
                            this.RadlPaingType4.Checked = true;
                            break;

                        default:
                            this.RadlPaingType.Checked = true;
                            break;
                        }
                        this.TxtPaingAddress.Text = info4.DesignatedUrl;
                        this.TxtScopeBegin.Text   = info4.ScopeBegin.ToString();
                        this.TxtScopeEnd.Text     = info4.ScopeEnd.ToString();
                        this.TxtListPaing.Text    = info4.PagingUrlList;
                        this.TxtPaingBegin2.Text  = info4.PagingBeginCode;
                        this.TxtPaingEnd2.Text    = info4.PagingEndCode;
                        this.TxtLinkBegin2.Text   = info4.LinkBeginCode;
                        this.TxtLinkEnd2.Text     = info4.LinkEndCode;
                        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Init", "<script type='text/javascript'>ListPaing(" + DataConverter.CLng(info4.PagingType).ToString() + ");</script>");
                    }
                }
                this.ShowExclosionList(info3.ExclosionId, none);
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = BasePage.RequestInt32("ItemId");

            if (id <= 0)
            {
                AdminPage.WriteErrMsg("<li>ItemID不存在!</li>");
            }
            CollectionItemInfo infoById = CollectionItem.GetInfoById(id);

            if (infoById.IsNull)
            {
                AdminPage.WriteErrMsg("<li>当前采集项目不存在!</li>");
            }
            this.m_CodeType       = infoById.CodeType;
            this.m_Url            = infoById.Url;
            this.m_itemId         = infoById.ItemId;
            this.m_ModelId        = infoById.ModelId;
            this.m_NodeId         = infoById.NodeId;
            this.LblItemName.Text = infoById.ItemName;
            CollectionCommon common = new CollectionCommon();
            Uri url = new Uri(this.m_Url);

            this.TxtShowCode.Text     = common.GetHttpPage(url, this.m_CodeType);
            this.HdnTestContent.Value = this.TxtShowCode.Text;
            this.LblLink.Text         = " <a href='" + this.m_Url + "' target='_blank'>查看原始网页</a>";
            string str = BasePage.RequestString("Action", "Add");

            if (!base.IsPostBack)
            {
                this.RadlPaingType.Attributes.Add("onclick", "javascript:ListPaing(0);");
                this.RadlPaingType1.Attributes.Add("onclick", "javascript:ListPaing(1);");
                this.RadlPaingType2.Attributes.Add("onclick", "javascript:ListPaing(2);");
                this.RadlPaingType3.Attributes.Add("onclick", "javascript:ListPaing(3);");
                this.RadlPaingType4.Attributes.Add("onclick", "javascript:ListPaing(4);");
                if (str == "Modify")
                {
                    CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId);
                    if (!info2.IsNull)
                    {
                        this.TxtListBegin.Text = info2.ListBeginCode;
                        this.TxtListEnd.Text   = info2.ListEndCode;
                        this.TxtLinkBegin.Text = info2.LinkBeginCode;
                        this.TxtLinkEnd.Text   = info2.LinkEndCode;
                        if (info2.UsePaging)
                        {
                            CollectionPagingRuleInfo info3 = CollectionPagingRules.GetInfoById(infoById.ItemId, 0);
                            this.TxtPaingBegin.Text = info3.PagingBeginCode;
                            this.TxtPaingEnd.Text   = info3.PagingEndCode;
                            switch (info3.PagingType)
                            {
                            case 0:
                                this.RadlPaingType.Checked = true;
                                break;

                            case 1:
                                this.RadlPaingType1.Checked = true;
                                break;

                            case 2:
                                this.RadlPaingType2.Checked = true;
                                break;

                            case 3:
                                this.RadlPaingType3.Checked = true;
                                break;

                            case 4:
                                this.RadlPaingType4.Checked = true;
                                break;

                            default:
                                this.RadlPaingType.Checked = true;
                                break;
                            }
                            this.TxtPaingAddress.Text = info3.DesignatedUrl;
                            this.TxtScopeBegin.Text   = info3.ScopeBegin.ToString();
                            this.TxtScopeEnd.Text     = info3.ScopeEnd.ToString();
                            this.TxtListPaing.Text    = info3.PagingUrlList;
                            this.TxtPaingBegin2.Text  = info3.PagingBeginCode;
                            this.TxtPaingEnd2.Text    = info3.PagingEndCode;
                            this.TxtLinkBegin2.Text   = info3.LinkBeginCode;
                            this.TxtLinkEnd2.Text     = info3.LinkEndCode;
                            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Init", "<script type='text/javascript'>ListPaing(" + DataConverter.CLng(info3.PagingType).ToString() + ");</script>");
                        }
                        this.BtnCancel1.Visible = true;
                    }
                }
            }
            this.SmpNavigator.CurrentNode = string.Concat(new object[] { "<a title=\"采集项目设置\" href=\"ConfigStep1.aspx?Action=Modify&ItemId=", this.m_itemId, "&ModelId=", this.m_ModelId.ToString(), "&NodeId=", this.m_NodeId.ToString(), "\">采集项目设置</a> >> <span style='color:red;'>列表页采集设置</span> >> <a title=\"内容页采集设置\" href=\"ConfigStep3.aspx?Action=Modify&amp;ItemID=", id.ToString(), "\">内容页采集设置</a>" });
            this.HdnAction.Value          = str;
        }
Ejemplo n.º 17
0
        private void TestField(XmlDocument ixml)
        {
            string           uriString        = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           coding           = (ixml.DocumentElement.SelectSingleNode("//codeType") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//codeType").InnerText.Trim();
            string           startStr         = (ixml.DocumentElement.SelectSingleNode("//listBegin") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//listBegin").InnerText;
            string           overStr          = (ixml.DocumentElement.SelectSingleNode("//listEnd") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//listEnd").InnerText;
            string           input            = (ixml.DocumentElement.SelectSingleNode("//keyword") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//keyword").InnerText.Trim();
            string           filterRuleId     = (ixml.DocumentElement.SelectSingleNode("//filterRuleId") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//filterRuleId").InnerText.Trim();
            string           filter           = (ixml.DocumentElement.SelectSingleNode("//filter") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//filter").InnerText.Trim();
            string           str8             = (ixml.DocumentElement.SelectSingleNode("//fieldType") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//fieldType").InnerText.Trim();
            CollectionCommon collectionCommon = new CollectionCommon();
            Uri       url         = new Uri(uriString);
            string    httpPage    = collectionCommon.GetHttpPage(url, coding);
            string    testContent = collectionCommon.GetInterceptionString(httpPage, startStr, overStr);
            FieldType none        = FieldType.None;

            if (Enum.IsDefined(typeof(FieldType), str8))
            {
                none = (FieldType)Enum.Parse(typeof(FieldType), str8);
            }
            switch (none)
            {
            case FieldType.TextType:
            case FieldType.ListBoxType:
            case FieldType.LookType:
            case FieldType.CountType:
            case FieldType.ColorType:
            case FieldType.TemplateType:
            case FieldType.AuthorType:
            case FieldType.SourceType:
            case FieldType.OperatingType:
            case FieldType.Producer:
            case FieldType.Trademark:
            case FieldType.TitleType:
                if (testContent.Length > 0xff)
                {
                    testContent = testContent.Substring(0, 0xff);
                }
                testContent = CommonFilter(filterRuleId, filter, collectionCommon, testContent);
                break;

            case FieldType.NumberType:
                testContent = DataConverter.CSingle(testContent).ToString();
                break;

            case FieldType.MoneyType:
                testContent = DataConverter.CDecimal(testContent).ToString();
                break;

            case FieldType.DateTimeType:
                testContent = DataConverter.CDate(testContent).ToString();
                break;

            case FieldType.BoolType:
                testContent = DataConverter.CBoolean(testContent).ToString();
                break;

            case FieldType.KeywordType:
                testContent = CollectionCommon.CreateKeyWord(CommonFilter(filterRuleId, filter, collectionCommon, testContent).Replace(",", "|").Replace(",", "|"), DataConverter.CLng(input));
                break;

            default:
                testContent = CommonFilter(filterRuleId, filter, collectionCommon, testContent);
                break;
            }
            if (string.IsNullOrEmpty(testContent))
            {
                testContent = "没有截取到代码,请加载内容页源代码重新设置下。";
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", testContent);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }