開發ASP.NET下的MP3小偷程式

來源:互聯網
上載者:User
asp.net|程式|小偷程式

 昨天在這個地址:http://www.21cx.com/Software/Catalog21/43.html看到一個非常漂亮的MP3的FLASH播放器,真是好看。可是一調試發現裡面的歌太老,要不就是聽不了。MP3資源都在互連網上,有時聽不了也是正常,但大多數不好用,真是用處不大了。仔細分析了一下它的源碼,原來是讀取目錄下的1.xml,2.xml..4.xml檔案。我經常在番茄花園聽歌,也就是http://www.tomatolei.com,就想能不能把番茄的MP3資源放到這裡來放呢?這不就是大家常說的MP3小偷的功能嗎?說幹就幹!

  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 Form設計器產生的程式碼
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 該調用是 ASP.NET Web Form設計器所必需的。
   //
   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();
  }
 }
}


 



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。