谁帮我把这段代码转化成vb的 谢谢啦
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
namespace BookStore.Component
{
/// <summary>
///
/// </summary>
public class DownloadUtil : System.Web.UI.Page
{
public DownloadUtil(){}
private string [] GetImgTag(string htmlStr)
{
Regex regObj = new Regex("<img.+?>",RegexOptions.Compiled|RegexOptions.IgnoreCase);
string [] strAry = new string [regObj.Matches(htmlStr).Count] ;
int i = 0;
foreach (Match matchItem in regObj.Matches(htmlStr))
{
strAry[i] = GetImgUrl(matchItem.Value);
i++;
}
return strAry ;
}
private string GetImgUrl(string imgTagStr)
{
string str = "";
Regex regObj = new Regex("http://.+?.gifhttp://.+?.jpghttp://.+?.jpeghttp://.+?.bmp",
RegexOptions.Compiled|RegexOptions.IgnoreCase);
foreach (Match matchItem in regObj.Matches(imgTagStr))
{
str = matchItem.Value;
}
return str;
}
public string SaveUrlPics(string strHTML)
{
string [] imgurlAry = GetImgTag(strHTML);
try
{
for(int i=0 ; i<imgurlAry.Length ; i++)
{
WebRequest req=WebRequest.Create(imgurlAry[i]);
string preStr=System.DateTime.Now.ToString()+"_";
preStr=preStr.Replace("-","_");
preStr=preStr.Replace(":","_");
preStr=preStr.Replace(" ","_");
WebClient wc=new WebClient();
wc.DownloadFile(imgurlAry[i],Server.MapPath("images")+"/"
+preStr+imgurlAry[i].Substring(imgurlAry[i].LastIndexOf("/")+1));
strHTML=strHTML.Replace(imgurlAry[i],"images/"
+preStr+imgurlAry[i].Substring(imgurlAry[i].LastIndexOf("/")+1));
}
return strHTML;
}
catch(Exception ex)
{
return ex.Message;
}
}
}
}
问题点数:50、回复次数:3Top
1 楼chunfengdeyi(春风得意)回复于 2005-12-01 14:04:31 得分 0
upTop
2 楼aobao(生活所迫,莫办法啊!)回复于 2005-12-01 14:23:11 得分 0
查找一个工具,vb-c#转换工具,
www.aspxcn.org上面有,
顺便这个网站是个不错的学习网站Top
3 楼baobei7758(陵少)回复于 2005-12-01 14:30:17 得分 0
Convert C# to VB.NET
http://www.developerfusion.com/utilities/convertcsharptovb.aspxTop




