public void AddSearchLrc(List <LRCBase> lrcbaselist, MusicFile music) { // lrcList.DataContext = CreateDataTable(lrcbaselist); status.Content = string.Format("{0} lrc searched", lrcbaselist.Count); if (expander1.IsExpanded && (bool)autoSelect.IsChecked && lrcbaselist.Count > 0) { selectLRCBase = null; selectLRCBase = lrcbaselist[0]; foreach (LRCBase lrcBase in lrcbaselist) { if (lrcBase.Singer == music.Artist && lrcBase.SongName == music.Title) { selectLRCBase = lrcBase; break; } } if (null != thDownload) { thDownload.Abort(); } thDownload = new Thread(new ThreadStart(DownloadThread)); thDownload.Start(); } if (music == fileList[fileList.Count - 1] && expander1.IsExpanded) { searchByDir.IsEnabled = true; } // }
public string DownloadLrc(LRCBase lrcSong) { string retMes = ""; if (selectSong == null) { retMes = "No lrc searched!"; return retMes; } if (lrcSong != null) { selectSong = lrcSong; } string url = string.Format(DownloadURL, lrcSong.ID, EncodeHelper.CreateQianQianCode(lrcSong.Singer, lrcSong.SongName, lrcSong.ID)); retMes = RequestUrl(url); return retMes; }
private void lrcList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (this.lrcList.SelectedIndex < 0) { return; } DataTable table = this.lrcList.DataContext as DataTable; DataRow row = table.Rows[this.lrcList.SelectedIndex]; object [] info = row.ItemArray; selectLRCBase = null; selectLRCBase = new LRCBase(Convert.ToInt32(info[0]), info[1].ToString(), info[2].ToString()); if (null != thDownload) { thDownload.Abort(); } thDownload = new Thread(new ThreadStart(DownloadThread)); thDownload.Start(); }
public string DownloadLrc(LRCBase lrcSong) { string retMes = ""; if (selectSong == null) { retMes = "No lrc searched!"; return(retMes); } if (lrcSong != null) { selectSong = lrcSong; } string url = string.Format(DownloadURL, lrcSong.ID, EncodeHelper.CreateQianQianCode(lrcSong.Singer, lrcSong.SongName, lrcSong.ID)); retMes = RequestUrl(url); return(retMes); }
public List <LRCBase> DownloadLrcList(string song, string singer) { song = song.ToLower().Replace(" ", "").Replace("'", ""); song = EncodeHelper.ToHexString(song, Encoding.Unicode); singer = singer.ToLower().Replace(" ", "").Replace("'", ""); singer = EncodeHelper.ToHexString(singer, Encoding.Unicode); string url = string.Format(SearchURL, singer, song); string lrclist = RequestUrl(url); List <LRCBase> lrcbaselist = new List <LRCBase>(); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(lrclist); } catch { } selectSong = null; if (doc != null) { XmlNodeList list = doc.SelectNodes("/result/lrc"); if (list != null) { for (int i = 0; i < list.Count; i++) { lrcbaselist.Add(new LRCBase((Convert.ToInt32(list.Item(i).Attributes["id"].Value)), list.Item(i).Attributes["title"].Value, list.Item(i).Attributes["artist"].Value)); } } } if (lrcbaselist.Count > 0) { selectSong = lrcbaselist[0]; } else { selectSong = null; } return(lrcbaselist); }
public List<LRCBase> DownloadLrcList(string song, string singer) { song = song.ToLower().Replace(" ", "").Replace("'", ""); song = EncodeHelper.ToHexString(song, Encoding.Unicode); singer = singer.ToLower().Replace(" ", "").Replace("'", ""); singer = EncodeHelper.ToHexString(singer, Encoding.Unicode); string url = string.Format(SearchURL, singer, song); string lrclist = RequestUrl(url); List<LRCBase> lrcbaselist = new List<LRCBase>(); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(lrclist); } catch { } selectSong = null; if (doc != null) { XmlNodeList list = doc.SelectNodes("/result/lrc"); if (list != null) { for (int i = 0; i < list.Count; i++) { lrcbaselist.Add(new LRCBase((Convert.ToInt32(list.Item(i).Attributes["id"].Value)), list.Item(i).Attributes["title"].Value, list.Item(i).Attributes["artist"].Value)); } } } if (lrcbaselist.Count > 0) { selectSong = lrcbaselist[0]; } else { selectSong = null; } return lrcbaselist; }
public MainWindow() { InitializeComponent(); bool isFirst; mtx = new System.Threading.Mutex (true, "zjdd ", out isFirst); #region Background color this.Background = new SolidColorBrush(Color.FromRgb(188, 99, 163)); this.mainPanel.Background = this.Background; this.fileListView.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.about.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.lrcBox.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.lrcList.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.directoryTreeView.TreeViewBackground = new SolidColorBrush(Color.FromRgb(213, 133, 191)); #endregion #region Initialize directory treeview contexmenu dirViewContextMenu = new ContextMenu(); MenuItem menu = new MenuItem(); menu.Header = "Add This Folder"; menu.Click += new RoutedEventHandler(menu_Click); dirViewContextMenu.Items.Add(menu); MenuItem open = new MenuItem(); open.Header = "Open Folder in Windows Explorer"; open.Click += new RoutedEventHandler(open_Click); dirViewContextMenu.Items.Add(open); MenuItem properties = new MenuItem(); properties.Header = "Properties"; properties.Click += new RoutedEventHandler(properties_Click); dirViewContextMenu.Items.Add(properties); this.directoryTreeView.TreeViewContextMenu = dirViewContextMenu; #endregion #region Initialize mainwindow icon defaultPath = Settings.Settings.Default.lrcDirectory;// if ("" == defaultPath.Trim()) { defaultPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "ZDLRC\\"; Settings.Settings.Default.lrcDirectory = defaultPath; } MemoryStream stream = new MemoryStream(); Properties.Resources.lrc.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); this.Icon = (ImageSource)imageSourceConverter.ConvertFrom(stream); Image image = new Image(); image.Source = ImageHelper.ToBitmapSource(Properties.Resources.lrc); image.Height = image.Width = 64; #endregion #region delegate and thread fileList = new List <MusicFile>(); lrcDownload = new LRCDownload(); updateStatus = new UpdateStatus(UpdateSearchStatus); addLrcSelect = new AddLrcSelect(AddSearchLrc); addLrc = new AddLrc(AddDownloadLRC); failedList = new List <MusicFile>(); searchLrcByZLP = new SearchLrcByZPL(SearchFromZLP); listViewFileList = new List <MusicFile>(); fileList = new List <MusicFile>(); lrcDownload = new LRCDownload(); selectLRCBase = new LRCBase(); scanComplete = new ScanComplete(ScanFinish); addFileToListView = new AddFileToListView(UpdateScanResult); backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); #endregion #region Initialize aboutBox and load settings autoSelect.IsChecked = Settings.Settings.Default.autoSave; about.AppendText("LRC Download 1.0.0.1\n\n"); about.AppendText("This is a free soft made by ZJ.\n"); about.AppendText("If you have questions,please send me email:[email protected].\n"); about.AppendText("Copyright© 2010-2012 of ZJSoft\n"); new InlineUIContainer(image, about.Document.ContentEnd); #endregion #region Initialize lrcBox contexmenu InitLrcBoxContextMenu(); #endregion #region Initialize fileListViewContextmenu fileListViewContextMenu = new ContextMenu(); MenuItem clear = new MenuItem(); clear.Header = "Remove All Files"; clear.Click += new RoutedEventHandler(clear_Click); fileListViewContextMenu.Items.Add(clear); fileListViewContextMenu.Opened += new RoutedEventHandler(fileListViewContextMenu_Opened); fileListView.ContextMenu = fileListViewContextMenu; #endregion ps = new PipeServer(this); psSer = new Thread(new ThreadStart(ps.StartPipeServer)); psSer.Start(); //MessageBox.Show(App.args); if (!String.IsNullOrEmpty(App.args)) { string[] pas = App.args.Split('|'); if (pas.Length >= 3) { if (pas[0].Trim() == "0xFFFF") { pas[0] = ""; } if (pas[1].Trim() == "0xFFFF") { pas[1] = ""; } SearchFromZLP(pas[0], pas[1], pas[2]); } } }
public MainWindow() { InitializeComponent(); bool isFirst; mtx = new System.Threading.Mutex (true, "zjdd ", out isFirst); #region Background color this.Background = new SolidColorBrush(Color.FromRgb(188, 99, 163)); this.mainPanel.Background = this.Background; this.fileListView.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.about.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.lrcBox.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.lrcList.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); this.directoryTreeView.TreeViewBackground = new SolidColorBrush(Color.FromRgb(213, 133, 191)); #endregion #region Initialize directory treeview contexmenu dirViewContextMenu = new ContextMenu(); MenuItem menu = new MenuItem(); menu.Header = "Add This Folder"; menu.Click += new RoutedEventHandler(menu_Click); dirViewContextMenu.Items.Add(menu); MenuItem open = new MenuItem(); open.Header = "Open Folder in Windows Explorer"; open.Click += new RoutedEventHandler(open_Click); dirViewContextMenu.Items.Add(open); MenuItem properties = new MenuItem(); properties.Header = "Properties"; properties.Click += new RoutedEventHandler(properties_Click); dirViewContextMenu.Items.Add(properties); this.directoryTreeView.TreeViewContextMenu = dirViewContextMenu; #endregion #region Initialize mainwindow icon defaultPath = Settings.Settings.Default.lrcDirectory;// if ("" == defaultPath.Trim()) { defaultPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "ZDLRC\\"; Settings.Settings.Default.lrcDirectory = defaultPath; } MemoryStream stream = new MemoryStream(); Properties.Resources.lrc.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); this.Icon = (ImageSource)imageSourceConverter.ConvertFrom(stream); Image image = new Image(); image.Source = ImageHelper.ToBitmapSource(Properties.Resources.lrc); image.Height = image.Width = 64; #endregion #region delegate and thread fileList = new List<MusicFile>(); lrcDownload = new LRCDownload(); updateStatus = new UpdateStatus(UpdateSearchStatus); addLrcSelect = new AddLrcSelect(AddSearchLrc); addLrc = new AddLrc(AddDownloadLRC); failedList = new List<MusicFile>(); searchLrcByZLP = new SearchLrcByZPL(SearchFromZLP); listViewFileList = new List<MusicFile>(); fileList = new List<MusicFile>(); lrcDownload = new LRCDownload(); selectLRCBase = new LRCBase(); scanComplete = new ScanComplete(ScanFinish); addFileToListView = new AddFileToListView(UpdateScanResult); backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); #endregion #region Initialize aboutBox and load settings autoSelect.IsChecked = Settings.Settings.Default.autoSave; about.AppendText("LRC Download 1.0.0.1\n\n"); about.AppendText("This is a free soft made by ZJ.\n"); about.AppendText("If you have questions,please send me email:[email protected].\n"); about.AppendText("Copyright© 2010-2012 of ZJSoft\n"); new InlineUIContainer(image, about.Document.ContentEnd); #endregion #region Initialize lrcBox contexmenu InitLrcBoxContextMenu(); #endregion #region Initialize fileListViewContextmenu fileListViewContextMenu = new ContextMenu(); MenuItem clear = new MenuItem(); clear.Header="Remove All Files"; clear.Click += new RoutedEventHandler(clear_Click); fileListViewContextMenu.Items.Add(clear); fileListViewContextMenu.Opened += new RoutedEventHandler(fileListViewContextMenu_Opened); fileListView.ContextMenu = fileListViewContextMenu; #endregion ps = new PipeServer(this); psSer = new Thread(new ThreadStart(ps.StartPipeServer)); psSer.Start(); //MessageBox.Show(App.args); if (!String.IsNullOrEmpty(App.args)) { string[] pas = App.args.Split('|'); if (pas.Length >= 3) { if (pas[0].Trim() == "0xFFFF") pas[0] = ""; if (pas[1].Trim() == "0xFFFF") pas[1] = ""; SearchFromZLP(pas[0], pas[1], pas[2]); } } }
private void lrcList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (this.lrcList.SelectedIndex < 0) return; DataTable table = this.lrcList.DataContext as DataTable; DataRow row = table.Rows[this.lrcList.SelectedIndex]; object []info = row.ItemArray; selectLRCBase = null; selectLRCBase = new LRCBase(Convert.ToInt32(info[0]), info[1].ToString(), info[2].ToString()); if (null != thDownload) { thDownload.Abort(); } thDownload = new Thread(new ThreadStart(DownloadThread)); thDownload.Start(); }
public void AddSearchLrc(List<LRCBase> lrcbaselist,MusicFile music) { // lrcList.DataContext = CreateDataTable(lrcbaselist); status.Content = string.Format("{0} lrc searched", lrcbaselist.Count); if (expander1.IsExpanded && (bool)autoSelect.IsChecked && lrcbaselist.Count >0) { selectLRCBase = null; selectLRCBase = lrcbaselist[0]; foreach (LRCBase lrcBase in lrcbaselist) { if (lrcBase.Singer == music.Artist && lrcBase.SongName == music.Title) { selectLRCBase = lrcBase; break; } } if (null != thDownload) { thDownload.Abort(); } thDownload = new Thread(new ThreadStart(DownloadThread)); thDownload.Start(); } if (music == fileList[fileList.Count - 1] && expander1.IsExpanded) { searchByDir.IsEnabled = true; } // }