diff options
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
3 files changed, 52 insertions, 3 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs index ede38b26f..eedf3f737 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs @@ -46,6 +46,11 @@ namespace HandBrake.ApplicationServices.Model public bool IsBuildIn { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether IsDefault.
+ /// </summary>
+ public bool IsDefault { get; set; }
+
+ /// <summary>
/// Override the ToString Method
/// </summary>
/// <returns>
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);
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index 30b752d7d..2bbdfffcd 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>(ASUserSettingConstants.HandBrakeBuild));
+ AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString());
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
|