Ejemplo n.º 1
0
 /// <summary>
 /// 替换随机值
 /// </summary>
 /// <param name="labelType"></param>
 /// <returns></returns>
 private void Load_RandomLabel(string labelType)
 {
     #region 加载随机数
     Encoding ec = Encoding.GetEncoding("utf-8");
     foreach (ModelRandom m in model.ListRandomModel.Where(p => p.RandomLabelType == labelType))
     {
         string randContent = string.Empty;
         if (tempLinkUrl.ToLower() == (this.txtTestSiteAdminUrl.Text + m.RandomUrl).ToLower())
         {
             tempLinkUrl = this.txtTestSiteAdminUrl.Text + m.RandomUrl;
             randContent = tempLinkContent;
         }
         else
         {
             randContent = SimulationHelper.PostPage(this.txtTestSiteAdminUrl.Text + m.RandomUrl, m.RandomPostData, string.Empty, model.PageEncode, ref this.LoginedCookies);
         }
         string RandomCutRegex = m.RandomCutRegex;
         RandomCutRegex = RandomCutRegex.Replace("[参数]", "([\\S\\s]*?)");
         string CutStrContent = SimulationHelper.CutStr(randContent, RandomCutRegex)[0];
         if (!dic.ContainsKey(m.LabelName))
         {
             dic.Add(m.LabelName, HttpUtility.UrlEncode(CutStrContent, ec));
             //dic.Add(m.LabelName, CutStrContent);
         }
     }
     #endregion
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 加载随机数
 /// </summary>
 /// <param name="IsLogin">0未登陆 1登陆</param>
 private void Load_RandomList(string RandomLabelType)
 {
     #region 加载随机数
     Encoding ec = Encoding.GetEncoding("utf-8");
     foreach (ModelRandom m in Publish_Model.ListRandomModel.Where(p => p.RandomLabelType == RandomLabelType))
     {
         string randContent = string.Empty;
         if (tempLinkUrl.ToLower() == (StrLoginDir + m.RandomUrl).ToLower())
         {
             randContent = tempLinkContent;
         }
         else
         {
             randContent     = SimulationHelper.PostPage(StrLoginDir + m.RandomUrl, m.RandomPostData, string.Empty, Publish_Model.PageEncode, ref cookieHeader);
             tempLinkUrl     = StrLoginDir + m.RandomUrl;
             tempLinkContent = randContent;
         }
         string RandomCutRegex = m.RandomCutRegex;
         RandomCutRegex = RandomCutRegex.Replace("[参数]", "([\\S\\s]*?)");
         string CutStrContent = SimulationHelper.CutStr(randContent, RandomCutRegex)[0];
         if (!dic.ContainsKey(m.LabelName))
         {
             dic.Add(m.LabelName, HttpUtility.UrlEncode(CutStrContent, ec));
         }
     }
     #endregion
 }