private void CreatePlayButt_Click(object sender, EventArgs e) { if (Form1 == null) Form1 = new Main(); bool exists = System.IO.Directory.Exists("Playlists"); if (!exists) System.IO.Directory.CreateDirectory("Playlists"); string Path = "Playlists/" + NamePlaylist.Text + ".txt"; TextWriter tw = new StreamWriter(Path, true); ListViewItem item = new ListViewItem(); item.Text = NamePlaylist.Text; Form1.Playlists.Items.Add(item); int a = 0; foreach (ListViewItem Item in PlayListList2.Items) { foreach (var Mp3Item in Main.Mp3Array) { string Items = Item.Text.Replace("ListViewItem: { }", ""); a = Mp3Item.LastIndexOf("\\"); string Mp3String = Mp3Item.Remove(0, a); if (Mp3String.Contains(Items)) { tw.WriteLine(Mp3Item); } } } tw.Close(); this.Close(); }
public PlaylistForm(Main form) { Form1 = form; InitializeComponent(); }