private void MainForm_Load(object sender, EventArgs e) { foreach(String s in GlobalVar.Extensions) { if (SystemService.NormalizePath(SystemService.FileExtentionInfo(SystemService.AssocStr.Executable, s)) != SystemService.NormalizePath((Application.ExecutablePath))) { SystemService.SetAssociationFileExtention(s, "MusicLibraryManager.Rarder44", Application.ExecutablePath, "Music Library Manager RUUUUULEXXXXXX"); } } Directory.SetCurrentDirectory(SystemService.GetParent(Application.ExecutablePath)); LoadOptionFromFile(GlobalVar.PathOption); LoadIndexFromFile(GlobalVar.PathIndexFile,true, GlobalVar.ApplicationOption.PathMedia, GlobalVar.ApplicationOption.LoadMediaOption()); LoadIndexMediaLibrary(); LoadPlaylistlsocationFromFile(GlobalVar.PathPlaylistlsocation); status = MainFormStatus.RootBrowsing; fileBrowser1.AddItemRequest += (Playlist p, MyFileSystemPlus f) => { MyFileSystemPlus c = f.Clone()._Cast<MyFileSystemPlus>(); c.RimuoviFileNonSelezionati(); c.RimuoviCartelleVuote(); if (p.FileSystem == null) p.FileSystem = new MyFileSystemPlus(); p.FileSystem.Merge(c); p.FileSystem.Root.SetParentOnAllChild(FileSystemNodePlusLevelType.AllNode); p.FileSystem.RootPath = f.RootPath; new SingleFile(p.FileSystem.Root).SetSelectChildNode(false); new SingleFile(IndexMediaLibrary.RootFileSystem.Root).SetSelectChildNode(false); SavePlaylist(p); }; fileBrowser1.RemoveItemRequest += (MyFileSystemPlus ToRemoveSelect) => { ToRemoveSelect.RimuoviFileSelezionati(); ToRemoveSelect.RimuoviCertelleVuoteSelezionate(); fileBrowser1.ReloadNode(); SavePlaylist(listBox_playlists.Items.Cast<Playlist>().Where(x => x.FileSystem == ToRemoveSelect).First()); }; fileBrowser1.PlaylistChanged += (MyFileSystemPlus PlaylistSystem) => { foreach (Playlist p in listBox_playlists.Items) { if( p.FileSystem == PlaylistSystem) { SavePlaylist(p); return; } } }; if (args!=null && args.Length!=0) { foreach (String s in args) { if (SystemService.FileExist(s)) { FileData FD = FileService.ReadFile(s); if (FD == null) continue; if (FD.Type == FileDataType.Playlist) { if (!CheckPlaylistIsInList(s)) { LoadPlaylist(s); SavePlaylistlsocation(GlobalVar.PathPlaylistlsocation); } } else if (FD.Type == FileDataType.Option) { if(MessageBox.Show("Vuoi sostituire le opzioni?","Continuare?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.Yes) { SystemService.CopySecure(s, GlobalVar.PathOption, true); LoadOptionFromFile(GlobalVar.PathOption); } } else if (FD.Type == FileDataType.IndexFile) { if (MessageBox.Show("Vuoi sostituire il file di indice?", "Continuare?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { SystemService.CopySecure(s, GlobalVar.PathIndexFile, true); LoadIndexFromFile(GlobalVar.PathIndexFile,true, GlobalVar.ApplicationOption.PathMedia, GlobalVar.ApplicationOption.LoadMediaOption()); } } else if (FD.Type == FileDataType.Playlistlsocation) { Playlistlsocation pll = FD.o._Cast<Playlistlsocation>(); if (pll.PathPlaylist != null) LoadPlaylists(pll.PathPlaylist,true,false,true); } } } } }
private void button4_Click(object sender, EventArgs e) { RequestForm rq = new RequestForm(); rq.Text = "Inserisci Nome Playlist"; rq.label1.Text = "Inserisci il nome della Playlist"; rq.ShowDialog(); if(rq.Saved) { String s = rq.textBox1.Text.Trim(); if (s=="") { MessageBox.Show("Devi Inserire un nome valido"); return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Media Library Manager File | *.mlm;"; if (sfd.ShowDialog()==DialogResult.OK) { Playlist p = new Playlist(sfd.FileName,s); AddPlaylist(p); SavePlaylist(p); SavePlaylistlsocation(GlobalVar.PathPlaylistlsocation); status = MainFormStatus.RootBrowsing; } } }
private void rimuoviToolStripMenuItem_Click(object sender, EventArgs e) { listBox_playlists.RemoveAtInvoke(listBox_playlists.SelectedIndex); status = MainFormStatus.RootBrowsing; SavePlaylistlsocation(GlobalVar.PathPlaylistlsocation); }
void LoadIndexMediaLibrary() { Current = IndexMediaLibrary.RootFileSystem; status = MainFormStatus.RootBrowsing; ReloadCurrentFileSystem(); }