<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    namespace CheckDomain
    {

        using System.Net;
        using System.IO;
        using System.Text.RegularExpressions;
        using System.Collections;
        public delegate void CallBack(DataGridViewRow dgrv, DomainStatus ds);
        public delegate void CallBackEx(string dgrv, DomainStatus ds);
        public class ThreadWithData
        {
            public UrlCheck uc = new UrlCheck();
            public CallBack CBack;
            public CallBackEx CBackEx;
            public ArrayList DomainList;
            public DataGridViewRow[] DataGridViewRowDomainList;

            public ThreadWithData(ArrayList tempDomain, CallBack tempCBack)
            {
                this.CBack = tempCBack;
                this.DomainList = tempDomain;

            }
            public ThreadWithData(DataGridViewRow[] tempDataGridViewRowDomainList, CallBack tempCBack)
            {
                this.CBack = tempCBack;
                this.DataGridViewRowDomainList = tempDataGridViewRowDomainList;

            }
            public ThreadWithData(ArrayList tempDomain, CallBackEx tempCBack)
            {
                this.CBackEx = tempCBack;
                this.DomainList = tempDomain;

            }
            public void Run()
            {
                foreach (DataGridViewRow tempDomain in DomainList)
                {

                    DomainStatus tempDS = uc.GetDomainStatus(tempDomain.Cells["Column2"].Value.ToString());
                    CBack(tempDomain, tempDS);
                    //CBack(tempDS.Status);
                }
            }
            public void RunMy()
            {
                foreach (DataGridViewRow tempDomain in DomainList)
                {

                    DomainStatus tempDS = uc.GetDomainStatus(tempDomain.Cells["Column12"].Value.ToString());
                    CBack(tempDomain, tempDS);
                    //CBack(tempDS.Status);
                }
            }
            public void RunGrid()
            {
                foreach (DataGridViewRow tempDomain in DataGridViewRowDomainList)
                {

                    DomainStatus tempDS = uc.GetDomainStatus(tempDomain.Cells["Column2"].Value.ToString());
                    CBack(tempDomain, tempDS);
                }
            }
            public void RunEx()
            {
                foreach (string tempDomain in DomainList)
                {

                    DomainStatus tempDS = uc.GetDomainStatus(tempDomain);
                    CBackEx(tempDomain, tempDS);
                    //CBack(tempDS.Status);
                }
            }
        }
        public class DomainStatus
        {
            public bool Status;
            public DateTime Create_Date;
            public DateTime Updated_Date;
            public DateTime Expiration_Date;
        }
        public class UrlCheck
        {
            public string GetHttpData(string sUrl, string charset)
            {
                string sRslt = null;
                WebResponse oWebRps = null;
                WebRequest oWebRqst = WebRequest.Create(sUrl);
                oWebRqst.Timeout = 50000;
                try
                {
                    oWebRps = oWebRqst.GetResponse();
                }

                finally
                {
                    if (oWebRps != null)
                    {
                        StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), System.Text.Encoding.GetEncoding(charset));
                        sRslt = oStreamRd.ReadToEnd();
                        oStreamRd.Close();
                        oWebRps.Close();
                    }
                }
                return sRslt;
            }
            //
            //Updated Date: 25-mar-2010
            //Creation Date: 23-apr-1996
            //Expiration Date: 24-apr-2019
            public DomainStatus GetDomainStatus(string domain)
            {
                DomainStatus tempDomainStatus = new DomainStatus();
                string tempContent = "";
                try
                {
                    tempContent= GetHttpData("            }
                catch (Exception ex)
                {
                    tempContent = "";
                   
                }
                string[] tempCdate = GetRegValue(tempContent, "Creation Date:(?<cdate>([^\\n]+))", "cdate", true);

                if (tempCdate.Length > 0)
                {
                    string[] tempUpdate = GetRegValue(tempContent, "Updated Date:(?<udate>([^\\n]+))", "udate", true);
                    string[] tempEdate = GetRegValue(tempContent, "Expiration Date:(?<edate>([^\\n]+))", "edate", true);
                    DateTime dt1 = DateTime.Parse(tempCdate[0]);
                    DateTime dt2 = DateTime.Parse(tempUpdate[0]);
                    DateTime dt3 = DateTime.Parse(tempEdate[0]);
                    tempDomainStatus.Status = true;
                    tempDomainStatus.Create_Date = dt1;
                    tempDomainStatus.Updated_Date = dt2;
                    tempDomainStatus.Expiration_Date = dt3;
                }
                else
                {
                    tempDomainStatus.Status = false;
                }
                return tempDomainStatus;

            }
            /// <summary>
            /// 正則表達式取值
            /// </summary>
            /// <param name="HtmlCode">源碼</param>
            /// <param name="RegexString">正則表達式</param>
            /// <param name="GroupKey">正則表達式分組關鍵字</param>
            /// <param name="RightToLeft">是否從右到左</param>
            /// <returns></returns>
            public string[] GetRegValue(string HtmlCode, string RegexString, string GroupKey, bool RightToLeft)
            {
                MatchCollection m;
                Regex r;
                if (RightToLeft == true)
                {
                    r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.RightToLeft);
                }
                else
                {
                    r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                }
                m = r.Matches(HtmlCode);
                string[] MatchValue = new string[m.Count];
                for (int i = 0; i < m.Count; i++)
                {
                    MatchValue[i] = m[i].Groups[GroupKey].Value;
                }
                return MatchValue;
            }
            public string[] GetRegValue1(string HtmlCode, string RegexString, string GroupKey, bool RightToLeft)
            {
                MatchCollection m;
                Regex r;
                if (RightToLeft == true)
                {
                    r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.RightToLeft);
                }
                else
                {
                    r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                }
                m = r.Matches(HtmlCode);
                string[] MatchValue = new string[m.Count];
                for (int i = 0; i < m.Count; i++)
                {
                    MatchValue[i] = m[i].Groups[GroupKey].Value;
                }
                return MatchValue;
            }

        }
    }


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 永久免费AV无码网站国产| 亚洲另类无码一区二区三区| 91精品成人免费国产| 亚洲精品无码久久不卡| 四虎永久在线精品免费一区二区| 国产免费av片在线无码免费看 | 日韩一级免费视频| 亚洲七久久之综合七久久| 日韩在线视频免费看| 亚洲真人无码永久在线观看| 日韩在线免费播放| 免费国产在线精品一区| 国产精品亚洲综合一区| 日本人成在线视频免费播放| 亚洲黄色网址大全| AA免费观看的1000部电影| 久久精品国产亚洲av瑜伽| 亚洲片国产一区一级在线观看 | 人人爽人人爽人人片A免费| 久久久久久久亚洲精品| a毛片久久免费观看| 亚洲日本在线观看网址| 日韩免费一区二区三区| jizz免费一区二区三区| 中文字幕亚洲精品资源网| 日本v片免费一区二区三区| 久久久久久国产a免费观看不卡| 久久精品国产亚洲AV麻豆王友容 | 亚洲AV无码一区二三区 | 午夜精品在线免费观看| 狠狠热精品免费观看| 久久综合日韩亚洲精品色| 在线天堂免费观看.WWW| 一区二区三区视频免费| 亚洲综合无码一区二区| 日本牲交大片免费观看| 国产成人精品免费久久久久| 亚洲精品无码久久久久A片苍井空| 亚洲自偷自偷图片| 天天拍拍天天爽免费视频| 中文字幕无码免费久久|