OK, i made a program that you can drag and drop mp3 files to it and it's write there's name.
i want that when i will click the button "Save" it will save the mp3 files with the new name in the Desktop.
how can i do it?
there is a code for download.
or if you want here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Xml;
using System.Net;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void listView1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
}
private void listView1_DragDrop(object sender, DragEventArgs e)
{
listView1.Items.Clear();
string[] handles = (string[])e.Data.GetData(DataFormats.FileDrop, false);
foreach (string s in handles)
{
if (File.Exists(s))
{
if (string.Compare(Path.GetExtension(s), ".mp3", true) == 0)
{
AddFileToListview1(s);
}
}
else if (Directory.Exists(s))
{
DirectoryInfo di = new DirectoryInfo(s);
FileInfo[] files = di.GetFiles("*.mp3");
foreach (FileInfo file in files)
AddFileToListview1(file.FullName);
}
}
}
private void AddFileToListview1(string fullFilePath)
{
if (!File.Exists(fullFilePath))
return;
string fileName = Path.GetFileName(fullFilePath);
string dirName = Path.GetDirectoryName(fullFilePath);
if (dirName.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)))
dirName = dirName.Substring(0, dirName.Length - 1);
ListViewItem itm = listView1.Items.Add(fileName);
itm.SubItems.Add(dirName);
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
for(int item = 0; item < listView1.Items.Count; item++)
{
try
{
listView1.Items[0].Text = textBox1.Text + " 1";
listView1.Items[1].Text = textBox1.Text + " 2";
listView1.Items[2].Text = textBox1.Text + " 3";
listView1.Items[3].Text = textBox1.Text + " 4";
listView1.Items[4].Text = textBox1.Text + " 5";
listView1.Items[5].Text = textBox1.Text + " 6";
listView1.Items[6].Text = textBox1.Text + " 7";
listView1.Items[7].Text = textBox1.Text + " 8";
listView1.Items[8].Text = textBox1.Text + " 9";
listView1.Items[9].Text = textBox1.Text + " 10";
listView1.Items[10].Text = textBox1.Text + " 11";
listView1.Items[11].Text = textBox1.Text + " 12";
listView1.Items[12].Text = textBox1.Text + " 13";
listView1.Items[13].Text = textBox1.Text + " 14";
listView1.Items[14].Text = textBox1.Text + " 15";
listView1.Items[15].Text = textBox1.Text + " 16";
listView1.Items[16].Text = textBox1.Text + " 17";
listView1.Items[17].Text = textBox1.Text + " 18";
listView1.Items[18].Text = textBox1.Text + " 19";
listView1.Items[19].Text = textBox1.Text + " 20";
listView1.Items[20].Text = textBox1.Text + " 21";
listView1.Items[21].Text = textBox1.Text + " 22";
listView1.Items[22].Text = textBox1.Text + " 23";
listView1.Items[23].Text = textBox1.Text + " 24";
listView1.Items[24].Text = textBox1.Text + " 25";
listView1.Items[25].Text = textBox1.Text + " 26";
}
catch
{
return;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
//This is the Save Button
}
}
}