熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

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

2013-11-13 10:21:05  來源: .NET編程 

  MP資源都在互聯網上有時聽不了也是正常但大多數不好用真是用處不大了仔細分析了一下它的源碼原來是讀取目錄下的xmlxmlxml文件我經常在番茄花園聽歌也就是就想能不能把番茄的MP資源放到這裡來放呢?這不就是大家常說的MP小偷的功能嗎?說干就干!

  分析一下番茄花園的歌來源 PageUrl = _playlistasx;

  目標地址xml

  用程序轉換格式

  前台

<%@ Page language=c# Codebehind=ReadAndWriteXmlaspxcs AutoEventWireup=false Inherits=讀取番茄花園的MPReadAndWriteXml validateRequest=false%>
<!DOCTYPE HTML PUBLIC //WC//DTD HTML Transitional//EN
<HTML>
<HEAD>
<title>讀取番茄花園MP列表</title>
<meta content=Microsoft Visual Studio NET name=GENERATOR
<meta content=C# name=CODE_LANGUAGE
<meta content=JavaScript name=vs_defaultClientScript
<meta content= name=vs_targetSchema
</HEAD>
<body MS_POSITIONING=GridLayout
<form id=Form method=post runat=server
<FONT face=宋體
<asp:TextBox id=TextBox runat=server
Width=px Height=px TextMode=MultiLine></asp:TextBox>
<asp:Button id=Button runat=server
Width=px Text=修正~></asp:Button></FONT></form>
</body>
</HTML>

  後台

using System;
using SystemCollections;
using SystemComponentModel;
using SystemData;
using SystemDrawing;
using SystemWeb;
using SystemWebSessionState;
using SystemWebUI;
using SystemWebUIWebControls;
using SystemWebUIHtmlControls;
using SystemIO;
using SystemNet;
using SystemText;
using SystemTextRegularExpressions;
namespace 讀取番茄花園的MP
{
  /// <summary>
  /// WebForm 的摘要說明
  /// </summary>
  public class ReadAndWriteXml : SystemWebUIPage
  {
   protected SystemWebUIWebControlsTextBox TextBox;
   protected SystemWebUIWebControlsButton Button;
   private string PageUrl = ;

   private void Page_Load(object sender SystemEventArgs e)
   {
    // 在此處放置用戶代碼以初始化頁面
    if(!IsPostBack)
    {
     ///首先讀取番茄花園的acx文件(_playlistasx)
     ///
     PageUrl = _playlistasx;
     WebClient wc = new WebClient();
     wcCredentials = CredentialCacheDefaultCredentials;
     Byte[] pageData = wcDownloadData(PageUrl);
     string Result = EncodingDefaultGetString(pageData);
     TextBoxText=Result;

    }
   }

   #region Web 窗體設計器生成的代碼
   override protected void OnInit(EventArgs e)
   {
    //
    // CODEGEN: 該調用是 ASPNET Web 窗體設計器所必需的
    //
    InitializeComponent();
    baseOnInit(e);
   }

   /// <summary>
   /// 設計器支持所需的方法 不要使用代碼編輯器修改
   /// 此方法的內容
   /// </summary>
   private void InitializeComponent()
   {
    thisButtonClick += new SystemEventHandler(thisButton_Click);
    thisLoad += new SystemEventHandler(thisPage_Load);
   }
   #endregion

   private void Button_Click(object sender SystemEventArgs e)
   {
    string temp=TextBoxText;
    TextBoxText=<musics firstRun=\\;
    TextBoxText+=temp;

    TextBoxText=TextBoxTextReplace(<Asx Version=);
    TextBoxText=TextBoxTextReplace(<Param Name=\AllowShuffle\ Value=\yes\/> );
    TextBoxText=TextBoxTextReplace(</Asx>);

    TextBoxText=TextBoxTextReplace(</Entry>);
    TextBoxText=TextBoxTextReplace(<Entry>);

    TextBoxText=TextBoxTextReplace(<Title><music name=\);
    TextBoxText=TextBoxTextReplace(</Title>\);
 
    TextBoxText=TextBoxTextReplace(<Ref addres=);

    TextBoxText+=</musics>;

    //TextBoxText=TextBoxTextReplace(\r\n);
    /// 下面開始生成 xml文件
    ///
    StreamWriter swFromFileStreamUTFBuffer=new StreamWriter(ServerMapPath(/)+xmlfalseSystemTextEncodingUTF);
    swFromFileStreamUTFBufferWrite(TextBoxText);
    swFromFileStreamUTFBufferFlush();
    swFromFileStreamUTFBufferClose();
   }
  }
}

From:http://tw.wingwit.com/Article/program/net/201311/13338.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.