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.cs48
1 files changed, 46 insertions, 2 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 12afaadbc..30487f15c 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -13,7 +13,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
- using System.Windows;
using System.Xml.Serialization;
using HandBrake.ApplicationServices.Exceptions;
@@ -87,10 +86,21 @@ namespace HandBrake.ApplicationServices.Services
}
/// <summary>
- /// The last preset added.
+ /// Gets or sets LastPresetAdded.
/// </summary>
public Preset LastPresetAdded { get; set; }
+ /// <summary>
+ /// Gets the DefaultPreset.
+ /// </summary>
+ public Preset DefaultPreset
+ {
+ get
+ {
+ return this.presets.FirstOrDefault(p => p.IsDefault);
+ }
+ }
+
#region Public Methods
/// <summary>
@@ -148,6 +158,11 @@ namespace HandBrake.ApplicationServices.Services
/// </param>
public void Remove(Preset preset)
{
+ if (preset == null || preset.IsDefault)
+ {
+ return;
+ }
+
this.presets.Remove(preset);
this.UpdatePresetFiles();
}
@@ -163,6 +178,12 @@ namespace HandBrake.ApplicationServices.Services
List<Preset> removeList = this.presets.Where(p => p.Category == category).ToList();
foreach (Preset preset in removeList)
{
+ if (preset.IsDefault)
+ {
+ // Skip default preset
+ continue;
+ }
+
this.presets.Remove(preset);
}
@@ -170,6 +191,24 @@ namespace HandBrake.ApplicationServices.Services
}
/// <summary>
+ /// Set Default Preset
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ public void SetDefault(Preset name)
+ {
+ foreach (Preset preset in this.presets)
+ {
+ preset.IsDefault = false;
+ }
+
+ name.IsDefault = true;
+ this.UpdatePresetFiles();
+ }
+
+
+ /// <summary>
/// Get a Preset
/// </summary>
/// <param name="name">
@@ -268,6 +307,11 @@ namespace HandBrake.ApplicationServices.Services
IsBuildIn = true
};
+ if (newPreset.Name == "Normal")
+ {
+ newPreset.IsDefault = true;
+ }
+
this.presets.Add(newPreset);
}
}