您现在的位置是:主页 > news > 宿迁网站建设公司/线上seo关键词优化软件工具

宿迁网站建设公司/线上seo关键词优化软件工具

admin2025/6/5 2:11:55news

简介宿迁网站建设公司,线上seo关键词优化软件工具,国家企业信用信息公示系统换官网,电商网站可以用dw做是一个Console的app使用方法 :把Translate.exe放到system32的文件夹中,打开cmd,输入Translate空格hello ,就可以查到hello在google上的解释。如果不放在system32中就要自己设定系统环境变量Path使用的是.net4.0。 源码&#xff1a…

宿迁网站建设公司,线上seo关键词优化软件工具,国家企业信用信息公示系统换官网,电商网站可以用dw做是一个Console的app使用方法 :把Translate.exe放到system32的文件夹中,打开cmd,输入Translate空格hello ,就可以查到hello在google上的解释。如果不放在system32中就要自己设定系统环境变量Path使用的是.net4.0。 源码&#xff1a…

是一个Console的app

使用方法 :把Translate.exe放到system32的文件夹中,打开cmd,输入Translate空格hello ,就可以查到hello在google上的解释。

如果不放在system32中就要自己设定系统环境变量Path

使用的是.net4.0。 

源码:

 1 using System.Net;
 2 using System.IO;
 3 using System.Text;
 4 using System;
 5 
 6 namespace Translate
 7 {
 8     class Program
 9     {
10         static void Main(string[] args)
11         {
12             HttpWebRequest webrequest = HttpWebRequest.Create(@"http://www.google.com.hk/search?hl=zh-CN&q=fy%20"+args[0]) as HttpWebRequest;
13             webrequest.CookieContainer = new CookieContainer();
14             HttpWebResponse webresponse = webrequest.GetResponse() as HttpWebResponse;
15             using (Stream strM = webresponse.GetResponseStream())
16             {
17                 using (StreamReader sr = new StreamReader(strM, Encoding.GetEncoding("gb2312")))
18                 {
19                     Console.WriteLine(sr.ReadToEnd().Filter()); 
20                 }
21             }
22             
23         }
24         
25     }
26     public static class HtmlExtern 
27     {
28         /// <summary>
29         /// author:Snowleung
30         /// </summary>
31         /// <param name="TempContent"></param>
32         /// <returns></returns>
33         public static string Filter(this string TempContent)
34         {
35             string x=TempContent.regularExpressionsOfHTML();
36             int start = x.IndexOf("您想要的语言");
37             int last = x.IndexOf("translate");
38             return x.Substring(start, last - start);
39         }
40         /// <summary>
41         /// This method from :http://www.cnblogs.com/yuanjw/archive/2007/05/23/756724.html
42         /// </summary>
43         /// <param name="TempContent"></param>
44         /// <returns></returns>
45         public static string regularExpressionsOfHTML(this string TempContent)
46         {
47             //TempContent = System.Text.RegularExpressions.Regex.Replace(TempContent,"<[^>]+>",""); //任意多个
48             TempContent = System.Text.RegularExpressions.Regex.Replace(TempContent, "<[^>]*>"""); //匹配一个
49             return TempContent;
50         }
51     }

52 } 

 

附上Solution:(vs2010) 

/Files/snowleung/Translate.7z 

转载于:https://www.cnblogs.com/snowleung/archive/2011/06/26/2090950.html