private void LoadSettings() { Icon = ShareXResources.Icon; // General foreach (SupportedLanguage language in Helpers.GetEnums <SupportedLanguage>()) { ToolStripMenuItem tsmi = new ToolStripMenuItem(language.GetLocalizedDescription()); tsmi.Image = GetLanguageIcon(language); tsmi.ImageScaling = ToolStripItemImageScaling.None; SupportedLanguage lang = language; tsmi.Click += (sender, e) => ChangeLanguage(lang); cmsLanguages.Items.Add(tsmi); } ChangeLanguage(Program.Settings.Language); cbShowTray.Checked = Program.Settings.ShowTray; cbSilentRun.Enabled = Program.Settings.ShowTray; cbSilentRun.Checked = Program.Settings.SilentRun; cbStartWithWindows.Checked = ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup); //RegistryHelper.CheckStartWithWindows(); cbSendToMenu.Checked = ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.SendTo); cbShellContextMenu.Checked = RegistryHelpers.CheckShellContextMenu(); cbTrayIconProgressEnabled.Checked = Program.Settings.TrayIconProgressEnabled; cbTaskbarProgressEnabled.Enabled = TaskbarManager.IsPlatformSupported; cbTaskbarProgressEnabled.Checked = Program.Settings.TaskbarProgressEnabled; cbRememberMainFormPosition.Checked = Program.Settings.RememberMainFormPosition; cbRememberMainFormSize.Checked = Program.Settings.RememberMainFormSize; // Paths txtPersonalFolderPath.Text = Program.ReadPersonalPathConfig(); UpdatePersonalFolderPathPreview(); cbUseCustomScreenshotsPath.Checked = Program.Settings.UseCustomScreenshotsPath; txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath; txtSaveImageSubFolderPattern.Text = Program.Settings.SaveImageSubFolderPattern; CodeMenu.Create <ReplCodeMenuEntry>(txtSaveImageSubFolderPattern, ReplCodeMenuEntry.t, ReplCodeMenuEntry.pn, ReplCodeMenuEntry.i, ReplCodeMenuEntry.width, ReplCodeMenuEntry.height, ReplCodeMenuEntry.n); // Proxy cbProxyMethod.Items.AddRange(Helpers.GetLocalizedEnumDescriptions <ProxyMethod>()); cbProxyMethod.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyMethod; txtProxyUsername.Text = Program.Settings.ProxySettings.Username; txtProxyPassword.Text = Program.Settings.ProxySettings.Password; txtProxyHost.Text = Program.Settings.ProxySettings.Host ?? string.Empty; nudProxyPort.Value = Program.Settings.ProxySettings.Port; UpdateProxyControls(); // Upload nudUploadLimit.Value = Program.Settings.UploadLimit; for (int i = 0; i < MaxBufferSizePower; i++) { string size = ((long)(Math.Pow(2, i) * 1024)).ToSizeString(Program.Settings.BinaryUnits, 0); cbBufferSize.Items.Add(size); } cbBufferSize.SelectedIndex = Program.Settings.BufferSizePower.Between(0, MaxBufferSizePower); foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats) { AddClipboardFormat(cf); } nudRetryUpload.Value = Program.Settings.MaxUploadFailRetry; chkUseSecondaryUploaders.Checked = Program.Settings.UseSecondaryUploaders; tlpBackupDestinations.Enabled = Program.Settings.UseSecondaryUploaders; Program.Settings.SecondaryImageUploaders.AddRange(Helpers.GetEnums <ImageDestination>().Where(n => Program.Settings.SecondaryImageUploaders.All(e => e != n))); Program.Settings.SecondaryTextUploaders.AddRange(Helpers.GetEnums <TextDestination>().Where(n => Program.Settings.SecondaryTextUploaders.All(e => e != n))); Program.Settings.SecondaryFileUploaders.AddRange(Helpers.GetEnums <FileDestination>().Where(n => Program.Settings.SecondaryFileUploaders.All(e => e != n))); Program.Settings.SecondaryImageUploaders.Where(n => Helpers.GetEnums <ImageDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryImageUploaders.Remove(x)); Program.Settings.SecondaryTextUploaders.Where(n => Helpers.GetEnums <TextDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryTextUploaders.Remove(x)); Program.Settings.SecondaryFileUploaders.Where(n => Helpers.GetEnums <FileDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryFileUploaders.Remove(x)); Program.Settings.SecondaryImageUploaders.ForEach <ImageDestination>(x => lvSecondaryImageUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); Program.Settings.SecondaryTextUploaders.ForEach <TextDestination>(x => lvSecondaryTextUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); Program.Settings.SecondaryFileUploaders.ForEach <FileDestination>(x => lvSecondaryFileUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); // Print cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog; cbPrintDontShowWindowsDialog.Checked = !Program.Settings.PrintSettings.ShowPrintDialog; // Advanced pgSettings.SelectedObject = Program.Settings; tttvMain.MainTabControl = tcSettings; }
private void LoadSettings() { Text = Program.Title + " - Settings"; Icon = ShareXResources.Icon; // General cbShowTray.Checked = Program.Settings.ShowTray; cbSilentRun.Enabled = Program.Settings.ShowTray; cbSilentRun.Checked = Program.Settings.SilentRun; cbStartWithWindows.Checked = ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup); //RegistryHelper.CheckStartWithWindows(); cbSendToMenu.Checked = ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.SendTo); cbShellContextMenu.Checked = RegistryHelpers.CheckShellContextMenu(); cbCheckUpdates.Checked = Program.Settings.AutoCheckUpdate; cbTrayIconProgressEnabled.Checked = Program.Settings.TrayIconProgressEnabled; cbTaskbarProgressEnabled.Enabled = TaskbarManager.IsPlatformSupported; cbTaskbarProgressEnabled.Checked = Program.Settings.TaskbarProgressEnabled; cbRememberMainFormSize.Checked = Program.Settings.RememberMainFormSize; // Paths txtPersonalFolderPath.Text = Program.ReadPersonalPathConfig(); UpdatePersonalFolderPathPreview(); cbUseCustomScreenshotsPath.Checked = Program.Settings.UseCustomScreenshotsPath; txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath; txtSaveImageSubFolderPattern.Text = Program.Settings.SaveImageSubFolderPattern; cmsSaveImageSubFolderPattern = NameParser.CreateCodesMenu(txtSaveImageSubFolderPattern, ReplacementVariables.n); // Proxy cbProxyMethod.Items.AddRange(Enum.GetNames(typeof(ProxyMethod))); cbProxyType.Items.AddRange(Helpers.GetEnumDescriptions <ProxyType>()); cbProxyMethod.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyMethod; txtProxyUsername.Text = Program.Settings.ProxySettings.Username; txtProxyPassword.Text = Program.Settings.ProxySettings.Password; txtProxyHost.Text = Program.Settings.ProxySettings.Host ?? string.Empty; nudProxyPort.Value = Program.Settings.ProxySettings.Port; cbProxyType.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyType; UpdateProxyControls(); // Upload nudUploadLimit.Value = Program.Settings.UploadLimit; for (int i = 0; i < MaxBufferSizePower; i++) { string size = ((long)(Math.Pow(2, i) * 1024)).ToSizeString(Program.Settings.BinaryUnits, 0); cbBufferSize.Items.Add(size); } cbBufferSize.SelectedIndex = Program.Settings.BufferSizePower.Between(0, MaxBufferSizePower); foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats) { AddClipboardFormat(cf); } nudRetryUpload.Value = Program.Settings.MaxUploadFailRetry; chkUseSecondaryUploaders.Checked = Program.Settings.UseSecondaryUploaders; tlpBackupDestinations.Enabled = Program.Settings.UseSecondaryUploaders; Program.Settings.SecondaryImageUploaders.AddRange(((ImageDestination[])Enum.GetValues(typeof(ImageDestination))).Where(n => (Program.Settings.SecondaryImageUploaders.All(e => e != n)))); Program.Settings.SecondaryTextUploaders.AddRange(((TextDestination[])Enum.GetValues(typeof(TextDestination))).Where(n => (Program.Settings.SecondaryTextUploaders.All(e => e != n)))); Program.Settings.SecondaryFileUploaders.AddRange(((FileDestination[])Enum.GetValues(typeof(FileDestination))).Where(n => (Program.Settings.SecondaryFileUploaders.All(e => e != n)))); Program.Settings.SecondaryImageUploaders.Where(n => (((ImageDestination[])Enum.GetValues(typeof(ImageDestination))).All(e => e != n))).ForEach(x => Program.Settings.SecondaryImageUploaders.Remove(x)); Program.Settings.SecondaryTextUploaders.Where(n => (((TextDestination[])Enum.GetValues(typeof(TextDestination))).All(e => e != n))).ForEach(x => Program.Settings.SecondaryTextUploaders.Remove(x)); Program.Settings.SecondaryFileUploaders.Where(n => (((FileDestination[])Enum.GetValues(typeof(FileDestination))).All(e => e != n))).ForEach(x => Program.Settings.SecondaryFileUploaders.Remove(x)); Program.Settings.SecondaryImageUploaders.ForEach <ImageDestination>(x => lvSecondaryImageUploaders.Items.Add(new ListViewItem(x.GetDescription()) { Tag = x })); Program.Settings.SecondaryTextUploaders.ForEach <TextDestination>(x => lvSecondaryTextUploaders.Items.Add(new ListViewItem(x.GetDescription()) { Tag = x })); Program.Settings.SecondaryFileUploaders.ForEach <FileDestination>(x => lvSecondaryFileUploaders.Items.Add(new ListViewItem(x.GetDescription()) { Tag = x })); // Print cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog; // Profiles if (Program.Settings.VideoEncoders.Count == 0) { Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "x264 encoder to MP4", Path = "x264.exe", Args = "--output %output %input", OutputExtension = "mp4" }); Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "ffmpeg encoder to WebM", Path = "ffmpeg.exe", Args = "-i %input -c:v libvpx -crf 12 -b:v 500K %output", OutputExtension = "webm" }); } Program.Settings.VideoEncoders.ForEach(x => AddVideoEncoder(x)); // Advanced pgSettings.SelectedObject = Program.Settings; }
public static bool CheckShellContextMenuButton() { return(RegistryHelpers.CheckShellContextMenu()); }