private void cboNCT_TheLoai_SelectionChangeCommitted(object sender, EventArgs e)
 {
     _CurrentPage  = "1";
     _SearchBy     = SearchBy.TheLoai;
     _IsSearchMenu = true;
     Search("http://v6.nhaccuatui.com", _SearchBy.ToString(), _IsSearchMenu);
 }
 private void cboZing_CaSi_SelectionChangeCommitted(object sender, EventArgs e)
 {
     _CurrentPage  = "1";
     _SearchBy     = SearchBy.CaSi;
     _IsSearchMenu = true;
     Search("http://mp3.zing.vn", _SearchBy.ToString(), _IsSearchMenu);
 }
示例#3
0
        private string CreateAppListUrl(SearchBy searchBy,
                                        CostType costType,
                                        bool includeGames = false,
                                        //int maxNumberOfAppsToReturn = 20,
                                        int pageNumber    = 1,
                                        string locale     = null,
                                        string categoryId = null)
        {
            var storeFormat = WindowsPhoneStore == Store.WindowsPhone8 ? Constants.AppListUrlFormat : Constants.AppListUrlFormat7;

            var url = string.Format(storeFormat,
                                    pageNumber * 10,
                                    locale,
                                    includeGames ? "" : "windowsphone.games",
                                    searchBy.ToString(),
                                    costType.ToString());

            if (!string.IsNullOrEmpty(categoryId))
            {
                url += string.Format("&category={0}", categoryId);
            }

            return(url);
        }
 public ActionResult DoAdvancedSearch(SearchFilter searchType, string searchString, int page, SearchBy searchBy, OrderBy orderBy, string universityId)
 {
     return JavaScript("window.top.location.href ='" + Url.Action(searchType.ToString() + "Advanced") + "?searchString=" + searchString + "&page=" + page + "&searchBy=" + searchBy.ToString() + "&orderBy=" + orderBy.ToString() + "&universityId=" + universityId + "';");
 }
