diff options
author | sr55 <[email protected]> | 2009-05-07 20:29:25 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-05-07 20:29:25 +0000 |
commit | 6962b79b59f8b060983a27a6a1e3e16b3a0c67aa (patch) | |
tree | 5055ad58d4fb17338ea6e9023d2710e3a9d0a943 /win/C#/Presets | |
parent | 928eba343a9da729368ffb6f161d0d69f637d465 (diff) |
WinGui:
- Built-in presets get automatically re-generated if a newer build number is detected. This is required since the installer no longer installs presets. (overwrite older versions on install of new version) (As of a few builds ago, presets are automatically generated on first launch)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2399 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Presets')
-rw-r--r-- | win/C#/Presets/PresetsHandler.cs | 16 | ||||
-rw-r--r-- | win/C#/Presets/preset.cs | 5 |
2 files changed, 16 insertions, 5 deletions
diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs index 064d4f320..cbd654558 100644 --- a/win/C#/Presets/PresetsHandler.cs +++ b/win/C#/Presets/PresetsHandler.cs @@ -12,7 +12,7 @@ namespace Handbrake.Presets {
public class PresetsHandler
{
- List<Preset> presets = new List<Preset>();
+ List<Preset> presets = new List<Preset>();
List<Preset> user_presets = new List<Preset>();
private static readonly XmlSerializer ser = new XmlSerializer(typeof(List<Preset>));
String userPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\user_presets.xml";
@@ -28,7 +28,7 @@ namespace Handbrake.Presets {
if (checkIfPresetExists(presetName) == false)
{
- Preset newPreset = new Preset { Name = presetName, Query = query, PictureSettings = pictureSettings };
+ Preset newPreset = new Preset { Name = presetName, Query = query, PictureSettings = pictureSettings, Version = Properties.Settings.Default.hb_version};
user_presets.Add(newPreset);
updateUserPresetsFile();
return true;
@@ -138,7 +138,7 @@ namespace Handbrake.Presets // Clear the current built in presets and now parse the tempory presets file.
presets.Clear();
string filePath = Path.Combine(Path.GetTempPath(), "temp_presets.dat");
-
+
if (File.Exists(filePath))
{
StreamReader presetInput = new StreamReader(filePath);
@@ -180,7 +180,8 @@ namespace Handbrake.Presets Category = category,
TopCategory = level_1_category,
Name = presetName[0].Replace("+", "").Trim(),
- Query = presetName[2]
+ Query = presetName[2],
+ Version = Properties.Settings.Default.hb_version
};
presets.Add(newPreset);
}
@@ -219,6 +220,11 @@ namespace Handbrake.Presets }
}
+ // Update built-in presets if the built-in presets belong to an older version.
+ if (presets.Count != 0)
+ if (presets[0].Version != Properties.Settings.Default.hb_version)
+ updateBuiltInPresets();
+
// Load in the users presets from user_presets.xml
if (File.Exists(userPresetFile))
@@ -290,7 +296,7 @@ namespace Handbrake.Presets foreach (Preset preset in user_presets)
{
TreeNode preset_treeview = new TreeNode(preset.Name) { ForeColor = Color.Black };
- presetPanel.Nodes.Add(preset_treeview);
+ presetPanel.Nodes.Add(preset_treeview);
}
}
diff --git a/win/C#/Presets/preset.cs b/win/C#/Presets/preset.cs index 2a54d44a9..858237968 100644 --- a/win/C#/Presets/preset.cs +++ b/win/C#/Presets/preset.cs @@ -33,5 +33,10 @@ namespace Handbrake.Presets /// Get or set the usage of Picture Settings in presets.
/// </summary>
public Boolean PictureSettings { get; set; }
+
+ /// <summary>
+ /// The version number which associates this preset with a HB build
+ /// </summary>
+ public string Version { get; set; }
}
}
\ No newline at end of file |