Skip to content

Instantly share code, notes, and snippets.

@wujiyu115
Created August 23, 2013 09:33
Show Gist options
  • Save wujiyu115/6317376 to your computer and use it in GitHub Desktop.
Save wujiyu115/6317376 to your computer and use it in GitHub Desktop.
kugou song list to song list
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.IO;
namespace songlist
{
public partial class Form1 : Form
{
private String fileName;
private String content;
public Form1()
{
InitializeComponent();
this.textBox1.ReadOnly = true;
}
private void textBox1_DragDrop(object sender, DragEventArgs e)
{
Array aryFiles = ((System.Array)e.Data.GetData(DataFormats.FileDrop));
if (aryFiles.Length == 1)
{
fileName= aryFiles.GetValue(0).ToString();
StreamReader reader = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding("utf-8"), true);
XmlTextReader xmltxtrd = new XmlTextReader(reader);
while (xmltxtrd.Read())
{
if (xmltxtrd.NodeType == XmlNodeType.Element && xmltxtrd.Name == "FileName")
{
content += xmltxtrd.ReadElementContentAsString() + "\r\n";
}
}
this.textBox1.Text = content;
}
}
private void textBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Link;
else
e.Effect = DragDropEffects.None;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment