<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">正則表達式分組關(guān)鍵字</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;
            }

        }
    }


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


    網(wǎng)站導(dǎo)航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲自偷自拍另类12p| 国产无遮挡裸体免费视频在线观看 | 免费播放春色aⅴ视频| 亚洲免费视频观看| 特级毛片A级毛片100免费播放| 成年女人午夜毛片免费视频| 怡红院亚洲怡红院首页| 亚洲国产精品yw在线观看| 中文字幕亚洲免费无线观看日本| 国产V亚洲V天堂无码| 无码人妻精品中文字幕免费| 中文字幕亚洲精品资源网| 91精品国产免费网站| 亚洲免费在线视频观看| 成年人在线免费观看| 国产成人人综合亚洲欧美丁香花 | 亚洲国产成人超福利久久精品 | 四虎永久在线观看免费网站网址| 精品亚洲成a人片在线观看少妇| 四虎免费影院ww4164h| 亚洲色精品VR一区区三区| a高清免费毛片久久| 我要看WWW免费看插插视频| 亚洲AV无码一区二区三区久久精品 | 无码一区二区三区AV免费| 亚洲爆乳AAA无码专区| 亚洲精品国产精品乱码不卞| 亚洲精品成a人在线观看夫| 国产在线观看免费视频播放器| 亚洲最新中文字幕| 最近2019免费中文字幕视频三| 亚洲av无码久久忘忧草| 最近中文字幕无免费| 亚洲欧美日韩中文二区| 岛国av无码免费无禁网站| 日本一区二区三区免费高清在线 | 久久久久亚洲精品无码网址| 无码日韩精品一区二区三区免费| 亚洲av成人一区二区三区| 国产免费人人看大香伊| 亚洲人成网站999久久久综合|