private void lvDetails_DragDrop(object sender, DragEventArgs e) { trmState.Start(); string url = (string)e.Data.GetData(DataFormats.Text); //clsFile file = new clsFile(); //file = clsProcessUrl.GetInfoURL(url); Match matchDomain = Regex.Match(url, @"(?<Protocol>\w+):\/\/(?<Domain>[\w.]+\/?)\S*"); string Id = string.Empty; if (matchDomain.Groups["Domain"].Value.Contains("nhaccuatui.com")) { Id = url.Substring(url.LastIndexOf("=") + 1); } else if (matchDomain.Groups["Domain"].Value.Contains("mp3.zing.vn")) { Id = url.Substring(url.LastIndexOf("/") + 1); } clsSearch cls_search = new clsSearch(this, Id, true); Thread working = null; working = new Thread(new ParameterizedThreadStart(cls_search.NhacCuaTui)); working.IsBackground = true; working.Start(url); Thread.Sleep(100); }
private void Search(string Site, string TypeSearch, bool TypeSearchIsMenu) { if (_thrSearch != null && _thrSearch.IsAlive) { _thrSearch.Abort(); } splitContainerMainRight.SplitterDistance = splitContainerMainRight.Panel1MinSize; string urlSearch = string.Empty; string artist = Artist(Site); string category = Category(Site); string key = string.Empty; if (Site.Contains("nhaccuatui.com")) { if (TypeSearch == "TatCa") { if (txtNCT_Tim.Text != "") { key = "key=" + txtNCT_Tim.Text + "&page=" + _CurrentPage; } if (artist == "" && category == "/tim_kiem" && txtNCT_Tim.Text == "") { urlSearch = "http://v6.nhaccuatui.com/tim_kiem&page=" + _CurrentPage; } if (artist == "" && category == "/tim_kiem") { urlSearch = "http://v6.nhaccuatui.com/tim_kiem?" + key; } else if (artist != "" && category == "/tim_kiem") { urlSearch = "http://v6.nhaccuatui.com/tim_kiem?by=casi&" + key; } else if (artist == "" && category != "/tim_kiem") { urlSearch = "http://v6.nhaccuatui.com" + category + "&" + key; } else { urlSearch = "http://v6.nhaccuatui.com/tim_kiem?by=casi&type=" + category.Substring(Category(Site).LastIndexOf("=") + 1) + "&" + key + "&page=" + _CurrentPage; } } else if (TypeSearch == "TheLoai") { if (!category.Contains("?")) { urlSearch = "http://v6.nhaccuatui.com" + category + "?page=" + _CurrentPage.ToString(); } else { urlSearch = "http://v6.nhaccuatui.com" + category + "&page=" + _CurrentPage.ToString(); } } else if (TypeSearch == "CaSi") { urlSearch = "http://v6.nhaccuatui.com/tim_kiem?by=casi&key" + key + "&page=" + _CurrentPage.ToString(); } } else if (Site.Contains("mp3.zing.vn")) { if (!TypeSearchIsMenu) { if (TypeSearch == "TatCa" && txtZing_Tim.Text != "") { urlSearch = "http://mp3.zing.vn/mp3/search/do.html?t=1&q=" + txtZing_Tim.Text; } else if (TypeSearch == "CaSi" && txtZing_Tim.Text != "") { urlSearch = "http://mp3.zing.vn/mp3/search/do.html?t=2&q=" + txtZing_Tim.Text; } else if (TypeSearch == "Album" && txtZing_Tim.Text != "") { urlSearch = "http://mp3.zing.vn/mp3/search/do.html?t=3&q=" + txtZing_Tim.Text; } else if (TypeSearch == "Video" && txtZing_Tim.Text != "") { urlSearch = "http://mp3.zing.vn/mp3/search/do.html?t=4&q=" + txtZing_Tim.Text; } } else { if (TypeSearch == "TheLoai") { if (_CurrentPage != "") { urlSearch = "http://mp3.zing.vn" + category.Replace(".html", "." + _CurrentPage + ".html"); } else { urlSearch = "http://mp3.zing.vn" + category; } } else { if (_CurrentPage != "") { urlSearch = "http://mp3.zing.vn/mp3/search/do." + _CurrentPage + ".html?t=2&q=" + artist; } else { urlSearch = "http://mp3.zing.vn/mp3/search/do.1.html?t=2&q=" + artist; } } } } if (!urlSearch.Contains("http://")) { return; } clsSearch cls_search = new clsSearch(this, null, false); if (urlSearch.Contains("nhaccuatui.com")) { _thrSearch = new Thread(new ParameterizedThreadStart(cls_search.NhacCuaTui)); } else if (urlSearch.Contains("mp3.zing.vn")) { _thrSearch = new Thread(new ParameterizedThreadStart(cls_search.NhacCuaTui)); } _thrSearch.IsBackground = true; _thrSearch.Start(urlSearch); Thread.Sleep(100); }