/// <summary> /// TODO : Change to Regex /// Get Post ids of all Posts /// </summary> /// <param name="htmlDump"> /// The html Dump. /// </param> /// <returns> /// The extract thread to posts html. /// </returns> public static List <ImageInfo> ExtractThreadtoPostsHtml(string htmlDump) { var rtnList = new List <ImageInfo>(); const string Start = "<a name=\"post"; var sEnd = "\" href"; var sCopy = htmlDump; var iStart = 0; iStart = sCopy.IndexOf(Start, iStart); while (iStart >= 0) { var iEnd = sCopy.IndexOf(sEnd, iStart); var sPostId = sCopy.Substring(iStart + Start.Length, iEnd - (iStart + Start.Length)); var newThumbPicPool = new ImageInfo { ImageUrl = sPostId }; // iEnd = 0; if (Utility.IsNumeric(sPostId) && !string.IsNullOrEmpty(sPostId)) { rtnList.Add(newThumbPicPool); } iStart = sCopy.IndexOf(Start, iStart + sEnd.Length); } return(rtnList); }
/// <summary> /// Close Dialog and Save Changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OkButtonClick(object sender, EventArgs e) { string mbThreadNum = this.resourceManager.GetString("mbThreadNum"), mbThreadbetw = this.resourceManager.GetString("mbThreadbetw"), mbNum = this.resourceManager.GetString("mbNum"); if (!Utility.IsNumeric(this.numericUDThreads.Text)) { MessageBox.Show(this, mbThreadNum); return; } if (!Utility.IsNumeric(this.numericUDThanks.Text)) { MessageBox.Show(this, mbNum); return; } if (Convert.ToInt32(this.numericUDThreads.Text) > 20 || Convert.ToInt32(this.numericUDThreads.Text) < 1) { MessageBox.Show(this, mbThreadbetw); return; } ThreadManager.GetInstance().SetThreadThreshHold(Convert.ToInt32(this.numericUDThreads.Text)); SettingsHelper.SaveSetting("Thread Limit", this.numericUDThreads.Text); SettingsHelper.SaveSetting("minImageCountThanks", this.numericUDThanks.Text); SettingsHelper.SaveSetting("SubDirs", this.checkBox1.Checked.ToString()); SettingsHelper.SaveSetting("Auto TK Button", this.checkBox8.Checked.ToString()); SettingsHelper.SaveSetting("clipBoardWatch", this.checkBox10.Checked.ToString()); SettingsHelper.SaveSetting("Show Popups", this.showTrayPopups.Checked.ToString()); SettingsHelper.SaveSetting("Always OnTop", this.checkBox5.Checked.ToString()); SettingsHelper.SaveSetting("DownInSepFolder", this.mDownInSepFolderChk.Checked.ToString()); SettingsHelper.SaveSetting("SaveRippedPosts", this.saveHistoryChk.Checked.ToString()); SettingsHelper.SaveSetting("Show Downloads Complete PopUp", this.checkBox9.Checked.ToString()); SettingsHelper.SaveSetting("ShowLastDownloaded", this.checkBox11.Checked.ToString()); switch (this.languageSelector.SelectedIndex) { case 0: SettingsHelper.SaveSetting("UserLanguage", "de-DE"); break; case 1: SettingsHelper.SaveSetting("UserLanguage", "fr-FR"); break; case 2: SettingsHelper.SaveSetting("UserLanguage", "en-EN"); break; /*case 3: * SettingsHelper.SaveSetting("UserLanguage", "zh-CN"); * break;*/ } this.Close(); }
/// <summary> /// Close Dialog and Save Changes /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OkButtonClick(object sender, EventArgs e) { try { string mbThreadNum = this.resourceManager.GetString("mbThreadNum"), mbThreadbetw = this.resourceManager.GetString("mbThreadbetw"), mbNum = this.resourceManager.GetString("mbNum"); if (!Utility.IsNumeric(this.numericUDThreads.Text)) { MessageBox.Show(this, mbThreadNum); return; } if (!Utility.IsNumeric(this.numericUDThanks.Text)) { MessageBox.Show(this, mbNum); return; } if (Convert.ToInt32(this.numericUDThreads.Text) > 20 || Convert.ToInt32(this.numericUDThreads.Text) < 1) { MessageBox.Show(this, mbThreadbetw); return; } ThreadManager.GetInstance().SetThreadThreshHold(Convert.ToInt32(this.numericUDThreads.Text)); CacheController.Instance().UserSettings.ThreadLimit = Convert.ToInt32(this.numericUDThreads.Text); CacheController.Instance().UserSettings.MinImageCount = Convert.ToInt32(this.numericUDThanks.Text); CacheController.Instance().UserSettings.SubDirs = this.checkBox1.Checked; CacheController.Instance().UserSettings.AutoThank = this.checkBox8.Checked; CacheController.Instance().UserSettings.ClipBWatch = this.checkBox10.Checked; CacheController.Instance().UserSettings.ShowPopUps = this.showTrayPopups.Checked; CacheController.Instance().UserSettings.TopMost = this.checkBox5.Checked; CacheController.Instance().UserSettings.DownInSepFolder = this.mDownInSepFolderChk.Checked; CacheController.Instance().UserSettings.SavePids = this.saveHistoryChk.Checked; CacheController.Instance().UserSettings.ShowCompletePopUp = this.checkBox9.Checked; CacheController.Instance().UserSettings.ShowLastDownloaded = this.checkBox11.Checked; switch (this.languageSelector.SelectedIndex) { case 0: CacheController.Instance().UserSettings.Language = "de-DE"; break; case 1: CacheController.Instance().UserSettings.Language = "fr-FR"; break; case 2: CacheController.Instance().UserSettings.Language = "en-EN"; break; } } finally { SettingsHelper.SaveSettings(CacheController.Instance().UserSettings); this.Close(); } }