示例#5
0
        /// <summary>
        /// Search on Allmusic for the requested string
        /// </summary>
        /// <param name="searchBy"></param>
        /// <param name="searchStr"></param>
        /// <returns></returns>
        public bool FindInfo(SearchBy searchBy, string searchStr)
        {
            _searchby = searchBy;
            HTMLUtil util        = new HTMLUtil();
            string   strPostData = "";

            if (SearchBy.Albums == searchBy)
            {
                strPostData = string.Format(ALBUMSEARCH, HttpUtility.UrlEncode(searchStr));
            }
            else
            {
                searchStr   = SwitchArtist(searchStr);
                strPostData = string.Format(ARTISTSEARCH, HttpUtility.UrlEncode(searchStr));
            }

            string strHTML = PostHTTP(MAINURL + URLPROGRAM, strPostData);

            if (strHTML.Length == 0)
            {
                return(false);
            }

            _htmlCode = strHTML; // save the html content...

            Regex multiples = new Regex(
                @"\sSearch\sResults\sfor:",
                RegexOptions.IgnoreCase
                | RegexOptions.Multiline
                | RegexOptions.IgnorePatternWhitespace
                | RegexOptions.Compiled
                );

            if (multiples.IsMatch(strHTML))
            {
                string pattern = "";
                if (searchBy.ToString().Equals("Artists"))
                {
                    pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                              @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                              @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>(?<detail2>.*)</td>";
                }
                else if (searchBy.ToString().Equals("Albums"))
                {
                    pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                              @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                              @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>.*</td>\s*?.*<td>(?<detail2>.*)</td>";
                }


                Match m;
                Regex itemsFoundFromSite = new Regex(
                    pattern,
                    RegexOptions.IgnoreCase
                    | RegexOptions.Multiline
                    | RegexOptions.IgnorePatternWhitespace
                    | RegexOptions.Compiled
                    );


                for (m = itemsFoundFromSite.Match(strHTML); m.Success; m = m.NextMatch())
                {
                    string code    = m.Groups["code"].ToString();
                    string name    = m.Groups["name"].ToString();
                    string detail  = m.Groups["detail"].ToString();
                    string detail2 = m.Groups["detail2"].ToString();

                    util.RemoveTags(ref name);
                    util.ConvertHTMLToAnsi(name, out name);

                    util.RemoveTags(ref detail);
                    util.ConvertHTMLToAnsi(detail, out detail);

                    util.RemoveTags(ref detail2);
                    util.ConvertHTMLToAnsi(detail2, out detail2);

                    if (SearchBy.Artists == searchBy)
                    {
                        detail += " - " + detail2;
                        if (detail.Length > 0)
                        {
                            _codes.Add(code);
                            _values.Add(name + " - " + detail);
                        }
                        else
                        {
                            _codes.Add(code);
                            _values.Add(name);
                        }
                    }
                    else
                    {
                        MusicAlbumInfo albumInfo = new MusicAlbumInfo();
                        albumInfo.AlbumURL      = code;
                        albumInfo.Artist        = detail;
                        albumInfo.Title         = name;
                        albumInfo.DateOfRelease = detail2;
                        _albumList.Add(albumInfo);
                    }
                }
                _multiple = true;
            }
            else // found the right one
            {
            }
            return(true);
        }
    /// <summary>
    /// Search on Allmusic for the requested string
    /// </summary>
    /// <param name="searchBy"></param>
    /// <param name="searchStr"></param>
    /// <returns></returns>
    public bool FindInfo(SearchBy searchBy, string searchStr)
    {
      _searchby = searchBy;
      HTMLUtil util = new HTMLUtil();
      string strPostData = "";
      if (SearchBy.Albums == searchBy)
      {
        strPostData = string.Format(ALBUMSEARCH, HttpUtility.UrlEncode(searchStr));
      }
      else
      {
        searchStr = SwitchArtist(searchStr);
        strPostData = string.Format(ARTISTSEARCH, HttpUtility.UrlEncode(searchStr));
      }

      string strHTML = PostHTTP(MAINURL + URLPROGRAM, strPostData);
      if (strHTML.Length == 0)
      {
        return false;
      }

      _htmlCode = strHTML; // save the html content...

      Regex multiples = new Regex(
        @"\sSearch\sResults\sfor:",
        RegexOptions.IgnoreCase
        | RegexOptions.Multiline
        | RegexOptions.IgnorePatternWhitespace
        | RegexOptions.Compiled
        );

      if (multiples.IsMatch(strHTML))
      {
        string pattern = "";
        if (searchBy.ToString().Equals("Artists"))
        {
          pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                    @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                    @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>(?<detail2>.*)</td>";
        }
        else if (searchBy.ToString().Equals("Albums"))
        {
          pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                    @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                    @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>.*</td>\s*?.*<td>(?<detail2>.*)</td>";
        }


        Match m;
        Regex itemsFoundFromSite = new Regex(
          pattern,
          RegexOptions.IgnoreCase
          | RegexOptions.Multiline
          | RegexOptions.IgnorePatternWhitespace
          | RegexOptions.Compiled
          );


        for (m = itemsFoundFromSite.Match(strHTML); m.Success; m = m.NextMatch())
        {
          string code = m.Groups["code"].ToString();
          string name = m.Groups["name"].ToString();
          string detail = m.Groups["detail"].ToString();
          string detail2 = m.Groups["detail2"].ToString();

          util.RemoveTags(ref name);
          util.ConvertHTMLToAnsi(name, out name);

          util.RemoveTags(ref detail);
          util.ConvertHTMLToAnsi(detail, out detail);

          util.RemoveTags(ref detail2);
          util.ConvertHTMLToAnsi(detail2, out detail2);

          if (SearchBy.Artists == searchBy)
          {
            detail += " - " + detail2;
            if (detail.Length > 0)
            {
              _codes.Add(code);
              _values.Add(name + " - " + detail);
            }
            else
            {
              _codes.Add(code);
              _values.Add(name);
            }
          }
          else
          {
            MusicAlbumInfo albumInfo = new MusicAlbumInfo();
            albumInfo.AlbumURL = code;
            albumInfo.Artist = detail;
            albumInfo.Title = name;
            albumInfo.DateOfRelease = detail2;
            _albumList.Add(albumInfo);
          }
        }
        _multiple = true;
      }
      else // found the right one
      {}
      return true;
    }
 private void btnNCT_Tim_Click(object sender, EventArgs e)
 {
     _SearchBy     = SearchBy.TatCa;
     _IsSearchMenu = false;
     Search("http://v6.nhaccuatui.com", _SearchBy.ToString(), _IsSearchMenu);
 }
 private void btnZing_Tim_Click(object sender, EventArgs e)
 {
     _SearchBy     = SearchBy.TatCa;
     _IsSearchMenu = false;
     Search("http://mp3.zing.vn", _SearchBy.ToString(), _IsSearchMenu);
 }
        private void Player_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e)
        {
            if (!Player.status.Contains("Stopped") && Player.currentPlaylist.count == FileList.Count && lvDetails.Items.Count > 0)
            {
                SetRowForcolorDefault();

                foreach (clsFile item in FileList)
                {
                    if (item.StrUrl == Player.currentMedia.sourceURL)
                    {
                        if (ribbonControlMain.SelectedRibbonTabItem == ribbonTabItemNCT)
                        {
                            //next page
                            if (Player.status.Contains("Ready") && Player.currentMedia.duration == 0 &&
                                chkAutoSearch.Checked && _PlayingRow + 1 == Player.currentPlaylist.count && cboNCT_Trang.Items.IndexOf(_CurrentPage) < cboNCT_Trang.Items.Count)
                            {
                                int page = Convert.ToInt32(_CurrentPage.Trim());
                                page++;
                                _CurrentPage = page.ToString();
                                cboNCT_Trang.SelectedIndex = cboNCT_Trang.Items.IndexOf(page.ToString());
                                Search("http://v6.nhaccuatui.com", _SearchBy.ToString(), _IsSearchMenu);
                                return;
                            }
                        }
                        else if (ribbonControlMain.SelectedRibbonTabItem == ribbonTabItemNCT)
                        {
                            //next page
                            if (Player.status.Contains("Ready") && Player.currentMedia.duration == 0 &&
                                chkAutoSearch.Checked && _PlayingRow + 1 == Player.currentPlaylist.count && cboZing_Trang.Items.IndexOf(_CurrentPage) < cboZing_Trang.Items.Count)
                            {
                                int page = Convert.ToInt32(_CurrentPage.Trim());
                                page++;
                                _CurrentPage = page.ToString();
                                cboZing_Trang.SelectedIndex = cboZing_Trang.Items.IndexOf(page.ToString());
                                Search("http://mp3.zing.vn", _SearchBy.ToString(), _IsSearchMenu);
                                return;
                            }
                        }

                        _PlayingRow = FileList.IndexOf(item);
                        if (Convert.ToBoolean(lvDetails.Items[_PlayingRow].Checked))
                        {
                            if (Player.currentMedia.sourceURL.Substring(Player.currentMedia.sourceURL.LastIndexOf(".") + 1).ToUpper() == "flv".ToUpper())
                            {
                                splitContainerMainRight.SplitterDistance = 262;
                            }
                            else
                            {
                                splitContainerMainRight.SplitterDistance = 45;
                            }

                            lvDetails.Items[_PlayingRow].ForeColor = Color.Red;
                            lvDetails.Items[_PlayingRow].Selected  = true;
                            trmState.Start();
                        }
                        else
                        {
                            if (_PlayingRow + 1 < FileList.Count)
                            {
                                _PlayingRow++;
                            }
                            else
                            {
                                _PlayingRow = 0;
                            }
                            lvDetails.Items[_PlayingRow].ForeColor = Color.Red;
                            lvDetails.Items[_PlayingRow].Selected  = true;
                            Player.Ctlcontrols.next();
                        }

                        break;
                    }
                }
            }
        }
