public PluginForm(Subtitle subtitle) { InitializeComponent(); _subtitle = subtitle; // Save user-configuartions on form-close. FormClosing += delegate { _configs.SaveConfigurations(); }; linkLabelGithub.Click += (sender, e) => System.Diagnostics.Process.Start(linkLabelGithub.Tag.ToString()); // donate handler pictureBoxDonate.Click += (s, e) => { System.Diagnostics.Process.Start(StringUtils.DonateUrl); }; // disable triggerer controls ChangeControlsState(false); LoadConfigurations(); _lineUnbreakerController = new LinesUnbreakerController(subtitle.Paragraphs, _configs); _lineUnbreakerController.TextUnbreaked += LineUnbreakerControllerTextUnbreaked; // restore trigger states ChangeControlsState(true); GeneratePreview(); }
public void LoadConfigurations() { string configFile = Path.Combine(FileUtils.Plugins, "linesunbreaker-config.xml"); // load configuration from file if (File.Exists(configFile)) { _configs = UnBreakConfigs.LoadConfiguration(configFile); } else { _configs = new UnBreakConfigs(configFile); _configs.SaveConfigurations(); } checkBoxMoods.Checked = _configs.SkipMoods; checkBoxSkipDialog.Checked = _configs.SkipDialogs; checkBoxSkipNarrator.Checked = _configs.SkipNarrator; if (_configs.MaxLineLength < numericUpDown1.Minimum) { _configs.MaxLineLength = Convert.ToInt32(numericUpDown1.Minimum); numericUpDown1.Minimum = 0; } else { numericUpDown1.Value = _configs.MaxLineLength; } }
public PluginForm(Subtitle subtitle) { InitializeComponent(); _subtitle = subtitle; // Save user-configuartions on form-close. FormClosing += delegate { _configs.SaveConfigurations(); }; LoadConfigurations(); _lineUnbreakerController = new LinesUnbreakerController(subtitle.Paragraphs, _configs); _lineUnbreakerController.TextUnbreaked += LineUnbreakerControllerTextUnbreaked; _isLoading = false; GeneratePreview(); }