PageRenderTime 69ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

/animeplugin3/MyAnimePlugin3/ConfigFiles/frmConfig.cs

https://bitbucket.org/gibwar/jmm-test
C# | 649 lines | 476 code | 162 blank | 11 comment | 54 complexity | bab67d535c6ce3fa73204cba6a09295e MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using MediaPortal.Configuration;
  9. using MyAnimePlugin3.DataHelpers;
  10. using MyAnimePlugin3.Downloads;
  11. using System.Threading;
  12. using MyAnimePlugin3.ViewModel;
  13. namespace MyAnimePlugin3.ConfigFiles
  14. {
  15. public partial class frmConfig : Form
  16. {
  17. #region Attributes
  18. private List<string> folders = new List<string>();
  19. // Timer for auto-scrolling
  20. private System.Windows.Forms.Timer timerDragDrop = new System.Windows.Forms.Timer();
  21. #endregion
  22. private static BackgroundWorker workerBatchLinker = new BackgroundWorker();
  23. #region General
  24. public frmConfig()
  25. {
  26. InitializeComponent();
  27. btnImagesLocation.Click += new EventHandler(btnImagesLocation_Click);
  28. btnSelectLocalFolderPath.Click += new EventHandler(btnSelectLocalFolderPath_Click);
  29. btnUTorrentTest.Click += new EventHandler(btnUTorrentTest_Click);
  30. btnMoveTorrentIn.Click += new EventHandler(btnMoveTorrentIn_Click);
  31. btnMoveTorrentOut.Click += new EventHandler(btnMoveTorrentOut_Click);
  32. btnTorrentUp.Click += new EventHandler(btnTorrentUp_Click);
  33. btnTorrentDown.Click += new EventHandler(btnTorrentDown_Click);
  34. btnBakaBTTest.Click += new EventHandler(btnBakaBTTest_Click);
  35. btnAnimeBytesTest.Click += new EventHandler(btnAnimeBytesTest_Click);
  36. // File naming
  37. cboFileFormat.Items.Clear();
  38. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.Group);
  39. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.GroupShort);
  40. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.AudioCodec);
  41. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.FileCodec);
  42. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.FileRes);
  43. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.FileSource);
  44. cboFileFormat.Items.Add(Constants.FileSelectionDisplayString.VideoBitDepth);
  45. cboFileFormat.SelectedIndexChanged += new EventHandler(cboFileFormat_SelectedIndexChanged);
  46. cboFileFormat.SelectedIndex = 0;
  47. btnAddFileFormat.Click += new EventHandler(btnAddFileFormat_Click);
  48. // Episode naming
  49. cboEpisodeFormat.Items.Clear();
  50. cboEpisodeFormat.Items.Add(Constants.EpisodeDisplayString.EpisodeNumber);
  51. cboEpisodeFormat.Items.Add(Constants.EpisodeDisplayString.EpisodeName);
  52. cboEpisodeFormat.SelectedIndexChanged += new EventHandler(cboEpisodeFormat_SelectedIndexChanged);
  53. cboEpisodeFormat.SelectedIndex = 0;
  54. btnAddEpisodeFormat.Click += new EventHandler(btnAddEpisodeFormat_Click);
  55. //get list of languages (sorted by name)
  56. List<string> lstLanguages = Utils.GetAllAudioSubtitleLanaguages();
  57. //add them to the combo boxes
  58. // audio languages
  59. cboAudioLanguage.Items.Clear();
  60. cboAudioLanguage.Items.Add("< Use File Default >");
  61. foreach (string lang in lstLanguages)
  62. cboAudioLanguage.Items.Add(lang);
  63. cboSubtitleLanguage.Items.Clear();
  64. cboSubtitleLanguage.Items.Add("< Use File Default >");
  65. cboSubtitleLanguage.Items.Add("< No Subtitles >");
  66. // subtitle languages
  67. foreach (string lang in lstLanguages)
  68. cboSubtitleLanguage.Items.Add(lang);
  69. LoadSettingsIntoForm();
  70. cboImagesLocation.Items.Clear();
  71. cboImagesLocation.Items.Add("Default");
  72. cboImagesLocation.Items.Add("Custom");
  73. cboImagesLocation.SelectedIndexChanged += new EventHandler(cboImagesLocation_SelectedIndexChanged);
  74. if (BaseConfig.Settings.HasCustomThumbsFolder)
  75. cboImagesLocation.SelectedIndex = 1;
  76. else
  77. cboImagesLocation.SelectedIndex = 0;
  78. chkShowMissing.Click += new EventHandler(chkShowMissing_Click);
  79. lblDisplayEpsDesc.Visible = true;
  80. ToolTip ToolTip4 = new ToolTip();
  81. ToolTip4.IsBalloon = true;
  82. ToolTip4.ToolTipIcon = ToolTipIcon.Info;
  83. ToolTip4.ToolTipTitle = "Poster Quality";
  84. ToolTip4.SetToolTip(udPosterQuality, "Used to adjust the quality of images shown in the coverflow and filmstrip layouts. \nSelecting a lower percentage will result in lower memory and CPU usage. Resolution at 100% is 1000 x 680");
  85. ToolTip ToolTip5 = new ToolTip();
  86. ToolTip5.IsBalloon = true;
  87. ToolTip5.ToolTipIcon = ToolTipIcon.Info;
  88. ToolTip5.ToolTipTitle = "Wide Banner Quality";
  89. ToolTip5.SetToolTip(udWideBannerQuality, "Used to adjust the quality of images shown in the Wide Banner layouts. \nSelecting a lower percentage will result in lower memory and CPU usage. Resolution at 100% is 758 x 140");
  90. ToolTip ToolTip6 = new ToolTip();
  91. ToolTip6.IsBalloon = true;
  92. ToolTip6.ToolTipIcon = ToolTipIcon.Info;
  93. ToolTip6.ToolTipTitle = "Singles Series Display";
  94. ToolTip6.SetToolTip(chkSingleSeries, "When a group only has one series, the series name will be displayed instead of the group name. This could have a performance impact in large collections");
  95. System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
  96. if (a != null)
  97. {
  98. lblVersion.Text = "Version " + Utils.GetApplicationVersion(a);
  99. }
  100. lbImportFolders.DisplayMember = "Description";
  101. btnTestJMMServer.Click += new EventHandler(btnTestJMMServer_Click);
  102. lbImportFolders.SelectedIndexChanged += new EventHandler(lbImportFolders_SelectedIndexChanged);
  103. btnSaveLocalFolderPath.Click += new EventHandler(btnSaveLocalFolderPath_Click);
  104. InitJMMConnection();
  105. }
  106. void btnSaveLocalFolderPath_Click(object sender, EventArgs e)
  107. {
  108. ImportFolderVM fldr = lbImportFolders.SelectedItem as ImportFolderVM;
  109. if (fldr == null) return;
  110. BaseConfig.Settings.SetImportFolderMapping(fldr.ImportFolderID.Value, txtFolderLocalPath.Text.Trim());
  111. BaseConfig.Settings.Save();
  112. }
  113. void btnSelectLocalFolderPath_Click(object sender, EventArgs e)
  114. {
  115. FolderBrowserDialog dlg = new FolderBrowserDialog();
  116. dlg.Description = "Select a folder";
  117. if (dlg.ShowDialog() == DialogResult.OK)
  118. {
  119. txtFolderLocalPath.Text = dlg.SelectedPath;
  120. }
  121. }
  122. void lbImportFolders_SelectedIndexChanged(object sender, EventArgs e)
  123. {
  124. txtFolderLocalPath.Text = "";
  125. ImportFolderVM fldr = lbImportFolders.SelectedItem as ImportFolderVM;
  126. if (fldr == null) return;
  127. txtFolderLocalPath.Text = fldr.LocalPath;
  128. }
  129. void btnTestJMMServer_Click(object sender, EventArgs e)
  130. {
  131. SaveSettings();
  132. if (InitJMMConnection())
  133. MessageBox.Show("Success!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  134. }
  135. private bool InitJMMConnection()
  136. {
  137. //lbImportFolders.DataSource = null;
  138. lbImportFolders.Items.Clear();
  139. if (!JMMServerVM.Instance.SetupBinaryClient())
  140. {
  141. MessageBox.Show("Could not connect to JMM Server", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  142. return false;
  143. }
  144. // refresh import folders
  145. foreach (ImportFolderVM fldr in JMMServerVM.Instance.ImportFolders)
  146. lbImportFolders.Items.Add(fldr);
  147. return true;
  148. }
  149. void chkShowMissing_Click(object sender, EventArgs e)
  150. {
  151. if (!chkShowMissing.Checked)
  152. {
  153. chkShowMissingGroups.Checked = false;
  154. chkShowMissingGroups.Enabled = false;
  155. }
  156. else
  157. chkShowMissingGroups.Enabled = true;
  158. }
  159. void btnTorrentDown_Click(object sender, EventArgs e)
  160. {
  161. if (lstTorrentIn.SelectedItem == null) return;
  162. if (lstTorrentIn.SelectedIndex == lstTorrentIn.Items.Count - 1) return; // already at bottom
  163. string src = lstTorrentIn.SelectedItem.ToString();
  164. int newPos = lstTorrentIn.SelectedIndex + 1;
  165. lstTorrentIn.Items.RemoveAt(lstTorrentIn.SelectedIndex);
  166. lstTorrentIn.Items.Insert(newPos, src);
  167. lstTorrentIn.SelectedIndex = newPos;
  168. }
  169. void btnTorrentUp_Click(object sender, EventArgs e)
  170. {
  171. if (lstTorrentIn.SelectedItem == null) return;
  172. if (lstTorrentIn.SelectedIndex == 0) return; // already at top
  173. string src = lstTorrentIn.SelectedItem.ToString();
  174. int newPos = lstTorrentIn.SelectedIndex - 1;
  175. lstTorrentIn.Items.RemoveAt(lstTorrentIn.SelectedIndex);
  176. lstTorrentIn.Items.Insert(newPos, src);
  177. lstTorrentIn.SelectedIndex = newPos;
  178. }
  179. void btnMoveTorrentOut_Click(object sender, EventArgs e)
  180. {
  181. if (lstTorrentIn.SelectedItem == null) return;
  182. string src = lstTorrentIn.SelectedItem.ToString();
  183. lstTorrentOut.Items.Add(src);
  184. lstTorrentIn.Items.RemoveAt(lstTorrentIn.SelectedIndex);
  185. }
  186. void btnMoveTorrentIn_Click(object sender, EventArgs e)
  187. {
  188. if (lstTorrentOut.SelectedItem == null) return;
  189. string src = lstTorrentOut.SelectedItem.ToString();
  190. lstTorrentIn.Items.Add(src);
  191. lstTorrentOut.Items.RemoveAt(lstTorrentOut.SelectedIndex);
  192. }
  193. void btnUTorrentTest_Click(object sender, EventArgs e)
  194. {
  195. SaveSettings();
  196. List<Torrent> torrents = new List<Torrent>();
  197. UTorrentHelper uTorrent = new UTorrentHelper();
  198. uTorrent.Init();
  199. if (uTorrent.GetTorrentList(ref torrents))
  200. {
  201. MessageBox.Show(string.Format("Connected successfully, {0} torrents in list currently", torrents.Count));
  202. }
  203. else
  204. {
  205. MessageBox.Show("Connection failed");
  206. }
  207. }
  208. void btnAnimeBytesTest_Click(object sender, EventArgs e)
  209. {
  210. try
  211. {
  212. SaveSettings();
  213. if (string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesUsername))
  214. {
  215. MessageBox.Show("Please enter a username first");
  216. txtAnimeBytesUsername.Focus();
  217. return;
  218. }
  219. if (string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesPassword))
  220. {
  221. MessageBox.Show("Please enter a password first");
  222. txtAnimeBytesPassword.Focus();
  223. return;
  224. }
  225. this.Cursor = Cursors.WaitCursor;
  226. TorrentsAnimeBytes AnimeBytes = new TorrentsAnimeBytes();
  227. BaseConfig.Settings.AnimeBytesCookieHeader = AnimeBytes.Login(BaseConfig.Settings.AnimeBytesUsername, BaseConfig.Settings.AnimeBytesPassword);
  228. if (!string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesCookieHeader))
  229. {
  230. this.Cursor = Cursors.Arrow;
  231. MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
  232. }
  233. else
  234. {
  235. this.Cursor = Cursors.Arrow;
  236. MessageBox.Show("Connected FAILED", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  237. txtAnimeBytesUsername.Focus();
  238. return;
  239. }
  240. }
  241. catch (Exception ex)
  242. {
  243. this.Cursor = Cursors.Arrow;
  244. MessageBox.Show(ex.Message);
  245. }
  246. }
  247. void btnBakaBTTest_Click(object sender, EventArgs e)
  248. {
  249. try
  250. {
  251. SaveSettings();
  252. if (string.IsNullOrEmpty(BaseConfig.Settings.BakaBTUsername))
  253. {
  254. MessageBox.Show("Please enter a username first");
  255. txtBakaBTUsername.Focus();
  256. return;
  257. }
  258. if (string.IsNullOrEmpty(BaseConfig.Settings.BakaBTPassword))
  259. {
  260. MessageBox.Show("Please enter a password first");
  261. txtBakaBTPassword.Focus();
  262. return;
  263. }
  264. this.Cursor = Cursors.WaitCursor;
  265. TorrentsBakaBT bakaBT = new TorrentsBakaBT();
  266. BaseConfig.Settings.BakaBTCookieHeader = bakaBT.Login(BaseConfig.Settings.BakaBTUsername, BaseConfig.Settings.BakaBTPassword);
  267. if (!string.IsNullOrEmpty(BaseConfig.Settings.BakaBTCookieHeader))
  268. {
  269. this.Cursor = Cursors.Arrow;
  270. MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
  271. }
  272. else
  273. {
  274. this.Cursor = Cursors.Arrow;
  275. MessageBox.Show("Connected FAILED", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  276. txtBakaBTUsername.Focus();
  277. return;
  278. }
  279. }
  280. catch (Exception ex)
  281. {
  282. this.Cursor = Cursors.Arrow;
  283. MessageBox.Show(ex.Message);
  284. }
  285. }
  286. void cboEpisodeFormat_SelectedIndexChanged(object sender, EventArgs e)
  287. {
  288. switch (cboEpisodeFormat.SelectedIndex)
  289. {
  290. case 0:
  291. lblDisplayEpsDesc.Text = "Episode Number (e.g. 13)"; break;
  292. case 1:
  293. lblDisplayEpsDesc.Text = "Episode Title (e.g Destined Meeting)"; break;
  294. }
  295. }
  296. void btnAddEpisodeFormat_Click(object sender, EventArgs e)
  297. {
  298. txtFormatEp.Text += cboEpisodeFormat.SelectedItem.ToString();
  299. }
  300. void btnAddFileFormat_Click(object sender, EventArgs e)
  301. {
  302. txtFileSelection.Text += cboFileFormat.SelectedItem.ToString(); ;
  303. }
  304. void cboFileFormat_SelectedIndexChanged(object sender, EventArgs e)
  305. {
  306. switch (cboFileFormat.SelectedIndex)
  307. {
  308. case 0:
  309. lblFileSelectionVars.Text = "Group (e.g. Datte Bayo)"; break;
  310. case 1:
  311. lblFileSelectionVars.Text = "Group Short (e.g DB)"; break;
  312. case 2:
  313. lblFileSelectionVars.Text = "Audio Codec (e.g OGG Vorbis)"; break;
  314. case 3:
  315. lblFileSelectionVars.Text = "File Codec (e.g XVid)"; break;
  316. case 4:
  317. lblFileSelectionVars.Text = "File Res (e.g 1280x720)"; break;
  318. case 5:
  319. lblFileSelectionVars.Text = "File Source (e.g DVD)"; break;
  320. }
  321. }
  322. protected override void OnClosing(CancelEventArgs e)
  323. {
  324. SaveSettings();
  325. base.OnClosing(e);
  326. }
  327. private void SaveSettings()
  328. {
  329. BaseConfig.Settings.PluginName = txtPluginName.Text.Trim();
  330. BaseConfig.Settings.JMMServer_Address = txtJMMServerAddress.Text.Trim();
  331. BaseConfig.Settings.JMMServer_Port = txtJMMServerPort.Text.Trim();
  332. BaseConfig.Settings.UTorrentAddress = txtUTorrentAddress.Text.Trim();
  333. BaseConfig.Settings.UTorrentPassword = txtUTorrentPassword.Text.Trim();
  334. BaseConfig.Settings.UTorrentPort = txtUTorrentPort.Text.Trim();
  335. BaseConfig.Settings.UTorrentUsername = txtUTorrentUsername.Text.Trim();
  336. BaseConfig.Settings.TorrentPreferOwnGroups = chkTorrentPreferOwnGroups.Checked;
  337. BaseConfig.Settings.BakaBTUsername = txtBakaBTUsername.Text.Trim();
  338. BaseConfig.Settings.BakaBTPassword = txtBakaBTPassword.Text.Trim();
  339. BaseConfig.Settings.AnimeBytesUsername = txtAnimeBytesUsername.Text.Trim();
  340. BaseConfig.Settings.AnimeBytesPassword = txtAnimeBytesPassword.Text.Trim();
  341. if (cboImagesLocation.SelectedIndex == 0) // default
  342. BaseConfig.Settings.ThumbsFolder = "";
  343. else // custom
  344. BaseConfig.Settings.ThumbsFolder = txtImagesLocation.Text.Trim();
  345. BaseConfig.Settings.WatchedPercentage = int.Parse(udWatched.Value.ToString());
  346. BaseConfig.Settings.ShowMissing = chkShowMissing.Checked;
  347. BaseConfig.Settings.ShowMissingMyGroupsOnly = chkShowMissingGroups.Checked;
  348. BaseConfig.Settings.HideWatchedFiles = chkHideWatchedFiles.Checked;
  349. BaseConfig.Settings.DisplayRatingDialogOnCompletion = chkRateSeries.Checked;
  350. BaseConfig.Settings.SingleSeriesGroups = chkSingleSeries.Checked;
  351. if (cboAudioLanguage.SelectedIndex == 0)
  352. BaseConfig.Settings.DefaultAudioLanguage = "<file>";
  353. else
  354. BaseConfig.Settings.DefaultAudioLanguage = cboAudioLanguage.SelectedItem.ToString();
  355. if (cboSubtitleLanguage.SelectedIndex == 0)
  356. BaseConfig.Settings.DefaultSubtitleLanguage = "<file>";
  357. else if (cboSubtitleLanguage.SelectedIndex == 1)
  358. BaseConfig.Settings.DefaultSubtitleLanguage = "<none>";
  359. else
  360. BaseConfig.Settings.DefaultSubtitleLanguage = cboSubtitleLanguage.SelectedItem.ToString();
  361. BaseConfig.Settings.FindTimeout_s = (int)nudFindTimeout.Value;
  362. BaseConfig.Settings.FindFilter = chkFindFilterItems.Checked;
  363. BaseConfig.Settings.EpisodeDisplayFormat = txtFormatEp.Text.Trim();
  364. BaseConfig.Settings.fileSelectionDisplayFormat = txtFileSelection.Text.Trim();
  365. BaseConfig.Settings.HidePlot = chkHidePlot.Checked;
  366. BaseConfig.Settings.ShowOnlyAvailableEpisodes = chkShowAvailableEpsOnly.Checked;
  367. BaseConfig.Settings.PosterSizePct = (int)udPosterQuality.Value;
  368. BaseConfig.Settings.BannerSizePct = (int)udWideBannerQuality.Value;
  369. BaseConfig.Settings.InfoDelay = (int)udInfoDelay.Value;
  370. BaseConfig.Settings.FfdshowNotificationsShow = chkFfdshowNotificationsShow.Checked;
  371. BaseConfig.Settings.FfdshowNotificationsAutoClose = chkFfdshowNotificationsAutoClose.Checked;
  372. BaseConfig.Settings.FfdshowNotificationsLock = chkFfdshowNotificationsLock.Checked;
  373. int iClose = 0;
  374. int.TryParse(txtFfdshowNotificationsAutoCloseTime.Text, out iClose);
  375. BaseConfig.Settings.FfdshowNotificationsAutoCloseTime = iClose;
  376. int iLock = 0;
  377. int.TryParse(txtFfdshowNotificationsAutoCloseTime.Text, out iLock);
  378. BaseConfig.Settings.FfdshowNotificationsLockTime = iLock;
  379. BaseConfig.Settings.TorrentSources.Clear();
  380. foreach (object srco in lstTorrentIn.Items)
  381. {
  382. string src = srco as string;
  383. BaseConfig.Settings.TorrentSources.Add(src);
  384. }
  385. BaseConfig.Settings.Save();
  386. }
  387. private void LoadSettingsIntoForm()
  388. {
  389. txtPluginName.Text = BaseConfig.Settings.PluginName;
  390. txtJMMServerAddress.Text = BaseConfig.Settings.JMMServer_Address;
  391. txtJMMServerPort.Text = BaseConfig.Settings.JMMServer_Port;
  392. txtUTorrentAddress.Text = BaseConfig.Settings.UTorrentAddress;
  393. txtUTorrentPassword.Text = BaseConfig.Settings.UTorrentPassword;
  394. txtUTorrentPort.Text = BaseConfig.Settings.UTorrentPort;
  395. txtUTorrentUsername.Text = BaseConfig.Settings.UTorrentUsername;
  396. txtBakaBTUsername.Text = BaseConfig.Settings.BakaBTUsername;
  397. txtBakaBTPassword.Text = BaseConfig.Settings.BakaBTPassword;
  398. txtAnimeBytesUsername.Text = BaseConfig.Settings.AnimeBytesUsername;
  399. txtAnimeBytesPassword.Text = BaseConfig.Settings.AnimeBytesPassword;
  400. chkTorrentPreferOwnGroups.Checked = BaseConfig.Settings.TorrentPreferOwnGroups;
  401. udWatched.Value = BaseConfig.Settings.WatchedPercentage;
  402. chkShowMissing.Checked = BaseConfig.Settings.ShowMissing;
  403. chkShowMissingGroups.Checked = BaseConfig.Settings.ShowMissingMyGroupsOnly;
  404. chkRateSeries.Checked = BaseConfig.Settings.DisplayRatingDialogOnCompletion;
  405. chkSingleSeries.Checked = BaseConfig.Settings.SingleSeriesGroups;
  406. if (!BaseConfig.Settings.ShowMissing) chkShowMissingGroups.Enabled = false;
  407. chkHideWatchedFiles.Checked = BaseConfig.Settings.HideWatchedFiles;
  408. int index = cboAudioLanguage.FindStringExact(BaseConfig.Settings.DefaultAudioLanguage);
  409. if (index > 0)
  410. cboAudioLanguage.SelectedIndex = index;
  411. else
  412. cboAudioLanguage.SelectedIndex = 0;
  413. index = cboSubtitleLanguage.FindStringExact(BaseConfig.Settings.DefaultSubtitleLanguage);
  414. if (index > 1)
  415. cboSubtitleLanguage.SelectedIndex = index;
  416. else if (BaseConfig.Settings.DefaultSubtitleLanguage == "<none>")
  417. cboSubtitleLanguage.SelectedIndex = 1;
  418. else
  419. cboSubtitleLanguage.SelectedIndex = 0;
  420. nudFindTimeout.Value = (decimal)BaseConfig.Settings.FindTimeout_s;
  421. chkFindFilterItems.Checked = BaseConfig.Settings.FindFilter;
  422. udInfoDelay.Value = (decimal)BaseConfig.Settings.InfoDelay;
  423. txtFormatEp.Text = BaseConfig.Settings.EpisodeDisplayFormat;
  424. txtFileSelection.Text = BaseConfig.Settings.fileSelectionDisplayFormat;
  425. chkShowAvailableEpsOnly.Checked = BaseConfig.Settings.ShowOnlyAvailableEpisodes;
  426. chkHidePlot.Checked = BaseConfig.Settings.HidePlot;
  427. udPosterQuality.Value = (decimal)BaseConfig.Settings.PosterSizePct;
  428. udWideBannerQuality.Value = (decimal)BaseConfig.Settings.BannerSizePct;
  429. chkFfdshowNotificationsShow.Checked = BaseConfig.Settings.FfdshowNotificationsShow;
  430. chkFfdshowNotificationsAutoClose.Checked = BaseConfig.Settings.FfdshowNotificationsAutoClose;
  431. chkFfdshowNotificationsLock.Checked = BaseConfig.Settings.FfdshowNotificationsLock;
  432. txtFfdshowNotificationsAutoCloseTime.Text = BaseConfig.Settings.FfdshowNotificationsAutoCloseTime.ToString();
  433. txtFfdshowNotificationsLockTime.Text = BaseConfig.Settings.FfdshowNotificationsLockTime.ToString();
  434. // get a full list of torrent sources
  435. string[] allSources = AnimePluginSettings.TorrentSourcesAll.Split(';');
  436. foreach (string src in BaseConfig.Settings.TorrentSources)
  437. {
  438. lstTorrentIn.Items.Add(src);
  439. }
  440. foreach (string src in allSources)
  441. {
  442. if (!BaseConfig.Settings.TorrentSources.Contains(src))
  443. lstTorrentOut.Items.Add(src);
  444. }
  445. }
  446. #endregion
  447. #region Tab 'Main'
  448. void btnImagesLocation_Click(object sender, EventArgs e)
  449. {
  450. FolderBrowserDialog dlg = new FolderBrowserDialog();
  451. dlg.Description = "Select a folder";
  452. if (dlg.ShowDialog() == DialogResult.OK)
  453. {
  454. txtImagesLocation.Text = dlg.SelectedPath;
  455. }
  456. }
  457. void cboImagesLocation_SelectedIndexChanged(object sender, EventArgs e)
  458. {
  459. if (cboImagesLocation.Text == "Default")
  460. {
  461. btnImagesLocation.Enabled = false;
  462. txtImagesLocation.Enabled = false;
  463. BaseConfig.Settings.ThumbsFolder = "";
  464. }
  465. else
  466. {
  467. btnImagesLocation.Enabled = true;
  468. txtImagesLocation.Enabled = true;
  469. //settings.ThumbsFolder = txtImagesLocation.Text.Trim();
  470. }
  471. txtImagesLocation.Text = BaseConfig.Settings.ThumbsFolder;
  472. }
  473. #endregion
  474. private void WebsiteLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  475. {
  476. Process.Start("http://www.otakumm.com");
  477. }
  478. private void ForumLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  479. {
  480. Process.Start("http://www.otakumm.com/forum");
  481. }
  482. private void ManualLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  483. {
  484. Process.Start("www.otakumm.com/Anime2Wiki/Manual");
  485. }
  486. }
  487. }