示例#10
0
        public ActionResult Search(string searchTerm, SearchBy searchBy, OrderBy orderBy, bool showMyGroupsOnly)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            IEnumerable<Group> myGroups = new List<Group>();

            GroupSearchModel myGroupSearchModel = new GroupSearchModel() {
                SearchResults = myGroups,
                SearchByOptions = new SelectList(theGroupService.SearchByOptions(), "Value", "Key", searchBy.ToString()),
                OrderByOptions = new SelectList(theGroupService.OrderByOptions(), "Value", "Key", orderBy.ToString())
            };

            try {
                UserInformationModel<User> myUser = GetUserInformatonModel();

                myGroups = theGroupService.GetGroups(myUser, searchTerm, searchBy, orderBy, showMyGroupsOnly);

                if (myGroups.Count<Group>() == 0) {
                    ViewData["Message"] = MessageHelper.NormalMessage(NO_GROUPS);
                }

                myGroupSearchModel.SearchResults = myGroups;
            } catch(CustomException anException) {
                ViewData["Message"] = MessageHelper.ErrorMessage(anException.Message);
            } catch (Exception myException) {
                LogError(myException, GROUP_LIST_ERROR);
                ViewData["Message"] = GROUP_LIST_ERROR;
            }

            return View("List", myGroupSearchModel);
        }