diff options
33 files changed, 422 insertions, 999 deletions
diff --git a/win/CS/Controls/AdvancedEncoderOpts.cs b/win/CS/Controls/AdvancedEncoderOpts.cs index 8eb2e8ae7..b3f42913a 100644 --- a/win/CS/Controls/AdvancedEncoderOpts.cs +++ b/win/CS/Controls/AdvancedEncoderOpts.cs @@ -7,19 +7,27 @@ namespace Handbrake.Controls {
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
/// <summary>
/// The x264 Panel
/// </summary>
public partial class AdvancedEncoderOpts : UserControl
{
/// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AdvancedEncoderOpts"/> class.
/// </summary>
public AdvancedEncoderOpts()
{
InitializeComponent();
- if (Properties.Settings.Default.tooltipEnable)
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
ToolTip.Active = true;
}
@@ -39,6 +47,9 @@ namespace Handbrake.Controls }
}
+ /// <summary>
+ /// Sets a value indicating whether IsDisabled.
+ /// </summary>
public bool IsDisabled
{
set
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index 0d7c1db77..6bfef3cca 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -9,15 +9,18 @@ namespace Handbrake.Controls using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+ using System.Collections.Specialized;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
using Handbrake.ToolWindows;
@@ -31,6 +34,10 @@ namespace Handbrake.Controls private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
private const string Passthru = "Passthru";
private AdvancedAudio advancedAudio = new AdvancedAudio();
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
#endregion
#region Constructor and Events
@@ -437,7 +444,7 @@ namespace Handbrake.Controls continue;
}
- if (Properties.Settings.Default.addOnlyOneAudioPerLanguage && currentTrack.TrackDisplay.Contains(sourceTrack.Language))
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.AddOnlyOneAudioPerLanguage) && currentTrack.TrackDisplay.Contains(sourceTrack.Language))
{
foundTrack = true;
continue;
@@ -586,7 +593,7 @@ namespace Handbrake.Controls }
// Handle Preferred Language
- if (Properties.Settings.Default.NativeLanguage == "Any")
+ if (this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
{
drp_audioTrack.SelectedIndex = 0;
foreach (AudioTrack track in this.audioTracks)
@@ -603,7 +610,7 @@ namespace Handbrake.Controls {
foreach (Audio item in drp_audioTrack.Items)
{
- if (item.Language.Contains(Properties.Settings.Default.NativeLanguage))
+ if (item.Language.Contains(this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage)))
{
drp_audioTrack.SelectedItem = item;
break;
@@ -624,11 +631,11 @@ namespace Handbrake.Controls Dictionary<String, ArrayList> languageIndex = new Dictionary<String, ArrayList>();
// Now add any additional Langauges tracks on top of the presets tracks.
- int mode = Properties.Settings.Default.DubModeAudio;
+ int mode = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeAudio);
ArrayList languageOrder = new ArrayList(); // This is used to keep the Prefered Language in the front and the other languages in order. TODO this is no longer required, refactor this.
if (mode > 0)
{
- foreach (string item in Properties.Settings.Default.SelectedLanguages)
+ foreach (string item in this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
if (!languageIndex.ContainsKey(item))
{
@@ -646,7 +653,7 @@ namespace Handbrake.Controls if (item.ToString().Contains(kvp.Key))
{
// Only the first Element if the "Only One Audio"-option is chosen.
- if (!Properties.Settings.Default.addOnlyOneAudioPerLanguage || kvp.Value.Count == 0)
+ if (!this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.AddOnlyOneAudioPerLanguage) || kvp.Value.Count == 0)
{
kvp.Value.Add(i);
}
diff --git a/win/CS/Controls/Subtitles.cs b/win/CS/Controls/Subtitles.cs index 578eda4dc..35b05aa26 100644 --- a/win/CS/Controls/Subtitles.cs +++ b/win/CS/Controls/Subtitles.cs @@ -8,11 +8,14 @@ namespace Handbrake.Controls using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
/// <summary>
@@ -37,6 +40,11 @@ namespace Handbrake.Controls /// </summary>
private readonly List<SubtitleTrack> subList = new List<SubtitleTrack>();
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
#endregion
/// <summary>
@@ -207,18 +215,18 @@ namespace Handbrake.Controls ArrayList languageOrder = new ArrayList();
// New DUB Settings
- int mode = Properties.Settings.Default.DubModeSubtitle;
+ int mode = UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeSubtitle);
- if (Properties.Settings.Default.NativeLanguage == "Any")
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
mode = 0;
// Native Language is not 'Any', so initialising the Language Dictionary
if (mode >= 3)
{
- languageIndex.Add(Properties.Settings.Default.NativeLanguage, new ArrayList());
- languageOrder.Add(Properties.Settings.Default.NativeLanguage);
+ languageIndex.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage), new ArrayList());
+ languageOrder.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage));
- foreach (string item in Properties.Settings.Default.SelectedLanguages)
+ foreach (string item in UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
if (!languageIndex.ContainsKey(item))
{
@@ -299,7 +307,7 @@ namespace Handbrake.Controls drp_subtitleTracks.SelectedIndex = 0;
// Add Closed Captions if the user has the option enabled.
- if (Properties.Settings.Default.useClosedCaption)
+ if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseClosedCaption))
{
foreach (object item in drp_subtitleTracks.Items)
{
diff --git a/win/CS/Controls/x264Panel.cs b/win/CS/Controls/x264Panel.cs index 829e1cf5c..c7625d720 100644 --- a/win/CS/Controls/x264Panel.cs +++ b/win/CS/Controls/x264Panel.cs @@ -9,6 +9,9 @@ namespace Handbrake.Controls using System.Globalization;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
/// <summary>
/// The x264 Panel
/// </summary>
@@ -19,6 +22,11 @@ namespace Handbrake.Controls * at some point.
*/
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
private CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
/// <summary>
@@ -29,7 +37,7 @@ namespace Handbrake.Controls {
InitializeComponent();
- if (Properties.Settings.Default.tooltipEnable)
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
ToolTip.Active = true;
Reset2Defaults();
diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs index 03f6d2dba..5aaed22f4 100644 --- a/win/CS/Functions/Main.cs +++ b/win/CS/Functions/Main.cs @@ -19,7 +19,6 @@ namespace Handbrake.Functions using HandBrake.ApplicationServices.Extensions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -35,6 +34,9 @@ namespace Handbrake.Functions /// </summary>
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<QueueTask>));
+ /// <summary>
+ /// The User Setting Service
+ /// </summary>
private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
/// <summary>
@@ -178,11 +180,11 @@ namespace Handbrake.Functions string sourceName = Path.GetInvalidFileNameChars().Aggregate(Path.GetFileNameWithoutExtension(mainWindow.SourceName), (current, character) => current.Replace(character.ToString(), string.Empty));
// Remove Underscores
- if (Properties.Settings.Default.AutoNameRemoveUnderscore)
+ if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
sourceName = sourceName.Replace("_", " ");
// Switch to "Title Case"
- if (Properties.Settings.Default.AutoNameTitleCase)
+ if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase))
sourceName = sourceName.ToTitleCase();
// Get the Selected Title Number
@@ -200,9 +202,9 @@ namespace Handbrake.Functions * File Name
*/
string destinationFilename;
- if (Properties.Settings.Default.autoNameFormat != string.Empty)
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != string.Empty)
{
- destinationFilename = Properties.Settings.Default.autoNameFormat;
+ destinationFilename = UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
destinationFilename = destinationFilename.Replace("{source}", sourceName)
.Replace("{title}", dvdTitle)
.Replace("{chapters}", combinedChapterTag)
@@ -216,7 +218,7 @@ namespace Handbrake.Functions */
if (mainWindow.drop_format.SelectedIndex == 0)
{
- switch (Properties.Settings.Default.useM4v)
+ switch (UserSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Automatic
destinationFilename += mainWindow.Check_ChapterMarkers.Checked ||
@@ -240,9 +242,9 @@ namespace Handbrake.Functions */
// If there is an auto name path, use it...
- if (Properties.Settings.Default.autoNamePath.Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
{
- string savedPath = Properties.Settings.Default.autoNamePath.Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty);
+ string savedPath = UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty);
string requestedPath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), savedPath);
autoNamePath = Path.Combine(requestedPath, destinationFilename);
@@ -252,7 +254,7 @@ namespace Handbrake.Functions autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), "output_" + destinationFilename);
}
}
- else if (Properties.Settings.Default.autoNamePath.Contains("{source_folder_name}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
+ else if (UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
{
// Second Case: We have a Path, with "{source_folder}" in it, therefore we need to replace it with the folder name from the source.
string path = Path.GetDirectoryName(mainWindow.sourcePath);
@@ -261,15 +263,16 @@ namespace Handbrake.Functions string[] filesArray = path.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
string sourceFolder = filesArray[filesArray.Length - 1];
- autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath.Replace("{source_folder_name}", sourceFolder), destinationFilename);
+ autoNamePath = Path.Combine(UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Replace("{source_folder_name}", sourceFolder), destinationFilename);
}
}
else if (!mainWindow.text_destination.Text.Contains(Path.DirectorySeparatorChar.ToString()))
{
// Third case: If the destination box doesn't already contain a path, make one.
- if (Properties.Settings.Default.autoNamePath.Trim() != string.Empty && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != string.Empty &&
+ UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != "Click 'Browse' to set the default location")
{
- autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);
+ autoNamePath = Path.Combine(UserSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath), destinationFilename);
}
else // ...otherwise, output to the source directory
autoNamePath = null;
@@ -303,7 +306,7 @@ namespace Handbrake.Functions string base64Hash = Convert.ToBase64String(hash);
// Compare the hash with the last known hash. If it's the same, return.
- if (Properties.Settings.Default.CliExeHash == base64Hash)
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.CliExeHash) == base64Hash)
{
return;
}
@@ -340,13 +343,13 @@ namespace Handbrake.Functions int buildValue;
int.TryParse(build, out buildValue);
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeBuild, buildValue);
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeVersion, version);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, version);
}
if (platform.Success)
{
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakePlatform, platform.Value.Replace("-", string.Empty).Trim());
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakePlatform, platform.Value.Replace("-", string.Empty).Trim());
}
if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.
@@ -359,18 +362,16 @@ namespace Handbrake.Functions }
}
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, base64Hash);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, base64Hash);
}
catch (Exception e)
{
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeBuild, string.Empty);
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakePlatform, string.Empty);
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeVersion, string.Empty);
- UserSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, string.Empty);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, string.Empty);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakePlatform, string.Empty);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, string.Empty);
+ UserSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, string.Empty);
ShowExceptiowWindow("Unable to retrieve version information from the CLI.", e.ToString());
- // Probably corrupted config. Delete config and let the user restart.
- RecoverFromCorruptedLocalApplicationConfig();
Application.Exit();
}
}
@@ -517,31 +518,5 @@ namespace Handbrake.Functions return "Unknown";
}
-
- /// <summary>
- /// Remove the Local Applicaiton Data.
- /// This should only be used if something bad happens which corrupts the data.
- /// </summary>
- public static void RecoverFromCorruptedLocalApplicationConfig()
- {
- try
- {
- MessageBox.Show(
- "HandBrake has attempted to recover from a corrupted config file. \nYou may neeed to reset your preferences.\n\n Please restart HandBrake",
- "Warning",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
-
- string directory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\HandBrake";
- if (Directory.Exists(directory))
- {
- File.SetAttributes(directory, FileAttributes.Normal);
- Directory.Delete(directory, true);
- }
- }
- catch (Exception)
- {
- }
- }
}
}
\ No newline at end of file diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index efc22495c..d448c22f2 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -309,7 +309,7 @@ namespace Handbrake.Functions sliderValue = 32 - (int)value;
break;
case VideoEncoder.X264:
- double cqStep = UserSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ double cqStep = UserSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
sliderValue = (int)((51.0 / cqStep) - (value / cqStep));
break;
case VideoEncoder.Theora:
diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs index 1d0a32be5..881188da7 100644 --- a/win/CS/Functions/QueryGenerator.cs +++ b/win/CS/Functions/QueryGenerator.cs @@ -20,6 +20,8 @@ namespace Handbrake.Functions using Handbrake.Model;
+ using UserSettingConstants = Handbrake.UserSettingConstants;
+
/// <summary>
/// Generate a CLI Query for HandBrakeCLI
/// </summary>
@@ -131,7 +133,7 @@ namespace Handbrake.Functions query += " -t " + titleInfo[0];
}
- if (!UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav) && mainWindow.drop_angle.Items.Count != 0)
+ if (!UserSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav) && mainWindow.drop_angle.Items.Count != 0)
query += " --angle " + mainWindow.drop_angle.SelectedItem;
// Decide what part of the video we want to encode.
@@ -162,7 +164,7 @@ namespace Handbrake.Functions query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);
break;
case 3: // Preview
- query += " --previews " + Properties.Settings.Default.previewScanCount + " ";
+ query += " --previews " + UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount) + " ";
query += " --start-at-preview " + preview;
query += " --stop-at duration:" + duration + " ";
break;
@@ -337,7 +339,7 @@ namespace Handbrake.Functions // Video Quality Setting
if (mainWindow.radio_cq.Checked)
{
- double cqStep = UserSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ double cqStep = UserSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
double value;
switch (mainWindow.drp_videoEncoder.Text)
{
@@ -514,10 +516,10 @@ namespace Handbrake.Functions string query = string.Empty;
// Verbosity Level
- query += " --verbose=" + UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity);
+ query += " --verbose=" + UserSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity);
// LibDVDNav
- if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (UserSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
query += " --no-dvdnav";
return query;
diff --git a/win/CS/HandBrake.ApplicationServices/UserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs index 02ca9cb61..a7510b5fb 100644 --- a/win/CS/HandBrake.ApplicationServices/UserSettingConstants.cs +++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs @@ -8,7 +8,7 @@ namespace HandBrake.ApplicationServices /// <summary>
/// Constants for the User Settings Service
/// </summary>
- public class UserSettingConstants
+ public class ASUserSettingConstants
{
/// <summary>
/// The Verbosity
@@ -80,7 +80,6 @@ namespace HandBrake.ApplicationServices /// </summary>
public const string HandBrakePlatform = "HandBrakePlatform";
-
/// <summary>
/// HandBrakes CLI Exe SHA1 Hash
/// </summary>
@@ -111,6 +110,9 @@ namespace HandBrake.ApplicationServices /// </summary>
public const string SendFileToArgs = "SendFileToArgs";
+ /// <summary>
+ /// Min Title Scan Duration
+ /// </summary>
public const string MinScanDuration = "MinTitleScanDuration";
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 0c417c279..b1bfb7a19 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -145,7 +145,7 @@ <Compile Include="Services\ScanService.cs" />
<Compile Include="Services\UpdateService.cs" />
<Compile Include="Services\UserSettingService.cs" />
- <Compile Include="UserSettingConstants.cs" />
+ <Compile Include="ASUserSettingConstants.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
<Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 1453889ed..362a86a7e 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -168,7 +168,7 @@ namespace HandBrake.ApplicationServices.Parsing }
// Multi-Angle Support if LibDvdNav is enabled
- if (!userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (!userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
{
m = Regex.Match(nextLine, @" \+ angle\(s\) ([0-9])");
if (m.Success)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index 6ab0e52a8..f88e7a06e 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -214,17 +214,17 @@ namespace HandBrake.ApplicationServices.Services.Base File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
// Save a copy of the log file in the same location as the enocde.
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogWithVideo))
{
File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
}
// Save a copy of the log file to a user specified location
- if (Directory.Exists(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory)) &&
- this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory))
+ if (Directory.Exists(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory)) &&
+ this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogToCopyDirectory))
{
File.Copy(
- tempLogFile, Path.Combine(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory), encodeLogFile));
+ tempLogFile, Path.Combine(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory), encodeLogFile));
}
}
catch (Exception)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 70f8f86ee..ade0f5e29 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -107,7 +107,7 @@ namespace HandBrake.ApplicationServices.Services }
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.PreventSleep();
}
@@ -121,7 +121,7 @@ namespace HandBrake.ApplicationServices.Services RedirectStandardOutput = true,
RedirectStandardError = enableLogging ? true : false,
UseShellExecute = false,
- CreateNoWindow = !this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowCLI) ? true : false
+ CreateNoWindow = !this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI) ? true : false
};
this.HbProcess = new Process { StartInfo = cliStart };
@@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services }
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))
+ switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
{
case "Realtime":
this.HbProcess.PriorityClass = ProcessPriorityClass.RealTime;
@@ -258,7 +258,7 @@ namespace HandBrake.ApplicationServices.Services this.WindowsSeven.SetTaskBarProgressToNoProgress();
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.AllowSleep();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs index 7ee9a9df3..57f4b18fd 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs @@ -114,7 +114,7 @@ namespace HandBrake.ApplicationServices.Services }
// Prvent the system from sleeping if the user asks
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep) )
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep) )
{
Win32.PreventSleep();
}
@@ -126,7 +126,7 @@ namespace HandBrake.ApplicationServices.Services this.instance.StartEncode(encodeJob);
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))
+ switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
{
case "Realtime":
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
@@ -285,7 +285,7 @@ namespace HandBrake.ApplicationServices.Services this.WindowsSeven.SetTaskBarProgressToNoProgress();
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))
{
Win32.AllowSleep();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index b856577a9..d416624dc 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -262,7 +262,7 @@ namespace HandBrake.ApplicationServices.Services Category = category,
Name = presetName[0].Replace("+", string.Empty).Trim(),
Query = presetName[2],
- Version = this.userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion),
+ Version = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
CropSettings = pic,
Description = string.Empty, // Maybe one day we will populate this.
IsBuildIn = true
@@ -302,7 +302,7 @@ namespace HandBrake.ApplicationServices.Services List<Preset> preset = this.presets.Where(p => p.IsBuildIn).ToList();
if (preset.Count > 0)
{
- if (preset[0].Version != this.userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion))
+ if (preset[0].Version != this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion))
{
this.UpdateBuiltInPresets();
return true;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs index 478fa3661..91667debe 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -201,7 +201,7 @@ namespace HandBrake.ApplicationServices.Services this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Completed;
// Growl
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlEncode))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlEncode))
GrowlCommunicator.Notify("Encode Completed",
"Put down that cocktail...\nyour Handbrake encode is done.");
@@ -271,10 +271,10 @@ namespace HandBrake.ApplicationServices.Services /// <param name="file"> The file path</param>
private static void SendToApplication(string file)
{
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo)))
{
- string args = string.Format("{0} \"{1}\"", userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs), file);
- ProcessStartInfo vlc = new ProcessStartInfo(userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), args);
+ string args = string.Format("{0} \"{1}\"", userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileToArgs), file);
+ ProcessStartInfo vlc = new ProcessStartInfo(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo), args);
Process.Start(vlc);
}
}
@@ -285,13 +285,13 @@ namespace HandBrake.ApplicationServices.Services private static void Finish()
{
// Growl
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlQueue))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlQueue))
{
GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
}
// Do something whent he encode ends.
- switch (userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction))
+ switch (userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction))
{
case "Shutdown":
Process.Start("Shutdown", "-s -t 60");
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index a9c9e07ce..26bfd582a 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -195,12 +195,12 @@ namespace HandBrake.ApplicationServices.Services extraArguments += " --previews " + previewCount;
}
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
{
extraArguments += " --no-dvdnav";
}
- extraArguments += string.Format(" --min-duration={0}", this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration));
+ extraArguments += string.Format(" --min-duration={0}", this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration));
if (title > 0)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs index 6a8584018..ace53f97f 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs @@ -104,6 +104,12 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
private void Save()
{
+ string directory = Path.GetDirectoryName(this.settingsFile);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+
using (FileStream strm = new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write))
{
serializer.Serialize(strm, this.userSettings);
@@ -157,21 +163,21 @@ namespace HandBrake.ApplicationServices.Services private void SetAllDefaults()
{
userSettings = new SerializableDictionary<string, object>();
- userSettings[UserSettingConstants.X264Step] = 0.25;
- userSettings[UserSettingConstants.Verbosity] = 1;
- userSettings[UserSettingConstants.WhenCompleteAction] = "Do Nothing";
- userSettings[UserSettingConstants.GrowlEncode] = false;
- userSettings[UserSettingConstants.GrowlQueue] = false;
- userSettings[UserSettingConstants.ProcessPriority] = "Below Normal";
- userSettings[UserSettingConstants.PreventSleep] = true;
- userSettings[UserSettingConstants.ShowCLI] = false;
- userSettings[UserSettingConstants.SaveLogToCopyDirectory] = false;
- userSettings[UserSettingConstants.SaveLogWithVideo] = false;
- userSettings[UserSettingConstants.DisableLibDvdNav] = false;
- userSettings[UserSettingConstants.SendFile] = false;
- userSettings[UserSettingConstants.MinScanDuration] = 10;
- userSettings[UserSettingConstants.HandBrakeBuild] = 0;
- userSettings[UserSettingConstants.HandBrakeVersion] = string.Empty;
+ userSettings[ASUserSettingConstants.X264Step] = 0.25;
+ userSettings[ASUserSettingConstants.Verbosity] = 1;
+ userSettings[ASUserSettingConstants.WhenCompleteAction] = "Do Nothing";
+ userSettings[ASUserSettingConstants.GrowlEncode] = false;
+ userSettings[ASUserSettingConstants.GrowlQueue] = false;
+ userSettings[ASUserSettingConstants.ProcessPriority] = "Below Normal";
+ userSettings[ASUserSettingConstants.PreventSleep] = true;
+ userSettings[ASUserSettingConstants.ShowCLI] = false;
+ userSettings[ASUserSettingConstants.SaveLogToCopyDirectory] = false;
+ userSettings[ASUserSettingConstants.SaveLogWithVideo] = false;
+ userSettings[ASUserSettingConstants.DisableLibDvdNav] = false;
+ userSettings[ASUserSettingConstants.SendFile] = false;
+ userSettings[ASUserSettingConstants.MinScanDuration] = 10;
+ userSettings[ASUserSettingConstants.HandBrakeBuild] = 0;
+ userSettings[ASUserSettingConstants.HandBrakeVersion] = string.Empty;
userSettings["updateStatus"] = true;
userSettings["tooltipEnable"] = true;
userSettings["defaultPreset"] = string.Empty;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs index b2187ed4b..99ecd5cd6 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs @@ -113,7 +113,7 @@ namespace HandBrake.ApplicationServices.Utilities {
StringBuilder logHeader = new StringBuilder();
- logHeader.AppendLine(String.Format("HandBrake {0} {1}", userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild)));
+ logHeader.AppendLine(String.Format("HandBrake {0} {1}", userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild)));
logHeader.AppendLine(String.Format("OS: {0}", Environment.OSVersion));
logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
logHeader.Append(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index 392abc569..e0152489f 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs @@ -547,7 +547,7 @@ namespace HandBrake.ApplicationServices.Utilities AddEncodeElement(xmlWriter, "PictureWidth", "integer", parsed.Width.ToString());
// Preset Information
- AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeBuild));
+ AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeBuild));
AddEncodeElement(xmlWriter, "PresetDescription", "string", "No Description");
AddEncodeElement(xmlWriter, "PresetName", "string", preset.Name);
AddEncodeElement(xmlWriter, "Type", "integer", "1"); // 1 is user preset, 0 is built in
diff --git a/win/CS/HandBrakeCS.csproj b/win/CS/HandBrakeCS.csproj index df589f70d..18fe4017f 100644 --- a/win/CS/HandBrakeCS.csproj +++ b/win/CS/HandBrakeCS.csproj @@ -223,6 +223,7 @@ <Compile Include="ToolWindows\UpdateInfo.Designer.cs">
<DependentUpon>UpdateInfo.cs</DependentUpon>
</Compile>
+ <Compile Include="UserSettingConstants.cs" />
<EmbeddedResource Include="Controls\AudioPanel.resx">
<DependentUpon>AudioPanel.cs</DependentUpon>
<SubType>Designer</SubType>
diff --git a/win/CS/Program.cs b/win/CS/Program.cs index 847c70bd6..9939bfa42 100644 --- a/win/CS/Program.cs +++ b/win/CS/Program.cs @@ -12,7 +12,6 @@ namespace Handbrake using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Exceptions;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using Handbrake.Properties;
@@ -57,34 +56,8 @@ namespace Handbrake return;
}
- // Attempt to upgrade / keep the users settings between versions
- try
- {
- if (Settings.Default.UpdateRequired)
- {
- // Upgrading user settings seems to be problematic from 0.9.5 -> Current,
- // Seems to be seeing user.config corrupation from time to time.
- // So I'm going to only allow this for users using svn builds.
- // Going from major to major will require the user to reset.
- // Going from svn to svn will attempt the upgrade.
- IUserSettingService service = ServiceManager.UserSettingService;
- string version = service.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion);
- if (version.Contains("svn"))
- {
- Settings.Default.Upgrade();
- Settings.Default.UpdateRequired = false;
- Settings.Default.Save();
- }
-
- // Re-detect the CLI version data.
- Functions.Main.SetCliVersionData();
- }
- }
- catch (Exception)
- {
- Functions.Main.RecoverFromCorruptedLocalApplicationConfig();
- return;
- }
+ // Make sure the GUI knows what CLI version it's attached to.
+ Functions.Main.SetCliVersionData();
// Check were not running on a screen that's going to cause some funnies to happen.
Screen scr = Screen.PrimaryScreen;
@@ -97,7 +70,7 @@ namespace Handbrake "Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
- }
+ }
else
{
string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs");
@@ -118,7 +91,7 @@ namespace Handbrake private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
- {
+ {
ExceptionWindow window = new ExceptionWindow();
if (e.ExceptionObject.GetType() == typeof(GeneralApplicationException))
@@ -135,7 +108,7 @@ namespace Handbrake {
window.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString());
}
- window.ShowDialog();
+ window.ShowDialog();
}
catch (Exception)
{
diff --git a/win/CS/Properties/Settings.Designer.cs b/win/CS/Properties/Settings.Designer.cs index 5ffb8b431..e47679f03 100644 --- a/win/CS/Properties/Settings.Designer.cs +++ b/win/CS/Properties/Settings.Designer.cs @@ -22,437 +22,5 @@ namespace Handbrake.Properties { return defaultInstance;
}
}
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool updateStatus {
- get {
- return ((bool)(this["updateStatus"]));
- }
- set {
- this["updateStatus"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool tooltipEnable {
- get {
- return ((bool)(this["tooltipEnable"]));
- }
- set {
- this["tooltipEnable"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string defaultPreset {
- get {
- return ((string)(this["defaultPreset"]));
- }
- set {
- this["defaultPreset"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("0")]
- public int skipversion {
- get {
- return ((int)(this["skipversion"]));
- }
- set {
- this["skipversion"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool autoNaming {
- get {
- return ((bool)(this["autoNaming"]));
- }
- set {
- this["autoNaming"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string autoNamePath {
- get {
- return ((string)(this["autoNamePath"]));
- }
- set {
- this["autoNamePath"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("http://handbrake.fr/appcast.xml")]
- public string appcast {
- get {
- return ((string)(this["appcast"]));
- }
- set {
- this["appcast"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("http://handbrake.fr/appcast_unstable.xml")]
- public string appcast_unstable {
- get {
- return ((string)(this["appcast_unstable"]));
- }
- set {
- this["appcast_unstable"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("{source}-{title}")]
- public string autoNameFormat {
- get {
- return ((string)(this["autoNameFormat"]));
- }
- set {
- this["autoNameFormat"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("C:\\Program Files\\VideoLAN\\vlc\\vlc.exe")]
- public string VLC_Path {
- get {
- return ((string)(this["VLC_Path"]));
- }
- set {
- this["VLC_Path"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool MainWindowMinimize {
- get {
- return ((bool)(this["MainWindowMinimize"]));
- }
- set {
- this["MainWindowMinimize"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool QueryEditorTab {
- get {
- return ((bool)(this["QueryEditorTab"]));
- }
- set {
- this["QueryEditorTab"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool presetNotification {
- get {
- return ((bool)(this["presetNotification"]));
- }
- set {
- this["presetNotification"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool trayIconAlerts {
- get {
- return ((bool)(this["trayIconAlerts"]));
- }
- set {
- this["trayIconAlerts"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public global::System.DateTime lastUpdateCheckDate {
- get {
- return ((global::System.DateTime)(this["lastUpdateCheckDate"]));
- }
- set {
- this["lastUpdateCheckDate"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("7")]
- public int daysBetweenUpdateCheck {
- get {
- return ((int)(this["daysBetweenUpdateCheck"]));
- }
- set {
- this["daysBetweenUpdateCheck"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("0")]
- public int useM4v {
- get {
- return ((int)(this["useM4v"]));
- }
- set {
- this["useM4v"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool PromptOnUnmatchingQueries {
- get {
- return ((bool)(this["PromptOnUnmatchingQueries"]));
- }
- set {
- this["PromptOnUnmatchingQueries"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Any")]
- public string NativeLanguage {
- get {
- return ((string)(this["NativeLanguage"]));
- }
- set {
- this["NativeLanguage"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("255")]
- public int DubMode {
- get {
- return ((int)(this["DubMode"]));
- }
- set {
- this["DubMode"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string CliExeHash {
- get {
- return ((string)(this["CliExeHash"]));
- }
- set {
- this["CliExeHash"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("10")]
- public int previewScanCount {
- get {
- return ((int)(this["previewScanCount"]));
- }
- set {
- this["previewScanCount"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool clearOldLogs {
- get {
- return ((bool)(this["clearOldLogs"]));
- }
- set {
- this["clearOldLogs"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool AutoNameTitleCase {
- get {
- return ((bool)(this["AutoNameTitleCase"]));
- }
- set {
- this["AutoNameTitleCase"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool AutoNameRemoveUnderscore {
- get {
- return ((bool)(this["AutoNameRemoveUnderscore"]));
- }
- set {
- this["AutoNameRemoveUnderscore"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("0")]
- public int ActivityWindowLastMode {
- get {
- return ((int)(this["ActivityWindowLastMode"]));
- }
- set {
- this["ActivityWindowLastMode"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool useClosedCaption {
- get {
- return ((bool)(this["useClosedCaption"]));
- }
- set {
- this["useClosedCaption"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("35")]
- public int batchMinDuration {
- get {
- return ((int)(this["batchMinDuration"]));
- }
- set {
- this["batchMinDuration"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("47")]
- public int batchMaxDuration {
- get {
- return ((int)(this["batchMaxDuration"]));
- }
- set {
- this["batchMaxDuration"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool defaultPlayer {
- get {
- return ((bool)(this["defaultPlayer"]));
- }
- set {
- this["defaultPlayer"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
- "org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />")]
- public global::System.Collections.Specialized.StringCollection SelectedLanguages {
- get {
- return ((global::System.Collections.Specialized.StringCollection)(this["SelectedLanguages"]));
- }
- set {
- this["SelectedLanguages"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("0")]
- public int DubModeAudio {
- get {
- return ((int)(this["DubModeAudio"]));
- }
- set {
- this["DubModeAudio"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("0")]
- public int DubModeSubtitle {
- get {
- return ((int)(this["DubModeSubtitle"]));
- }
- set {
- this["DubModeSubtitle"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool addOnlyOneAudioPerLanguage {
- get {
- return ((bool)(this["addOnlyOneAudioPerLanguage"]));
- }
- set {
- this["addOnlyOneAudioPerLanguage"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("10")]
- public string MinTitleLength {
- get {
- return ((string)(this["MinTitleLength"]));
- }
- set {
- this["MinTitleLength"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool UpdateRequired {
- get {
- return ((bool)(this["UpdateRequired"]));
- }
- set {
- this["UpdateRequired"] = value;
- }
- }
}
}
diff --git a/win/CS/Properties/Settings.settings b/win/CS/Properties/Settings.settings index d9423eca7..2bd17f050 100644 --- a/win/CS/Properties/Settings.settings +++ b/win/CS/Properties/Settings.settings @@ -1,115 +1,5 @@ <?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Handbrake.Properties" GeneratedClassName="Settings">
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles />
- <Settings>
- <Setting Name="updateStatus" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="tooltipEnable" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="defaultPreset" Type="System.String" Scope="User">
- <Value Profile="(Default)" />
- </Setting>
- <Setting Name="skipversion" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">0</Value>
- </Setting>
- <Setting Name="autoNaming" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="autoNamePath" Type="System.String" Scope="User">
- <Value Profile="(Default)" />
- </Setting>
- <Setting Name="appcast" Type="System.String" Scope="User">
- <Value Profile="(Default)">http://handbrake.fr/appcast.xml</Value>
- </Setting>
- <Setting Name="appcast_unstable" Type="System.String" Scope="User">
- <Value Profile="(Default)">http://handbrake.fr/appcast_unstable.xml</Value>
- </Setting>
- <Setting Name="autoNameFormat" Type="System.String" Scope="User">
- <Value Profile="(Default)">{source}-{title}</Value>
- </Setting>
- <Setting Name="VLC_Path" Type="System.String" Scope="User">
- <Value Profile="(Default)">C:\Program Files\VideoLAN\vlc\vlc.exe</Value>
- </Setting>
- <Setting Name="MainWindowMinimize" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="QueryEditorTab" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
- </Setting>
- <Setting Name="presetNotification" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
- </Setting>
- <Setting Name="trayIconAlerts" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="lastUpdateCheckDate" Type="System.DateTime" Scope="User">
- <Value Profile="(Default)" />
- </Setting>
- <Setting Name="daysBetweenUpdateCheck" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">7</Value>
- </Setting>
- <Setting Name="useM4v" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">0</Value>
- </Setting>
- <Setting Name="PromptOnUnmatchingQueries" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="NativeLanguage" Type="System.String" Scope="User">
- <Value Profile="(Default)">Any</Value>
- </Setting>
- <Setting Name="DubMode" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">255</Value>
- </Setting>
- <Setting Name="CliExeHash" Type="System.String" Scope="User">
- <Value Profile="(Default)" />
- </Setting>
- <Setting Name="previewScanCount" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">10</Value>
- </Setting>
- <Setting Name="clearOldLogs" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="AutoNameTitleCase" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="AutoNameRemoveUnderscore" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="ActivityWindowLastMode" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">0</Value>
- </Setting>
- <Setting Name="useClosedCaption" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
- </Setting>
- <Setting Name="batchMinDuration" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">35</Value>
- </Setting>
- <Setting Name="batchMaxDuration" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">47</Value>
- </Setting>
- <Setting Name="defaultPlayer" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
- </Setting>
- <Setting Name="SelectedLanguages" Type="System.Collections.Specialized.StringCollection" Scope="User">
- <Value Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
-<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /></Value>
- </Setting>
- <Setting Name="DubModeAudio" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">0</Value>
- </Setting>
- <Setting Name="DubModeSubtitle" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">0</Value>
- </Setting>
- <Setting Name="addOnlyOneAudioPerLanguage" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- <Setting Name="MinTitleLength" Type="System.String" Scope="User">
- <Value Profile="(Default)">10</Value>
- </Setting>
- <Setting Name="UpdateRequired" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
- </Setting>
- </Settings>
+ <Settings />
</SettingsFile>
\ No newline at end of file diff --git a/win/CS/ToolWindows/BatchAdd.cs b/win/CS/ToolWindows/BatchAdd.cs index 08bf62092..fbb864e70 100644 --- a/win/CS/ToolWindows/BatchAdd.cs +++ b/win/CS/ToolWindows/BatchAdd.cs @@ -8,18 +8,29 @@ namespace Handbrake.ToolWindows using System;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
/// <summary>
/// Title Specific Scan
/// </summary>
public partial class BatchAdd : Form
{
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BatchAdd"/> class.
+ /// </summary>
public BatchAdd()
{
InitializeComponent();
// Get the Default values for batch encoding.
- this.minDuration.Text = Properties.Settings.Default.batchMinDuration.ToString();
- this.maxDuration.Text = Properties.Settings.Default.batchMaxDuration.ToString();
+ this.minDuration.Text = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.BatchMinDuration).ToString();
+ this.maxDuration.Text = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.BatchMaxDuration).ToString();
}
/// <summary>
diff --git a/win/CS/UserSettingConstants.cs b/win/CS/UserSettingConstants.cs new file mode 100644 index 000000000..843e0bc9e --- /dev/null +++ b/win/CS/UserSettingConstants.cs @@ -0,0 +1,49 @@ +/* UserSettingConstants.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace Handbrake
+{
+ /// <summary>
+ /// Constants for the User Settings Service
+ /// </summary>
+ public class UserSettingConstants
+ {
+ public const string UpdateStatus = "updateStatus";
+ public const string TooltipEnable = "tooltipEnable";
+ public const string DefaultPreset = "defaultPreset";
+ public const string Skipversion = "skipversion";
+ public const string AutoNaming = "autoNaming";
+ public const string AutoNamePath = "autoNamePath";
+ public const string Appcast = "appcast";
+ public const string Appcast_unstable = "appcast_unstable";
+ public const string AutoNameFormat = "autoNameFormat";
+ public const string VLC_Path = "VLC_Path";
+ public const string MainWindowMinimize = "MainWindowMinimize";
+ public const string QueryEditorTab = "QueryEditorTab";
+ public const string PresetNotification = "presetNotification";
+ public const string TrayIconAlerts = "trayIconAlerts";
+ public const string LastUpdateCheckDate = "lastUpdateCheckDate";
+ public const string DaysBetweenUpdateCheck = "daysBetweenUpdateCheck";
+ public const string UseM4v = "useM4v";
+ public const string PromptOnUnmatchingQueries = "PromptOnUnmatchingQueries";
+ public const string NativeLanguage = "NativeLanguage";
+ public const string DubMode = "DubMode";
+ public const string CliExeHash = "CliExeHash";
+ public const string PreviewScanCount = "previewScanCount";
+ public const string ClearOldLogs = "clearOldLogs";
+ public const string AutoNameTitleCase = "AutoNameTitleCase";
+ public const string AutoNameRemoveUnderscore = "AutoNameRemoveUnderscore";
+ public const string ActivityWindowLastMode = "ActivityWindowLastMode";
+ public const string UseClosedCaption = "useClosedCaption";
+ public const string BatchMinDuration = "batchMinDuration";
+ public const string BatchMaxDuration = "batchMaxDuration";
+ public const string DefaultPlayer = "defaultPlayer";
+ public const string SelectedLanguages = "SelectedLanguages";
+ public const string DubModeAudio = "DubModeAudio";
+ public const string DubModeSubtitle = "DubModeSubtitle";
+ public const string AddOnlyOneAudioPerLanguage = "addOnlyOneAudioPerLanguage";
+ public const string MinTitleLength = "MinTitleLength";
+ }
+}
diff --git a/win/CS/app.config b/win/CS/app.config index 5217a8bda..b802015fe 100644 --- a/win/CS/app.config +++ b/win/CS/app.config @@ -3,127 +3,9 @@ <configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
- <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <section name="Handbrake.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
- </sectionGroup>
</configSections>
- <userSettings>
- <Handbrake.Properties.Settings>
- <setting name="updateStatus" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="tooltipEnable" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="defaultPreset" serializeAs="String">
- <value />
- </setting>
- <setting name="skipversion" serializeAs="String">
- <value>0</value>
- </setting>
- <setting name="autoNaming" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="autoNamePath" serializeAs="String">
- <value />
- </setting>
- <setting name="appcast" serializeAs="String">
- <value>http://handbrake.fr/appcast.xml</value>
- </setting>
- <setting name="appcast_unstable" serializeAs="String">
- <value>http://handbrake.fr/appcast_unstable.xml</value>
- </setting>
- <setting name="autoNameFormat" serializeAs="String">
- <value>{source}-{title}</value>
- </setting>
- <setting name="VLC_Path" serializeAs="String">
- <value>C:\Program Files\VideoLAN\vlc\vlc.exe</value>
- </setting>
- <setting name="MainWindowMinimize" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="QueryEditorTab" serializeAs="String">
- <value>False</value>
- </setting>
- <setting name="presetNotification" serializeAs="String">
- <value>False</value>
- </setting>
- <setting name="trayIconAlerts" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="lastUpdateCheckDate" serializeAs="String">
- <value />
- </setting>
- <setting name="daysBetweenUpdateCheck" serializeAs="String">
- <value>7</value>
- </setting>
- <setting name="useM4v" serializeAs="String">
- <value>0</value>
- </setting>
- <setting name="PromptOnUnmatchingQueries" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="NativeLanguage" serializeAs="String">
- <value>Any</value>
- </setting>
- <setting name="DubMode" serializeAs="String">
- <value>255</value>
- </setting>
- <setting name="CliExeHash" serializeAs="String">
- <value />
- </setting>
- <setting name="previewScanCount" serializeAs="String">
- <value>10</value>
- </setting>
- <setting name="clearOldLogs" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="AutoNameTitleCase" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="AutoNameRemoveUnderscore" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="ActivityWindowLastMode" serializeAs="String">
- <value>0</value>
- </setting>
- <setting name="useClosedCaption" serializeAs="String">
- <value>False</value>
- </setting>
- <setting name="batchMinDuration" serializeAs="String">
- <value>35</value>
- </setting>
- <setting name="batchMaxDuration" serializeAs="String">
- <value>47</value>
- </setting>
- <setting name="defaultPlayer" serializeAs="String">
- <value>False</value>
- </setting>
- <setting name="SelectedLanguages" serializeAs="Xml">
- <value>
- <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
- </value>
- </setting>
- <setting name="DubModeAudio" serializeAs="String">
- <value>0</value>
- </setting>
- <setting name="DubModeSubtitle" serializeAs="String">
- <value>0</value>
- </setting>
- <setting name="addOnlyOneAudioPerLanguage" serializeAs="String">
- <value>True</value>
- </setting>
- <setting name="MinTitleLength" serializeAs="String">
- <value>10</value>
- </setting>
- <setting name="UpdateRequired" serializeAs="String">
- <value>True</value>
- </setting>
- </Handbrake.Properties.Settings>
- </userSettings>
-
+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup>
<!--<castle>
diff --git a/win/CS/defaultsettings.xml b/win/CS/defaultsettings.xml index 946abad17..7c47d6601 100644 --- a/win/CS/defaultsettings.xml +++ b/win/CS/defaultsettings.xml @@ -109,7 +109,7 @@ <string>HandBrakeBuild</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">2011080601</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">00010101</anyType>
</value>
</item>
<item>
@@ -117,7 +117,7 @@ <string>HandBrakeVersion</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">svn4156</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">NotSet</anyType>
</value>
</item>
<item>
diff --git a/win/CS/frmAbout.cs b/win/CS/frmAbout.cs index 518f4a289..976f897b2 100644 --- a/win/CS/frmAbout.cs +++ b/win/CS/frmAbout.cs @@ -26,8 +26,8 @@ namespace Handbrake {
InitializeComponent();
- string nightly = userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
- lbl_GUIBuild.Text = userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion) + " (" + userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild) + ") " + nightly;
+ string nightly = userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
+ lbl_GUIBuild.Text = userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion) + " (" + userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild) + ") " + nightly;
}
/// <summary>
diff --git a/win/CS/frmActivityWindow.cs b/win/CS/frmActivityWindow.cs index c3dc5c966..eb6f30ee1 100644 --- a/win/CS/frmActivityWindow.cs +++ b/win/CS/frmActivityWindow.cs @@ -13,6 +13,7 @@ namespace Handbrake using System.Threading;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Services.Interfaces;
using Handbrake.Functions;
@@ -38,6 +39,11 @@ namespace Handbrake private readonly IScan scan;
/// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
+ /// <summary>
/// The current position in the log file
/// </summary>
private int position;
@@ -122,8 +128,7 @@ namespace Handbrake this.mode = setMode;
Array values = Enum.GetValues(typeof(ActivityLogMode));
- Properties.Settings.Default.ActivityWindowLastMode = (int)values.GetValue(Convert.ToInt32(setMode));
- Properties.Settings.Default.Save();
+ this.UserSettingService.SetUserSetting(UserSettingConstants.ActivityWindowLastMode, (int)values.GetValue(Convert.ToInt32(setMode)));
this.Text = mode == ActivityLogMode.Scan
? "Activity Window (Scan Log)"
@@ -173,7 +178,8 @@ namespace Handbrake else
{
// Otherwise, use the last mode the window was in.
- ActivityLogMode activitLogMode = (ActivityLogMode)Enum.ToObject(typeof(ActivityLogMode), Properties.Settings.Default.ActivityWindowLastMode);
+ ActivityLogMode activitLogMode = (ActivityLogMode)Enum.ToObject(typeof(ActivityLogMode),
+ this.UserSettingService.GetUserSetting<int>(UserSettingConstants.ActivityWindowLastMode));
this.logSelector.SelectedIndex = activitLogMode == ActivityLogMode.Scan ? 0 : 1;
}
}
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 0db9db780..ba4826209 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -134,29 +134,29 @@ namespace Handbrake // Update the users config file with the CLI version data.
Main.SetCliVersionData();
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion).Contains("svn"))
+ if (userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn"))
{
- this.Text += " " + userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion);
+ this.Text += " " + userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion);
}
// Check for new versions, if update checking is enabled
- if (Settings.Default.updateStatus)
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.UpdateStatus))
{
- if (DateTime.Now.Subtract(Settings.Default.lastUpdateCheckDate).TotalDays > Properties.Settings.Default.daysBetweenUpdateCheck)
+ if (DateTime.Now.Subtract(userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate)).TotalDays
+ > userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck))
{
// Set when the last update was
- Settings.Default.lastUpdateCheckDate = DateTime.Now;
- Settings.Default.Save();
- string url = this.userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString().EndsWith("1")
- ? Settings.Default.appcast_unstable
- : Settings.Default.appcast;
- UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDone), false, url, userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild),
- Settings.Default.skipversion, userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion));
+ this.userSettingService.SetUserSetting(UserSettingConstants.LastUpdateCheckDate, DateTime.Now);
+ string url = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString().EndsWith("1")
+ ? userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_unstable)
+ : userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast);
+ UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDone), false, url, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
+ userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion), userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion));
}
}
// Clear the log files in the background
- if (Settings.Default.clearOldLogs)
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs))
{
Thread clearLog = new Thread(() => GeneralUtilities.ClearLogFiles(30));
clearLog.Start();
@@ -168,15 +168,16 @@ namespace Handbrake lbl_encode.Text = string.Empty;
drop_mode.SelectedIndex = 0;
queueWindow = new frmQueue(this.queueProcessor, this); // Prepare the Queue
- if (!Settings.Default.QueryEditorTab)
+ if (!userSettingService.GetUserSetting<bool>(UserSettingConstants.QueryEditorTab))
tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled.
- if (Settings.Default.tooltipEnable)
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
ToolTip.Active = true;
// Load the user's default settings or Normal Preset
- if (Settings.Default.defaultPreset != string.Empty && presetHandler.GetPreset(Properties.Settings.Default.defaultPreset) != null)
+ if (userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset) != string.Empty
+ && presetHandler.GetPreset(userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset)) != null)
{
- this.loadPreset(Settings.Default.defaultPreset);
+ this.loadPreset(userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset));
}
else
loadPreset("Normal");
@@ -213,7 +214,8 @@ namespace Handbrake if (info.NewVersionAvailable)
{
- UpdateInfo updateWindow = new UpdateInfo(info, userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeBuild));
+ UpdateInfo updateWindow = new UpdateInfo(info, userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeBuild));
updateWindow.ShowDialog();
}
}
@@ -235,7 +237,7 @@ namespace Handbrake RegisterPresetEventHandler();
// Handle Window Resize
- if (Settings.Default.MainWindowMinimize)
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize))
this.Resize += this.frmMain_Resize;
// Handle Encode Start / Finish / Pause
@@ -452,12 +454,13 @@ namespace Handbrake private void MnuCheckForUpdates_Click(object sender, EventArgs e)
{
lbl_updateCheck.Visible = true;
- Settings.Default.lastUpdateCheckDate = DateTime.Now;
- Settings.Default.Save();
- string url = userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString().EndsWith("1")
- ? Settings.Default.appcast_unstable
- : Settings.Default.appcast;
- UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDoneMenu), false, url, userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild), Settings.Default.skipversion, userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion));
+ this.userSettingService.SetUserSetting(UserSettingConstants.LastUpdateCheckDate, DateTime.Now);
+ string url = userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString().EndsWith("1")
+ ? userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast_unstable)
+ : userSettingService.GetUserSetting<string>(UserSettingConstants.Appcast);
+ UpdateService.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDoneMenu), false,
+ url, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
+ userSettingService.GetUserSetting<int>(UserSettingConstants.Skipversion), userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion));
}
/// <summary>
@@ -641,8 +644,7 @@ namespace Handbrake {
if (treeView_presets.SelectedNode != null)
{
- Settings.Default.defaultPreset = treeView_presets.SelectedNode.Text;
- Settings.Default.Save();
+ this.userSettingService.SetUserSetting(UserSettingConstants.DefaultPreset, treeView_presets.SelectedNode.Text);
MessageBox.Show("New default preset set: " + treeView_presets.SelectedNode.Text, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
@@ -948,7 +950,7 @@ namespace Handbrake {
if (btn_start.Text == "Stop")
{
- DialogResult result = !userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowCLI)
+ DialogResult result = !userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI)
? MessageBox.Show(
"Are you sure you wish to cancel the encode?\n\nPlease note: Stopping this encode will render the file unplayable. ",
"Cancel Encode?",
@@ -965,7 +967,7 @@ namespace Handbrake // Pause The Queue
this.queueProcessor.Pause();
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowCLI))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI))
this.queueProcessor.EncodeService.SafelyStop();
else
this.queueProcessor.EncodeService.Stop();
@@ -986,7 +988,7 @@ namespace Handbrake string query = string.Empty;
// Check to make sure the generated query matches the GUI settings
- if (Properties.Settings.Default.PromptOnUnmatchingQueries && !string.IsNullOrEmpty(specifiedQuery) &&
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PromptOnUnmatchingQueries) && !string.IsNullOrEmpty(specifiedQuery) &&
generatedQuery != specifiedQuery)
{
DialogResult result = MessageBox.Show("The query under the \"Query Editor\" tab " +
@@ -1082,7 +1084,7 @@ namespace Handbrake /// <param name="e">The EventArgs</param>
private void MnuAddMultiToQueueClick(object sender, EventArgs e)
{
- if (!Settings.Default.autoNaming)
+ if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
{
MessageBox.Show("Destination Auto Naming must be enabled in preferences for this feature to work.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -1436,7 +1438,7 @@ namespace Handbrake // Populate the Angles dropdown
drop_angle.Items.Clear();
- if (!userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (!userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
{
drop_angle.Visible = true;
lbl_angle.Visible = true;
@@ -1483,7 +1485,7 @@ namespace Handbrake labelSource.Text = Path.GetFileName(selectedTitle.SourceName);
// Run the AutoName & ChapterNaming functions
- if (Properties.Settings.Default.autoNaming)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
{
string autoPath = Main.AutoName(this);
if (autoPath != null)
@@ -1565,7 +1567,7 @@ namespace Handbrake lbl_duration.Text = this.selectedTitle.CalculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex).ToString();
// Run the Autonaming function
- if (Properties.Settings.Default.autoNaming)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
text_destination.Text = Main.AutoName(this);
// Disable chapter markers if only 1 chapter is selected.
@@ -1679,7 +1681,8 @@ namespace Handbrake {
case 1:
if (!Path.GetExtension(DVD_Save.FileName).Equals(".mp4", StringComparison.InvariantCultureIgnoreCase))
- if (Properties.Settings.Default.useM4v == 2 || Properties.Settings.Default.useM4v == 0)
+ if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v) == 2 ||
+ this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v) == 0)
DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv", ".m4v");
else
DVD_Save.FileName = DVD_Save.FileName.Replace(".m4v", ".mp4").Replace(".mkv", ".mp4");
@@ -1743,8 +1746,8 @@ namespace Handbrake setContainerOpts();
if (newExtension == ".mp4" || newExtension == ".m4v")
- if (Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() || Subtitles.RequiresM4V() || Properties.Settings.Default.useM4v == 2)
- newExtension = Properties.Settings.Default.useM4v == 1 ? ".mp4" : ".m4v";
+ if (Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() || Subtitles.RequiresM4V() || this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v) == 2)
+ newExtension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v) == 1 ? ".mp4" : ".m4v";
else
newExtension = ".mp4";
@@ -1791,11 +1794,11 @@ namespace Handbrake case "H.264 (x264)":
slider_videoQuality.Minimum = 0;
slider_videoQuality.TickFrequency = 1;
- double cqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
double multiplier = 1.0 / cqStep;
double value = slider_videoQuality.Value * multiplier;
- slider_videoQuality.Maximum = (int)(51 / userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step));
+ slider_videoQuality.Maximum = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));
if (value < slider_videoQuality.Maximum)
slider_videoQuality.Value = slider_videoQuality.Maximum - (int)value;
@@ -1862,7 +1865,7 @@ namespace Handbrake {
if (cachedCqStep == 0)
{
- cachedCqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ cachedCqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
}
// Work out the current RF value.
@@ -1870,13 +1873,13 @@ namespace Handbrake double rfValue = 51.0 - slider_videoQuality.Value * cqStep;
// Change the maximum value for the slider
- slider_videoQuality.Maximum = (int)(51 / userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step));
+ slider_videoQuality.Maximum = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));
// Reset the CQ slider to RF0
slider_videoQuality.Value = slider_videoQuality.Maximum;
// Reset the CQ slider back to the previous value as close as possible
- double cqStepNew = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ double cqStepNew = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
double rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;
while (rfValueCurrent < rfValue)
{
@@ -1885,12 +1888,12 @@ namespace Handbrake }
// Cache the CQ step for the next calculation
- this.cachedCqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ this.cachedCqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
}
private void slider_videoQuality_Scroll(object sender, EventArgs e)
{
- double cqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
+ double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
switch (drp_videoEncoder.Text)
{
case "MPEG-4 (FFmpeg)":
@@ -2041,7 +2044,7 @@ namespace Handbrake // Start the Scan
try
{
- SourceScan.Scan(sourcePath, title, Properties.Settings.Default.previewScanCount);
+ SourceScan.Scan(sourcePath, title, this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount));
}
catch (Exception exc)
{
@@ -2294,7 +2297,7 @@ namespace Handbrake btn_start.Image = Properties.Resources.Play;
// If the window is minimized, display the notification in a popup.
- if (Properties.Settings.Default.trayIconAlerts)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.TrayIconAlerts))
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon.BalloonTipText = lbl_encode.Text;
@@ -2407,7 +2410,7 @@ namespace Handbrake private void LoadPresetPanel()
{
if (presetHandler.CheckIfPresetsAreOutOfDate())
- if (!Settings.Default.presetNotification)
+ if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification))
MessageBox.Show(this,
"HandBrake has determined your built-in presets are out of date... These presets will now be updated.",
"Preset Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -2495,7 +2498,7 @@ namespace Handbrake if (info.NewVersionAvailable)
{
- UpdateInfo updateWindow = new UpdateInfo(info, userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeBuild));
+ UpdateInfo updateWindow = new UpdateInfo(info, userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeBuild));
updateWindow.ShowDialog();
}
else
diff --git a/win/CS/frmOptions.cs b/win/CS/frmOptions.cs index 0e64dddc1..0b1ad71d2 100644 --- a/win/CS/frmOptions.cs +++ b/win/CS/frmOptions.cs @@ -7,13 +7,13 @@ namespace Handbrake {
using System;
using System.Collections.Generic;
+ using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using HandBrake.ApplicationServices;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -36,7 +36,7 @@ namespace Handbrake IDictionary<string, string> langList = LanguageUtilities.MapLanguages();
- foreach (string selectedItem in Properties.Settings.Default.SelectedLanguages)
+ foreach (string selectedItem in this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
// removing wrong keys when a new Language list comes out.
if (langList.ContainsKey(selectedItem))
@@ -48,7 +48,7 @@ namespace Handbrake drop_preferredLang.Items.Add(item);
// In the available languages should be no "Any" and no selected language.
- if ((item != "Any") && (!Properties.Settings.Default.SelectedLanguages.Contains(item)))
+ if ((item != "Any") && (!this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages).Contains(item)))
{
listBox_availableLanguages.Items.Add(item);
}
@@ -59,18 +59,18 @@ namespace Handbrake // #############################
// Enable Tooltips.
- if (Properties.Settings.Default.tooltipEnable)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
{
check_tooltip.CheckState = CheckState.Checked;
ToolTip.Active = true;
}
// Update Check
- if (Properties.Settings.Default.updateStatus)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UpdateStatus))
check_updateCheck.CheckState = CheckState.Checked;
// Days between update checks
- switch (Properties.Settings.Default.daysBetweenUpdateCheck)
+ switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck))
{
case 1:
drop_updateCheckDays.SelectedIndex = 0;
@@ -87,148 +87,149 @@ namespace Handbrake drp_completeOption.Text = userSettingService.GetUserSetting<string>("WhenCompleteAction");
// Growl.
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlEncode))
+ if (userSettingService.GetUserSetting<bool>(HandBrake.ApplicationServices.ASUserSettingConstants.GrowlEncode))
check_growlEncode.CheckState = CheckState.Checked;
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlQueue))
+ if (userSettingService.GetUserSetting<bool>(HandBrake.ApplicationServices.ASUserSettingConstants.GrowlQueue))
check_GrowlQueue.CheckState = CheckState.Checked;
- check_sendFileTo.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile);
- lbl_sendFileTo.Text = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo));
- txt_SendFileArgs.Text = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs);
+ check_sendFileTo.Checked = this.userSettingService.GetUserSetting<bool>(HandBrake.ApplicationServices.ASUserSettingConstants.SendFile);
+ lbl_sendFileTo.Text = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting<string>(HandBrake.ApplicationServices.ASUserSettingConstants.SendFileTo));
+ txt_SendFileArgs.Text = this.userSettingService.GetUserSetting<string>(HandBrake.ApplicationServices.ASUserSettingConstants.SendFileToArgs);
// #############################
// Output Settings
// #############################
// Enable auto naming feature.)
- if (Properties.Settings.Default.autoNaming)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
check_autoNaming.CheckState = CheckState.Checked;
// Store the auto name path
- text_an_path.Text = Properties.Settings.Default.autoNamePath;
+ text_an_path.Text = this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath);
if (text_an_path.Text == string.Empty)
text_an_path.Text = "Click 'Browse' to set the default location";
// Store auto name format
- txt_autoNameFormat.Text = Properties.Settings.Default.autoNameFormat;
+ txt_autoNameFormat.Text = this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
// Use iPod/iTunes friendly .m4v extension for MP4 files.
- cb_mp4FileMode.SelectedIndex = Properties.Settings.Default.useM4v;
+ cb_mp4FileMode.SelectedIndex = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v);
// Remove Underscores
- check_removeUnderscores.Checked = Properties.Settings.Default.AutoNameRemoveUnderscore;
+ check_removeUnderscores.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore);
// Title case
- check_TitleCase.Checked = Properties.Settings.Default.AutoNameTitleCase;
+ check_TitleCase.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase);
// #############################
// Picture Tab
// #############################
// VLC Path
- txt_vlcPath.Text = Properties.Settings.Default.VLC_Path;
+ txt_vlcPath.Text = this.userSettingService.GetUserSetting<string>(UserSettingConstants.VLC_Path);
// #############################
// Audio and Subtitles Tab
// #############################
- drop_preferredLang.SelectedItem = Properties.Settings.Default.NativeLanguage;
-
- if (Settings.Default.DubMode != 255)
- {
- switch (Settings.Default.DubMode)
- {
- case 0:
- Settings.Default.DubModeAudio = 2;
- Settings.Default.DubModeSubtitle = 0;
- Settings.Default.DubMode = 255;
- break;
- case 1:
- Settings.Default.DubModeAudio = 4;
- Settings.Default.DubModeSubtitle = 0;
- Settings.Default.DubMode = 255;
- break;
- case 2:
- Settings.Default.DubModeAudio = 2;
- Settings.Default.DubModeSubtitle = 4;
- Settings.Default.DubMode = 255;
- break;
- case 3:
- Settings.Default.DubModeAudio = 4;
- Settings.Default.DubModeSubtitle = 4;
- Settings.Default.DubMode = 255;
- break;
- default:
- Settings.Default.DubMode = 255;
- break;
- }
- }
-
- cb_audioMode.SelectedIndex = Settings.Default.DubModeAudio;
- cb_subtitleMode.SelectedIndex = Settings.Default.DubModeSubtitle;
-
- check_AddOnlyOneAudioPerLanguage.Checked = Properties.Settings.Default.addOnlyOneAudioPerLanguage;
-
- check_AddCCTracks.Checked = Properties.Settings.Default.useClosedCaption;
+ drop_preferredLang.SelectedItem = this.userSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage);
+
+ //if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.DubMode) != 255)
+ //{
+ // switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.DubMode))
+ // {
+ // case 0:
+ // Settings.Default.DubModeAudio = 2;
+ // Settings.Default.DubModeSubtitle = 0;
+ // Settings.Default.DubMode = 255;
+ // break;
+ // case 1:
+ // Settings.Default.DubModeAudio = 4;
+ // Settings.Default.DubModeSubtitle = 0;
+ // Settings.Default.DubMode = 255;
+ // break;
+ // case 2:
+ // Settings.Default.DubModeAudio = 2;
+ // Settings.Default.DubModeSubtitle = 4;
+ // Settings.Default.DubMode = 255;
+ // break;
+ // case 3:
+ // Settings.Default.DubModeAudio = 4;
+ // Settings.Default.DubModeSubtitle = 4;
+ // Settings.Default.DubMode = 255;
+ // break;
+ // default:
+ // Settings.Default.DubMode = 255;
+ // break;
+ // }
+ //}
+
+ cb_audioMode.SelectedIndex = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DubModeAudio);
+ cb_subtitleMode.SelectedIndex = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DubModeSubtitle);
+
+ check_AddOnlyOneAudioPerLanguage.Checked =
+ this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AddOnlyOneAudioPerLanguage);
+
+ check_AddCCTracks.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseClosedCaption);
// #############################
// CLI
// #############################
// Priority level for encodes
- drp_Priority.Text = userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority);
+ drp_Priority.Text = userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority);
- check_preventSleep.Checked = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep);
+ check_preventSleep.Checked = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep);
// Log Verbosity Level
- cb_logVerboseLvl.SelectedIndex = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity);
+ cb_logVerboseLvl.SelectedIndex = userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity);
// Save logs in the same directory as encoded files
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogWithVideo))
check_saveLogWithVideo.CheckState = CheckState.Checked;
// Save Logs in a specified path
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogToCopyDirectory))
check_logsInSpecifiedLocation.CheckState = CheckState.Checked;
// The saved log path
- text_logPath.Text = userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory);
+ text_logPath.Text = userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory);
- check_clearOldLogs.Checked = Properties.Settings.Default.clearOldLogs;
+ check_clearOldLogs.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs);
// #############################
// Advanced
// #############################
// Minimise to Tray
- if (Properties.Settings.Default.trayIconAlerts)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.TrayIconAlerts))
check_trayStatusAlerts.CheckState = CheckState.Checked;
// Tray Balloon popups
- if (Properties.Settings.Default.MainWindowMinimize)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize))
check_mainMinimize.CheckState = CheckState.Checked;
// Enable / Disable Query editor tab
- if (Properties.Settings.Default.QueryEditorTab)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.QueryEditorTab))
check_queryEditorTab.CheckState = CheckState.Checked;
check_promptOnUnmatchingQueries.Enabled = check_queryEditorTab.Checked;
// Prompt on inconsistant queries
- check_promptOnUnmatchingQueries.Checked = Properties.Settings.Default.PromptOnUnmatchingQueries;
+ check_promptOnUnmatchingQueries.Checked = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PromptOnUnmatchingQueries);
// Preset update notification
- if (Properties.Settings.Default.presetNotification)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification))
check_disablePresetNotification.CheckState = CheckState.Checked;
// Show CLI Window
- check_showCliForInGUIEncode.Checked = userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowCLI);
+ check_showCliForInGUIEncode.Checked = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI);
// Set the preview count
- drop_previewScanCount.SelectedItem = Properties.Settings.Default.previewScanCount.ToString();
+ drop_previewScanCount.SelectedItem = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount).ToString();
// x264 step
- string step = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString(new CultureInfo("en-US"));
+ string step = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step).ToString(new CultureInfo("en-US"));
switch (step)
{
case "1":
@@ -246,10 +247,10 @@ namespace Handbrake }
// Min Title Length
- ud_minTitleLength.Value = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);
+ ud_minTitleLength.Value = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration);
// Use Experimental dvdnav
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav))
+ if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
check_dvdnav.CheckState = CheckState.Checked;
optionsWindowLoading = false;
@@ -259,7 +260,7 @@ namespace Handbrake private void check_updateCheck_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.updateStatus = check_updateCheck.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.UpdateStatus, check_updateCheck.Checked);
}
private void drop_updateCheckDays_SelectedIndexChanged(object sender, EventArgs e)
@@ -267,35 +268,35 @@ namespace Handbrake switch (drop_updateCheckDays.SelectedIndex)
{
case 0:
- Properties.Settings.Default.daysBetweenUpdateCheck = 1;
+ this.userSettingService.SetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, 1);
break;
case 1:
- Properties.Settings.Default.daysBetweenUpdateCheck = 7;
+ this.userSettingService.SetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, 7);
break;
case 2:
- Properties.Settings.Default.daysBetweenUpdateCheck = 30;
+ this.userSettingService.SetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, 30);
break;
}
}
private void check_tooltip_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.tooltipEnable = check_tooltip.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.TooltipEnable, check_tooltip.Checked);
}
private void drp_completeOption_SelectedIndexChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, drp_completeOption.Text);
+ userSettingService.SetUserSetting(ASUserSettingConstants.WhenCompleteAction, drp_completeOption.Text);
}
private void check_GrowlQueue_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.GrowlQueue, check_GrowlQueue.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.GrowlQueue, check_GrowlQueue.Checked);
}
private void check_growlEncode_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.GrowlEncode, check_growlEncode.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.GrowlEncode, check_growlEncode.Checked);
}
private void btn_SendFileToPath_Click(object sender, EventArgs e)
@@ -303,19 +304,19 @@ namespace Handbrake openExecutable.ShowDialog();
if (!string.IsNullOrEmpty(openExecutable.FileName))
{
- this.userSettingService.SetUserSetting(UserSettingConstants.SendFileTo, openExecutable.FileName);
+ this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFileTo, openExecutable.FileName);
lbl_sendFileTo.Text = Path.GetFileNameWithoutExtension(openExecutable.FileName);
}
}
private void check_sendFileTo_CheckedChanged(object sender, EventArgs e)
{
- this.userSettingService.SetUserSetting(UserSettingConstants.SendFile, check_sendFileTo.Checked);
+ this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFile, check_sendFileTo.Checked);
}
private void txt_SendFileArgs_TextChanged(object sender, EventArgs e)
{
- this.userSettingService.SetUserSetting(UserSettingConstants.SendFileToArgs, txt_SendFileArgs.Text);
+ this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFileToArgs, txt_SendFileArgs.Text);
}
#endregion
@@ -323,12 +324,12 @@ namespace Handbrake #region Output File
private void check_autoNaming_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.autoNaming = check_autoNaming.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNaming, check_autoNaming.Checked);
}
private void txt_autoNameFormat_TextChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.autoNameFormat = txt_autoNameFormat.Text;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameFormat, txt_autoNameFormat.Text);
}
private void btn_browse_Click(object sender, EventArgs e)
@@ -341,11 +342,11 @@ namespace Handbrake {
if (text_an_path.Text == string.Empty)
{
- Properties.Settings.Default.autoNamePath = string.Empty;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNamePath, string.Empty);
text_an_path.Text = "Click 'Browse' to set the default location";
}
else
- Properties.Settings.Default.autoNamePath = text_an_path.Text;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNamePath, text_an_path.Text);
if (text_an_path.Text.ToLower() == "{source_path}" && !optionsWindowLoading)
{
@@ -362,17 +363,17 @@ namespace Handbrake private void cb_mp4FileMode_SelectedIndexChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.useM4v = cb_mp4FileMode.SelectedIndex;
+ this.userSettingService.SetUserSetting(UserSettingConstants.UseM4v, cb_mp4FileMode.SelectedIndex);
}
private void check_removeUnderscores_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.AutoNameRemoveUnderscore = check_removeUnderscores.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameRemoveUnderscore, check_removeUnderscores.Checked);
}
private void check_TitleCase_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.AutoNameTitleCase = check_TitleCase.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameTitleCase, check_TitleCase.Checked);
}
#endregion
@@ -388,7 +389,7 @@ namespace Handbrake private void txt_vlcPath_TextChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.VLC_Path = txt_vlcPath.Text;
+ this.userSettingService.SetUserSetting(UserSettingConstants.VLC_Path, txt_vlcPath.Text);
}
#endregion
@@ -397,9 +398,9 @@ namespace Handbrake private void drop_preferredLang_SelectedIndexChanged(object sender, EventArgs e)
{
- Settings.Default.NativeLanguage = drop_preferredLang.SelectedItem.ToString();
+ this.userSettingService.SetUserSetting(UserSettingConstants.NativeLanguage, drop_preferredLang.SelectedItem.ToString());
- if (Settings.Default.NativeLanguage == "Any")
+ if (this.userSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
{
cb_audioMode.Enabled = false;
cb_subtitleMode.Enabled = false;
@@ -432,8 +433,12 @@ namespace Handbrake {
listBox_selectedLanguages.Items.Remove(item);
- if (Properties.Settings.Default.SelectedLanguages.Contains(item))
- Properties.Settings.Default.SelectedLanguages.Remove(item);
+ StringCollection languages = this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ if (languages.Contains(item))
+ {
+ languages.Remove(item);
+ this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, languages);
+ }
}
}
}
@@ -447,8 +452,11 @@ namespace Handbrake listBox_availableLanguages.SelectedItems.CopyTo(movedItems, 0);
listBox_selectedLanguages.Items.AddRange(movedItems);
- Properties.Settings.Default.SelectedLanguages.AddRange(movedItems);
+ StringCollection languages = this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ languages.AddRange(movedItems);
+ this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, languages);
+
listBox_availableLanguages.SelectedItems.Clear();
foreach (string item in movedItems)
{
@@ -471,8 +479,12 @@ namespace Handbrake {
listBox_selectedLanguages.Items.Remove(item);
- if (Properties.Settings.Default.SelectedLanguages.Contains(item))
- Properties.Settings.Default.SelectedLanguages.Remove(item);
+ StringCollection languages = this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ if (languages.Contains(item))
+ {
+ languages.Remove(item);
+ this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, languages);
+ }
}
}
}
@@ -500,8 +512,10 @@ namespace Handbrake listBox_selectedLanguages.SetSelected(ilevel - 1, true);
// Do the same on the Property.
- Properties.Settings.Default.SelectedLanguages.Remove(lvitem);
- Properties.Settings.Default.SelectedLanguages.Insert(ilevel - 1, lvitem);
+ StringCollection languages = this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ languages.Remove(lvitem);
+ languages.Insert(ilevel - 1, lvitem);
+ this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, languages);
}
}
}
@@ -530,8 +544,10 @@ namespace Handbrake listBox_selectedLanguages.SetSelected(ilevel + 1, true);
// Do the same on the Property.
- Properties.Settings.Default.SelectedLanguages.Remove(lvitem);
- Properties.Settings.Default.SelectedLanguages.Insert(ilevel + 1, lvitem);
+ StringCollection languages = this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ languages.Remove(lvitem);
+ languages.Insert(ilevel + 1, lvitem);
+ this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, languages);
}
}
}
@@ -549,22 +565,22 @@ namespace Handbrake private void check_AddOnlyOneAudioPerLanguage_CheckedChanged(object sender, EventArgs e)
{
- Settings.Default.addOnlyOneAudioPerLanguage = check_AddOnlyOneAudioPerLanguage.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.AddOnlyOneAudioPerLanguage, check_AddOnlyOneAudioPerLanguage.Checked);
}
private void check_AddCCTracks_CheckedChanged(object sender, EventArgs e)
{
- Settings.Default.useClosedCaption = check_AddCCTracks.Checked;
+ this.userSettingService.SetUserSetting(UserSettingConstants.UseClosedCaption, check_AddCCTracks.Checked);
}
private void cb_audioMode_SelectedIndexChanged(object sender, EventArgs e)
{
- Settings.Default.DubModeAudio = cb_audioMode.SelectedIndex;
+ this.userSettingService.SetUserSetting(UserSettingConstants.DubModeAudio, cb_audioMode.SelectedIndex);
}
private void cb_subtitleMode_SelectedIndexChanged(object sender, EventArgs e)
{
- Settings.Default.DubModeSubtitle = cb_subtitleMode.SelectedIndex;
+ this.userSettingService.SetUserSetting(UserSettingConstants.DubModeSubtitle, cb_subtitleMode.SelectedIndex);
}
#endregion
@@ -573,27 +589,27 @@ namespace Handbrake private void drp_Priority_SelectedIndexChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.ProcessPriority, drp_Priority.Text);
+ userSettingService.SetUserSetting(ASUserSettingConstants.ProcessPriority, drp_Priority.Text);
}
private void check_preventSleep_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, check_preventSleep.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.PreventSleep, check_preventSleep.Checked);
}
private void cb_logVerboseLvl_SelectedIndexChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.Verbosity, cb_logVerboseLvl.SelectedIndex);
+ userSettingService.SetUserSetting(ASUserSettingConstants.Verbosity, cb_logVerboseLvl.SelectedIndex);
}
private void check_saveLogWithVideo_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.SaveLogWithVideo, check_saveLogWithVideo.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogWithVideo, check_saveLogWithVideo.Checked);
}
private void check_logsInSpecifiedLocation_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.SaveLogToCopyDirectory, check_logsInSpecifiedLocation.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory, check_logsInSpecifiedLocation.Checked);
}
private void btn_saveLog_Click(object sender, EventArgs e)
@@ -606,7 +622,7 @@ namespace Handbrake private void text_logPath_TextChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.SaveLogCopyDirectory, text_logPath.Text);
+ userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory, text_logPath.Text);
}
private void btn_viewLogs_Click(object sender, EventArgs e)
@@ -633,7 +649,7 @@ namespace Handbrake private void check_clearOldLogs_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.clearOldLogs = check_clearOldLogs.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.ClearOldLogs, check_clearOldLogs.Checked);
}
#endregion
@@ -642,39 +658,39 @@ namespace Handbrake private void check_mainMinimize_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.MainWindowMinimize = check_mainMinimize.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.MainWindowMinimize, check_mainMinimize.Checked);
check_trayStatusAlerts.Enabled = check_mainMinimize.Checked;
}
private void check_trayStatusAlerts_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.trayIconAlerts = check_trayStatusAlerts.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.TrayIconAlerts, check_trayStatusAlerts.Checked);
}
private void check_queryEditorTab_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.QueryEditorTab = check_queryEditorTab.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.QueryEditorTab, check_queryEditorTab.Checked);
check_promptOnUnmatchingQueries.Enabled = check_queryEditorTab.Checked;
}
private void check_promptOnUnmatchingQueries_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.PromptOnUnmatchingQueries = check_promptOnUnmatchingQueries.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.PromptOnUnmatchingQueries, check_promptOnUnmatchingQueries.Checked);
}
private void check_disablePresetNotification_CheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.presetNotification = check_disablePresetNotification.Checked;
+ userSettingService.SetUserSetting(UserSettingConstants.PresetNotification, check_disablePresetNotification.Checked);
}
private void check_showCliForInGUIEncode_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.ShowCLI, check_showCliForInGUIEncode.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.ShowCLI, check_showCliForInGUIEncode.Checked);
}
private void drop_previewScanCount_SelectedIndexChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.previewScanCount = int.Parse(drop_previewScanCount.SelectedItem.ToString());
+ userSettingService.SetUserSetting(UserSettingConstants.PreviewScanCount, int.Parse(drop_previewScanCount.SelectedItem.ToString()));
}
private void x264step_SelectedIndexChanged(object sender, EventArgs e)
@@ -682,16 +698,16 @@ namespace Handbrake switch (drop_x264step.SelectedIndex)
{
case 0:
- userSettingService.SetUserSetting(UserSettingConstants.X264Step, 1.0);
+ userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, 1.0);
break;
case 1:
- userSettingService.SetUserSetting(UserSettingConstants.X264Step, 0.5);
+ userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, 0.5);
break;
case 2:
- userSettingService.SetUserSetting(UserSettingConstants.X264Step, 0.25);
+ userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, 0.25);
break;
case 3:
- userSettingService.SetUserSetting(UserSettingConstants.X264Step, 0.2);
+ userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, 0.2);
break;
}
mainWindow.setQualityFromSlider();
@@ -699,7 +715,7 @@ namespace Handbrake private void check_dvdnav_CheckedChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, check_dvdnav.Checked);
+ userSettingService.SetUserSetting(ASUserSettingConstants.DisableLibDvdNav, check_dvdnav.Checked);
}
private void ud_minTitleLength_ValueChanged(object sender, EventArgs e)
@@ -707,7 +723,7 @@ namespace Handbrake int value;
if (int.TryParse(ud_minTitleLength.Value.ToString(), out value))
{
- this.userSettingService.SetUserSetting(UserSettingConstants.MinScanDuration, value);
+ this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value);
}
}
diff --git a/win/CS/frmPreview.cs b/win/CS/frmPreview.cs index c137262a9..92fd00c62 100644 --- a/win/CS/frmPreview.cs +++ b/win/CS/frmPreview.cs @@ -12,6 +12,7 @@ namespace Handbrake using System.Windows.Forms;
using Functions;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -41,6 +42,11 @@ namespace Handbrake private string currentlyPlaying = string.Empty;
/// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
+ /// <summary>
/// Update UI Delegate
/// </summary>
/// <param name="sender">
@@ -68,7 +74,7 @@ namespace Handbrake endPoint.SelectedIndex = 1;
startPoint.Items.Clear();
- for (int i = 1; i <= Properties.Settings.Default.previewScanCount; i++)
+ for (int i = 1; i <= UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount); i++)
{
startPoint.Items.Add(i.ToString());
}
@@ -78,7 +84,7 @@ namespace Handbrake encodeQueue.EncodeStarted += this.EncodeQueueEncodeStarted;
encodeQueue.EncodeCompleted += this.EncodeQueueEncodeEnded;
- defaultPlayer.Checked = Properties.Settings.Default.defaultPlayer;
+ defaultPlayer.Checked = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
}
#region Event Handlers
@@ -159,8 +165,7 @@ namespace Handbrake private void DefaultPlayerCheckedChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.defaultPlayer = defaultPlayer.Checked;
- Properties.Settings.Default.Save();
+ UserSettingService.SetUserSetting(UserSettingConstants.DefaultPlayer, defaultPlayer.Checked);
}
#endregion
@@ -244,11 +249,11 @@ namespace Handbrake else vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");
- if (!File.Exists(Properties.Settings.Default.VLC_Path))
+ if (!File.Exists(UserSettingService.GetUserSetting<string>(UserSettingConstants.VLC_Path)))
{
if (File.Exists(vlcPath))
{
- Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
+ UserSettingService.SetUserSetting(UserSettingConstants.VLC_Path, "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe");
Properties.Settings.Default.Save(); // Save this new path if it does
}
else
@@ -262,9 +267,9 @@ namespace Handbrake }
}
- if (File.Exists(Properties.Settings.Default.VLC_Path))
+ if (File.Exists(UserSettingService.GetUserSetting<string>(UserSettingConstants.VLC_Path)))
{
- ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);
+ ProcessStartInfo vlc = new ProcessStartInfo(UserSettingService.GetUserSetting<string>(UserSettingConstants.VLC_Path), args);
Process.Start(vlc);
}
}
diff --git a/win/CS/frmQueue.cs b/win/CS/frmQueue.cs index 98012f78b..82cb4e7b1 100644 --- a/win/CS/frmQueue.cs +++ b/win/CS/frmQueue.cs @@ -76,7 +76,7 @@ namespace Handbrake queue.EncodeService.EncodeStarted += this.queue_EncodeStarted;
queue.EncodeService.EncodeCompleted += this.queue_EncodeEnded;
- drp_completeOption.Text = userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
+ drp_completeOption.Text = userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction);
}
/// <summary>
@@ -745,7 +745,7 @@ namespace Handbrake /// </param>
private void CompleteOptionChanged(object sender, EventArgs e)
{
- userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, drp_completeOption.Text);
+ userSettingService.SetUserSetting(ASUserSettingConstants.WhenCompleteAction, drp_completeOption.Text);
}
/// <summary>
|