From ec848fee96e7cbfbb2037b1908978ebe45543e54 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 4 May 2009 22:40:46 +0000 Subject: WinGui: # New - Setup LibDVDNav option for scanning. # Directory and logging changes - The GUI now stores preset data in the systems user Application Data directory. This means that multi-user systems don't share the same single set of user presets. - A History of logs are automatically stored in the systems application data directory. - Changed the log preferences to make them a bit easier to understand. # Bugs / Typos - Fixed small bug in the version info regex parser. - Fixed typo on x264 tab - Fixed minor GUI issue on the Add Preset window (button transparency) - Fixed disable Query Editor tab option (Thanks tlindgren) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2383 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Presets/PresetsHandler.cs | 28 +++++++++++++--------------- win/C#/Presets/preset.cs | 3 +++ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'win/C#/Presets') diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs index 657807c10..064d4f320 100644 --- a/win/C#/Presets/PresetsHandler.cs +++ b/win/C#/Presets/PresetsHandler.cs @@ -12,9 +12,11 @@ namespace Handbrake.Presets { public class PresetsHandler { - List presets = new List(); // Category+Level+Preset Name: Query - List user_presets = new List(); // Preset Name: Query + List presets = new List(); + List user_presets = new List(); private static readonly XmlSerializer ser = new XmlSerializer(typeof(List)); + String userPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\user_presets.xml"; + string hbPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml"; /// /// Add a new preset to the system @@ -202,10 +204,9 @@ namespace Handbrake.Presets user_presets.Clear(); // Load in the users presets from user_presets.xml - string filePath = Application.StartupPath + "\\presets.xml"; - if (File.Exists(filePath)) + if (File.Exists(hbPresetFile)) { - using (FileStream strm = new FileStream(filePath, FileMode.Open, FileAccess.Read)) + using (FileStream strm = new FileStream(hbPresetFile, FileMode.Open, FileAccess.Read)) { if (strm.Length != 0) { @@ -219,10 +220,10 @@ namespace Handbrake.Presets } // Load in the users presets from user_presets.xml - filePath = Application.StartupPath + "\\user_presets.xml"; - if (File.Exists(filePath)) + + if (File.Exists(userPresetFile)) { - using (FileStream strm = new FileStream(filePath, FileMode.Open, FileAccess.Read)) + using (FileStream strm = new FileStream(userPresetFile, FileMode.Open, FileAccess.Read)) { if (strm.Length != 0) { @@ -257,8 +258,7 @@ namespace Handbrake.Presets // Deal with Root if (preset.Category == category && preset.TopCategory == category) rootNode.Nodes.Add(preset.Name); - else if (preset.Category != category && preset.TopCategory == category) - // Deal with child nodes for that root + else if (preset.Category != category && preset.TopCategory == category) // Deal with child nodes for that root { if (childNode == null) // For the first child node childNode = new TreeNode(preset.Category); @@ -266,8 +266,7 @@ namespace Handbrake.Presets childNode.Nodes.Add(preset.Name); addChildNode = true; } - else if (preset.Category != category && preset.TopCategory != category && preset.Level == 1) - // Deal with changing root nodes + else if (preset.Category != category && preset.TopCategory != category && preset.Level == 1)// Deal with changing root nodes { // If we find there are child nodes, add them to the current root node set before adding the rootnode to the panel. if (addChildNode) @@ -301,7 +300,7 @@ namespace Handbrake.Presets /// private void updatePresetsFile() { - string userPresets = Application.StartupPath + "\\presets.xml"; + string userPresets = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml"; try { using (FileStream strm = new FileStream(userPresets, FileMode.Create, FileAccess.Write)) @@ -323,10 +322,9 @@ namespace Handbrake.Presets /// private void updateUserPresetsFile() { - string userPresets = Application.StartupPath + "\\user_presets.xml"; try { - using (FileStream strm = new FileStream(userPresets, FileMode.Create, FileAccess.Write)) + using (FileStream strm = new FileStream(userPresetFile, FileMode.Create, FileAccess.Write)) { ser.Serialize(strm, user_presets); strm.Close(); diff --git a/win/C#/Presets/preset.cs b/win/C#/Presets/preset.cs index 4431c9ce1..2a54d44a9 100644 --- a/win/C#/Presets/preset.cs +++ b/win/C#/Presets/preset.cs @@ -14,6 +14,9 @@ namespace Handbrake.Presets /// public string Category { get; set; } + /// + /// Get or Set the top level category for the preset. + /// public string TopCategory { get; set; } /// -- cgit v1.2.3