vb.net代码转换为c#代码,谢谢

anya 2006-08-02 01:50:33

想把下面的vb.net代码转换为c#代码,谢谢,在线等.


Sub SelPlay(strUrl,strWidth,StrHeight)
Dim Exts,isExt
If strUrl <> "" Then
isExt = LCase(Mid(strUrl,InStrRev(strUrl, ".")+1))
Else
isExt = ""
End If
Exts = "avi,wmv,asf,mov,rm,ra,ram"
If Instr(Exts,isExt)=0 Then
Response.write "非法视频文件"
Else
Select Case isExt
Case "avi","wmv","asf","mov"
Response.write "<EMBED id=MediaPlayer src="&strUrl&" width="&strWidth&" height="&strHeight&" loop=""false"" autostart=""true""></EMBED>"
Case "mov","rm","ra","ram"
Response.Write "<OBJECT height="&strHeight&" width="&strWidth&" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""9525"">"
Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""-1"">"
Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
Response.Write "<PARAM NAME=""SRC"" VALUE="""&strUrl&""">"
Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ImageWindow"">"
Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
Response.Write "</OBJECT>"
Response.Write "<BR>"
Response.Write "<OBJECT height=32 width="&strWidth&" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""847"">"
Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""0"">"
Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ControlPanel,StatusBar"">"
Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
Response.Write "</OBJECT>"
End Select
End If
End Sub


...全文
148 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
anya 2006-08-02
  • 打赏
  • 举报
回复
搞定了,谢谢,--------Response.Write ("<PARAM NAME=SRC VALUE="+strUrl+">");---------就可以了.结帖.
anya 2006-08-02
  • 打赏
  • 举报
回复
其他都合适,就是编译的时候提示------“运算符"&"无法应用于"string"和"string"类型的操作数”

是这句代码Response.Write ("<PARAM NAME=SRC VALUE="&strUrl&">");



dlzhangln 2006-08-02
  • 打赏
  • 举报
回复
要不把分给我,我给你发安装文件,哈哈
dlzhangln 2006-08-02
  • 打赏
  • 举报
回复
下个C#developer转一下就行了不是吗
leafsword_519 2006-08-02
  • 打赏
  • 举报
回复
Sorry,搞昏了
Response.Write("test");是这种格式,要加括号
anya 2006-08-02
  • 打赏
  • 举报
回复
谢谢,Response.Write后面我全部+;号了,但是编译的时候每一行还是提示让我+;号,全部用红曲线画出来了
leafsword_519 2006-08-02
  • 打赏
  • 举报
回复
private void SelPlay(string strUrl,string strWidth, string StrHeight)
{
string Exts = string.Empty;
string isExt = string.Empty;

if (strUrl != "")
{
isExt = strUrl.Substring(strUrl.LastIndexOf('.')+1).ToLower();
}
else
{
isExt = "";
}

Exts = "avi,wmv,asf,mov,rm,ra,ram"
if (Exts.IndexOf("isExt") > -1)
{
switch(isExt)
{
case "avi","wmv","asf","mov" :
Response.write "<EMBED id=MediaPlayer src="+strUrl+" width="+strWidth+" height="+strHeight+" loop=""false"" autostart=""true""></EMBED>"
break;
case "mov","rm","ra","ram" :
Response.Write "<OBJECT height="+strHeight+" width="+strWidth+" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""9525"">"
Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""-1"">"
Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
Response.Write "<PARAM NAME=""SRC"" VALUE="""&strUrl&""">"
Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ImageWindow"">"
Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
Response.Write "</OBJECT>"
Response.Write "<BR>"
Response.Write "<OBJECT height=32 width="+strWidth+" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""847"">"
Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""0"">"
Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ControlPanel,StatusBar"">"
Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
Response.Write "</OBJECT>"

}
else
{
Response.write "非法视频文件";
}
}
}


Response.Write后面全部+;号
anya 2006-08-02
  • 打赏
  • 举报
回复
找了很多转换器,好象很少合适的.
anya 2006-08-02
  • 打赏
  • 举报
回复
谢谢楼上,期待......
Teng_s2000 2006-08-02
  • 打赏
  • 举报
回复
网上一搜很多转化方法
kissknife 2006-08-02
  • 打赏
  • 举报
回复
void SelPlay(string strUrl,string strWidth, string StrHeight)
{
string Exts,isExt;
If( strUrl !="" )
{
isExt = strUrl.substring(strUrl.lastindexof(".")).tolowcase;
}
Else
{
isExt = "";
}

Exts = "avi,wmv,asf,mov,rm,ra,ram";
If (Exts.contains(isExt))
{
Response.write ("非法视频文件");
}
Else
{
switch(isExt)
{
Case "avi"
case "wmv"
case "asf"
case "mov"
Response.write ("<EMBED id=MediaPlayer src="&strUrl&" width="&strWidth&" height="&strHeight&" loop=""false"" autostart=""true""></EMBED>"));
...
}
}
}

差不多这样..

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