예제 #1
0
        /// <summary>
        ///  获取某站点关键字在某搜索引擎的排名
        /// </summary>
        /// <param name="_engine"></param>
        /// <param name="Url"></param>
        /// <param name="KeyWord"></param>
        /// <returns></returns>
        public static string engineKeyWordinfo(EnumSearchEngine _engine, string Url, string KeyWord)
        {
            string re        = "200+";
            string Html      = "";
            string searchUrl = "";

            switch (_engine)
            {
            case EnumSearchEngine.Baidu:
                EchoHelper.Echo("关键词【" + KeyWord + "】的排名查询中,请稍后...", "", EchoHelper.EchoType.普通信息);
                searchUrl = "http://i.linkhelper.cn/searchkeywords.asp";
                string           postData = StringHelper.urlencode("url=" + Url + "&querywords=" + KeyWord + "&btnsubmit=%B2%E9+%D1%AF", "gb2312");
                CookieCollection cookies  = new CookieCollection();
                Html = new xkHttp().httpPost(searchUrl, postData, ref cookies, searchUrl, Encoding.GetEncoding("gb2312"));
                re   = RegexHelper.getMatch(Html, "百度排名:(.*?)&nbsp;&nbsp;", 1);
                if (re.Contains("排名在"))
                {
                    re = "200+";
                }
                break;

            case EnumSearchEngine.Google:
                break;
            }
            return(re);
        }
예제 #2
0
 private void picHelp_Click(object sender, EventArgs e)
 {
     if (showcontrol != null & showText.Trim() != string.Empty & showTitle.Trim() != string.Empty)
     {
         EchoHelper.ShowBalloon(showTitle, showText, showcontrol);
     }
 }
예제 #3
0
        public static string getMatch(string html, string pattern, int groupid, bool mutilLine)
        {
            if (mutilLine)
            {
                html = html.Replace("\n", "`");
            }
            pattern = getFixPattern(pattern);

            string re = "";

            try {
                Match mc = Regex.Match(html, pattern, RegexOptions.IgnoreCase);
                re = mc.Groups[groupid].Value;
            } catch (Exception ex) {
                EchoHelper.EchoException(ex);
            }
            return(re);
        }
예제 #4
0
        public static Socket GetSocket()
        {
            //设定服务端IP地址
            //IPAddress ip = IPAddress.Parse("223.4.173.93");
            //IPAddress ip = IPAddress.Parse("192.168.1.103");
            IPAddress ip           = IPAddress.Parse("116.255.139.227");
            int       port         = 9778;
            Socket    clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            try {
                clientSocket.Connect(new IPEndPoint(ip, port)); //配置服务端IP与端口
                //EchoHelper.Echo("连接服务端成功!", "系统登录", EchoHelper.EchoType.任务信息);
            } catch {
                EchoHelper.Echo("连接服务端失败,请联系Qin,检查服务端是否在开启!", "系统登录", EchoHelper.EchoType.错误信息);
                Thread.Sleep(5000);
                Environment.Exit(0);
                return(null);
            }
            return(clientSocket);
        }
예제 #5
0
 public static void EchoPickEnd()
 {
     EchoHelper.Echo("========================================= end =========================================", "【分隔符】", EchoHelper.EchoType.普通信息);
 }
예제 #6
0
 public static void EchoPickStart()
 {
     EchoHelper.Echo("=========================================start=========================================", "【分隔符】", EchoHelper.EchoType.普通信息);
 }
예제 #7
0
 public static void EchoPickEnd(string info)
 {
     EchoHelper.Echo("┗━━━━━" + info + "━━━━━┛", "【分隔符】", EchoHelper.EchoType.普通信息);
 }
예제 #8
0
 public static void EchoPickStart(string info)
 {
     EchoHelper.Echo("┏━━━━━" + info + "━━━━━┓", "【分隔符】", EchoHelper.EchoType.普通信息);
 }