Yesterday I saw a very beautiful MP3 FLASH player at this address: http://code.downcodes.com/down/86.html . It’s really nice. But after debugging, I found that the songs in it were too old, or I couldn't listen to them. MP3 resources are all on the Internet, and it is normal to not be able to listen to them sometimes, but most of them are not easy to use and are really of little use. After carefully analyzing its source code, it turns out that it reads the 1.xml, 2.xml..4.xml files in the directory. I often listen to music at Tomato Garden, which is http://www.tomatolei.com , and I was wondering if I could put Tomato’s MP3 resources here? Isn't this the function of what everyone often calls an MP3 thief? Just do it!
1. Analyze the source of the Tomato Garden song: PageUrl = " http://tomatolei.com/bbs/T_playlist.asx ";
2. Target address: 1.xml
3. Convert the format using a program:
Front desk:
<%@ Page language ="c#" Codebehind="ReadAndWriteXml.aspx.cs" AutoEventWireup="false" Inherits="Read Tomato Garden's MP3.ReadAndWriteXml" validateRequest=false%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Read Tomato Garden MP3 list</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="Correction~"></asp:Button></FONT></form>
</body>
</HTML>
Backend:
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 reads Tomato Garden MP3
{
/// <summary>
/// Summary description of 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)
{
//Put user code here to initialize the page if(!IsPostBack)
{
///First read the acx file of Tomato Garden ( 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 Code generated by Web Form Designer override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Forms designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// The required method is supported by the designer - do not use the code editor to modify /// the contents of this method.
/// </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","");
/// Let’s start generating the 1.xml file ///
StreamWriter swFromFileStreamUTF8Buffer=new StreamWriter(Server.MapPath("./")+"1.xml",false,System.Text.Encoding.UTF8,512);
swFromFileStreamUTF8Buffer.Write(TextBox1.Text);
swFromFileStreamUTF8Buffer.Flush();
swFromFileStreamUTF8Buffer.Close();
}
}
}