国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

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

2024-07-10 13:05:59
字體:
來源:轉載
供稿:網友

 昨天在這個地址: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" runat="server"
width="312px" height="240px" textmode="multiline"></asp:textbox>
<asp:button id="button1" 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();
  }
 }
}


 

注冊會員,創建你的web開發資料庫,
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 武安市| 连平县| 岱山县| 富阳市| 手机| 余干县| 奈曼旗| 海原县| 竹溪县| 忻城县| 阿克苏市| 通许县| 仲巴县| 六盘水市| 宣武区| 肃南| 油尖旺区| 右玉县| 永靖县| 老河口市| 峨眉山市| 平江县| 修文县| 海淀区| 商水县| 章丘市| 连州市| 宜宾县| 巍山| 三门县| 清流县| 乐至县| 莱阳市| 驻马店市| 镇远县| 临沂市| 靖江市| 辽源市| 库尔勒市| 分宜县| 二手房|