/// <summary> /// Display the results of the search /// </summary> /// <param name="csResults">Object that holds the search details</param> private void DisplayResults(csEHSearch csResults) { if (csResults.Count > 0) { lvDetails.SuspendLayout(); lvDetails.Items.Clear(); for (int i = 0; i < csResults.Count; i++) { ListViewItem lvi = new ListViewItem(new string[2] { csResults.URL(i), csResults.Title(i) }); lvi.ToolTipText = csResults.Title(i); lvDetails.Items.Add(lvi); } lvDetails.Alternate(); lvDetails.ResumeLayout(); } this.Cursor = Cursors.Default; ToggleButtonEnabled(ref btnSearch); this.Text = "Search found " + csResults.Count + " possible matches"; }
/// <summary> /// Display the results of the search /// </summary> /// <param name="csResults">Object that holds the search details</param> private void DisplayResults(csEHSearch csResults) { if (csResults.Count > 0) { lvDetails.BeginUpdate(); lvDetails.Items.Clear(); for (int i = 0; i < csResults.Count; i++) { ListViewItem lvi = new ListViewItem(new string[2] { csResults.URL(i), csResults.Title(i) }); lvi.ToolTipText = csResults.Title(i); lvDetails.Items.Add(lvi); } lvDetails.Alternate(); lvDetails.EndUpdate(); } Cursor = Cursors.Default; ToggleButtonEnabled(ref btnSearch); Text = "Search found " + csResults.Count + " possible matches"; }
/// <summary> /// Combines existing manga details with auto-selected gallery metadata /// </summary> /// <param name="iMangaID">The PK of the manga to update</param> public csEntry(int iMangaID) { using (DataTable dt = SQL.GetManga(iMangaID)) { if (dt.Rows.Count == 1 && string.IsNullOrWhiteSpace(dt.Rows[0]["GalleryURL"].ToString())) { StringBuilder sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(dt.Rows[0]["Artist"].ToString())) { sb.AppendFormat("\"{0}\" ", dt.Rows[0]["Artist"].ToString()); } sb.AppendFormat("\"{0}\" language:english", dt.Rows[0]["Title"].ToString()); csEHSearch csSearch = new csEHSearch(sb.ToString()); if (csSearch.Count > 0) { csEHSearch.gmetadata manga = null; manga = csEHSearch.LoadMetadata(csSearch.URL(0)); if (manga != null && !manga.APIError) { if (string.IsNullOrWhiteSpace(dt.Rows[0]["Artist"].ToString()) || string.IsNullOrWhiteSpace(dt.Rows[0]["Title"].ToString())) { Artist = dt.Rows[0]["Artist"].ToString(); Title = dt.Rows[0]["Title"].ToString(); } else { Artist = dt.Rows[0]["Artist"].ToString(); Title = dt.Rows[0]["Title"].ToString(); } URL = csSearch.URL(0); Category = manga.category; MangaRead = dt.Rows[0]["MangaRead"].ToString() == "1"; PageReadCount = int.Parse(dt.Rows[0]["PageReadCount"].ToString()); Description = dt.Rows[0]["Description"].ToString(); Location = dt.Rows[0]["Location"].ToString(); Tags = manga.GetTags(dt.Rows[0]["Tags"].ToString()); PageCount = (ushort)manga.filecount; PostedDate = manga.posted; } else { SQL.LogMessage("Failed to get manga metadata", SQL.EventType.NetworkingEvent, csSearch.URL(0)); } } } } }