开发ASP.NET下的MP3小偷程序

王朝asp·作者佚名  2008-05-19
宽屏版  字体: |||超大  

1、分析一下番茄花园的歌来源: PageUrl = "http://tomatolei.com/bbs/T_playlist.asx";

2、目标地址:1.xml

3、用程序转换格式:

前台:

<%@ Page language="c#" Codebehind="ReadAndWriteXml.aspx.cs" AutoEventWireup="false" Inherits="读取番茄花园的MP3.ReadAndWriteXml" validateRequest=false%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

<HEAD>

<title>读取番茄花园MP3列表</title>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="C#" name="CODE_LANGUAGE">

<meta content="JavaScript" name="vs_defaultClientScript">

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<FONT face="宋体">

<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 32px" runat="server"

Width="312px" Height="240px" TextMode="MultiLine"></asp:TextBox>

<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 160px; POSITION: absolute; TOP: 288px" runat="server"

Width="96px" Text="修正~"></asp:Button></FONT></form>

</body>

</HTML>

后台:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.IO;

using System.Net;

using System.Text;

using System.Text.RegularExpressions;

namespace 读取番茄花园的MP3

{

/// <summary>

/// WebForm1 的摘要说明。

/// </summary>

public class ReadAndWriteXml : System.Web.UI.Page

{

protected System.Web.UI.WebControls.TextBox TextBox1;

protected System.Web.UI.WebControls.Button Button1;

private string PageUrl = "";

private void Page_Load(object sender, System.EventArgs e)

{

// 在此处放置用户代码以初始化页面

if(!IsPostBack)

{

///首先读取番茄花园的acx文件(http://tomatolei.com/bbs/T_playlist.asx)

///

PageUrl = "http://tomatolei.com/bbs/T_playlist.asx";

WebClient wc = new WebClient();

wc.Credentials = CredentialCache.DefaultCredentials;

Byte[] pageData = wc.DownloadData(PageUrl);

string Result = Encoding.Default.GetString(pageData);

TextBox1.Text=Result;

}

}

#region Web 窗体设计器生成的代码

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。

//

InitializeComponent();

base.OnInit(e);

}

/// <summary>

/// 设计器支持所需的方法 - 不要使用代码编辑器修改

/// 此方法的内容。

/// </summary>

private void InitializeComponent()

{

this.Button1.Click += new System.EventHandler(this.Button1_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void Button1_Click(object sender, System.EventArgs e)

{

string temp=TextBox1.Text;

TextBox1.Text="<musics firstRun=\"1\">";

TextBox1.Text+=temp;

TextBox1.Text=TextBox1.Text.Replace("<Asx Version=3.0>","");

TextBox1.Text=TextBox1.Text.Replace("<Param Name=\"AllowShuffle\" Value=\"yes\"/> ","");

TextBox1.Text=TextBox1.Text.Replace("</Asx>","");

TextBox1.Text=TextBox1.Text.Replace("</Entry>","");

TextBox1.Text=TextBox1.Text.Replace("<Entry>","");

TextBox1.Text=TextBox1.Text.Replace("<Title>","<music name=\"");

TextBox1.Text=TextBox1.Text.Replace("</Title>","\"");

TextBox1.Text=TextBox1.Text.Replace("<Ref href=","addres=");

TextBox1.Text+="</musics>";

//TextBox1.Text=TextBox1.Text.Replace("\r\n","");

/// 下面开始生成

1.xml文件

///

StreamWriter swFromFileStreamUTF8Buffer=new StreamWriter(Server.MapPath("./")+"1.xml",false,System.Text.Encoding.UTF8,512);

swFromFileStreamUTF8Buffer.Write(TextBox1.Text);

swFromFileStreamUTF8Buffer.Flush();

swFromFileStreamUTF8Buffer.Close();

}

}

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有