summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services/PresetService.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs46
1 files changed, 17 insertions, 29 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 8f375258c..b0cfc9a74 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -38,11 +38,6 @@ namespace HandBrake.ApplicationServices.Services
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Preset>));
/// <summary>
- /// The User Setting Service
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// User Preset Default Catgory Name
/// </summary>
public static string UserPresetCatgoryName = "User Presets";
@@ -60,30 +55,10 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// A Collection of presets
/// </summary>
- private ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
+ private readonly ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
#endregion
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PresetService"/> class.
- /// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public PresetService(IUserSettingService userSettingService)
- {
- this.userSettingService = userSettingService;
-
- // If the preset file doesn't exist. Create it.
- if (!File.Exists(this.builtInPresetFile))
- {
- this.UpdateBuiltInPresets();
- }
-
- this.LoadPresets();
- }
-
/// <summary>
/// Gets a Collection of presets.
/// </summary>
@@ -114,6 +89,20 @@ namespace HandBrake.ApplicationServices.Services
#region Public Methods
/// <summary>
+ /// The load.
+ /// </summary>
+ public void Load()
+ {
+ // If the preset file doesn't exist. Create it.
+ if (!File.Exists(this.builtInPresetFile))
+ {
+ this.UpdateBuiltInPresets();
+ }
+
+ this.LoadPresets();
+ }
+
+ /// <summary>
/// Add a new preset to the system.
/// Performs an Update if it already exists
/// </summary>
@@ -412,7 +401,7 @@ namespace HandBrake.ApplicationServices.Services
// Recover from Error.
if (File.Exists(file))
{
- string disabledFile = file + ".old";
+ string disabledFile = string.Format("{0}.{1}", file, GeneralUtilities.ProcessId);
File.Move(file, disabledFile);
if (File.Exists(file))
{
@@ -455,7 +444,6 @@ namespace HandBrake.ApplicationServices.Services
{
RecoverFromCorruptedPresetFile(this.builtInPresetFile);
this.UpdateBuiltInPresets();
- throw new GeneralApplicationException("HandBrake has detected corruption in the presets file and has attempted to rebuild this file.", "Please restart HandBrake before continuing.", exc);
}
// Load in the users Presets from UserPresets.xml
@@ -476,7 +464,7 @@ namespace HandBrake.ApplicationServices.Services
catch (Exception exc)
{
RecoverFromCorruptedPresetFile(this.userPresetFile);
- throw new GeneralApplicationException("HandBrake has detected corruption in the presets file and has attempted to rebuild this file.", "Please restart HandBrake before continuing.", exc);
+ throw new GeneralApplicationException("HandBrake has detected a problem with your presets.", "Your old presets file has been renamed so that it doesn't get loaded on next launch.", exc);
}
}