summaryrefslogtreecommitdiffstats
path: root/win/C#/Presets
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-01-30 23:52:47 +0000
committersr55 <[email protected]>2010-01-30 23:52:47 +0000
commit377768a2a90f5b470a1c047a02f4c998a8b348b4 (patch)
tree90ce0b844e17f6525a75805811555bde12cb6bcd /win/C#/Presets
parent971ab73d6af6d07838922a667648c97e2f07c041 (diff)
WinGui:
- Added some code to allow direct execution of the CLI rather than using CMD. This may be useful later on. - Re-factoring. Added Many code comments / Cleaned up some code style issues. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3088 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Presets')
-rw-r--r--win/C#/Presets/Export.cs177
-rw-r--r--win/C#/Presets/PlistPresetHandler.cs (renamed from win/C#/Presets/Import.cs)207
-rw-r--r--win/C#/Presets/Preset.cs (renamed from win/C#/Presets/preset.cs)0
-rw-r--r--win/C#/Presets/PresetsHandler.cs110
4 files changed, 258 insertions, 236 deletions
diff --git a/win/C#/Presets/Export.cs b/win/C#/Presets/Export.cs
deleted file mode 100644
index a2facd1a6..000000000
--- a/win/C#/Presets/Export.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Export.cs $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr/>.
- It may be used under the terms of the GNU General Public License. */
-
-using System;
-using System.Text;
-using System.Xml;
-
-namespace Handbrake.Presets
-{
- class Export
- {
- // WARNING This file is not complete!!!!!!
-
- // TODO
- // 1. Hookup all the widgets in the GUI so it exports real values.
- // 2. Check for any missing key/value pairs
- // 3. Test with MacGui / Cleanup code / Retest
-
- private XmlTextWriter writer;
-
- public void ExportMacPreset(string path)
- {
- writer = new XmlTextWriter("C:\\test.xml", Encoding.UTF8);
-
- // Header
- writer.WriteStartDocument();
- writer.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN", @"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
-
- writer.WriteStartElement("plist");
- writer.WriteStartElement("array");
-
- // Add New Preset Here. Can write multiple presets here if required in future.
- WritePreset();
-
- // Footer
- writer.WriteEndElement();
- writer.WriteEndElement();
-
- writer.WriteEndDocument();
-
- // Closeout
- writer.Close();
- }
-
- // Primary function for writing dict.
- private void WritePreset()
- {
- writer.WriteStartElement("dict");
- AudioListArrayDict();
- AddEncodeSettings();
-
- writer.WriteEndElement();
- }
-
- // Add all the encode settings to the preset
- private void AddEncodeSettings()
- {
- AddEncodeElement("ChapterMarkers", "integer", "");
- AddEncodeElement("Default", "integer", "");
- AddEncodeElement("FileFormat", "String", "");
- AddBooleanElement("Folder", true);
- AddEncodeElement("Mp4HttpOptimize", "integer", "");
- AddEncodeElement("Mp4LargeFile", "integer", "");
- AddEncodeElement("Mp4iPodCompatible", "integer", "");
- AddEncodeElement("PictureAutoCrop", "integer", "");
- AddEncodeElement("PictureBottomCrop", "integer", "");
- AddEncodeElement("PictureDeblock", "integer", "");
- AddEncodeElement("PictureDecomb", "integer", "");
- AddEncodeElement("PictureDecombCustom", "string", "");
- AddEncodeElement("PictureDecombDeinterlace", "integer", "");
- AddEncodeElement("PictureDeinterlace", "integer", "");
- AddEncodeElement("PictureDeinterlaceCustom", "string", "");
- AddEncodeElement("PictureDenoise", "integer", "");
- AddEncodeElement("PictureDenoiseCustom", "string", "");
- AddEncodeElement("PictureDetelecine", "integer", "");
- AddEncodeElement("PictureDetelecineCustom", "string", "");
- AddEncodeElement("PictureHeight", "integer", "");
- AddEncodeElement("PictureKeepRatio", "integer", "");
- AddEncodeElement("PictureLeftCrop", "integer", "");
- AddEncodeElement("PicturePAR", "integer", "");
- AddEncodeElement("PictureRightCrop", "integer", "");
- AddEncodeElement("PictureTopCrop", "integer", "");
- AddEncodeElement("PictureWidth", "integer", "");
- AddEncodeElement("PresetBuildNumber", "string", "");
- AddEncodeElement("PresetDescription", "string", "");
- AddEncodeElement("PresetName", "string", "");
- AddEncodeElement("Type", "integer", "");
- AddEncodeElement("UsesMaxPictureSettings", "integer", "");
- AddEncodeElement("UsesPictureFilters", "integer", "");
- AddEncodeElement("UsesPictureSettings", "integer", "");
- AddEncodeElement("VideoAvgBitrate", "string", "");
- AddEncodeElement("VideoEncoder", "string", "");
- AddEncodeElement("VideoFramerate", "string", "");
- AddEncodeElement("VideoGrayScale", "integer", "");
- AddEncodeElement("VideoQualitySlider", "real", "");
- AddEncodeElement("VideoQualityType", "integer", "");
- AddEncodeElement("VideoTargetSize", "string", "");
- AddEncodeElement("VideoTurboTwoPass", "integer", "");
- AddEncodeElement("VideoTwoPass", "integer", "");
- AddEncodeElement("x264Option", "string", "");
- }
-
- // Add Preset setting + value
- private void AddBooleanElement(string keyName, Boolean value)
- {
- writer.WriteStartElement("key");
- writer.WriteString(keyName);
- writer.WriteEndElement();
- if (value)
- {
- writer.WriteStartElement("true");
- writer.WriteEndElement();
- }
- else
- {
- writer.WriteStartElement("false");
- writer.WriteEndElement();
- }
- }
- private void AddEncodeElement(string keyName, string type, string value)
- {
- writer.WriteElementString("key", keyName);
- writer.WriteElementString(type, value);
- }
-
- // Add List of audio tracks
- private void AudioListArrayDict()
- {
- writer.WriteStartElement("key");
- writer.WriteString("AudioList");
- writer.WriteEndElement();
-
- writer.WriteStartElement("array");
- AddAudioItem();
- AddAudioItem();
- writer.WriteEndElement();
- }
- private void AddAudioItem()
- {
- int bitrate = 448;
- string encoder = "AC3 Passthru";
- string mixdown = "AC3 Passthru";
- string sample = "Auto";
- int track = 1;
- double drc = 0.0;
- string desc = "English (AC3) (5.1 ch)";
-
- writer.WriteStartElement("dict");
-
- writer.WriteElementString("key", "AudioBitrate");
- writer.WriteElementString("string", bitrate.ToString());
-
- writer.WriteElementString("key", "AudioEncoder");
- writer.WriteElementString("string", encoder);
-
- writer.WriteElementString("key", "AudioMixdown");
- writer.WriteElementString("string", mixdown);
-
- writer.WriteElementString("key", "AudioSamplerate");
- writer.WriteElementString("string", sample);
-
- writer.WriteElementString("key", "AudioTrack");
- writer.WriteElementString("integer", track.ToString());
-
- writer.WriteElementString("key", "AudioTrackDRCSlider");
- writer.WriteElementString("real", drc.ToString());
-
- writer.WriteElementString("key", "AudioTrackDescription");
- writer.WriteElementString("string", desc);
-
- writer.WriteEndElement();
- }
- }
-} \ No newline at end of file
diff --git a/win/C#/Presets/Import.cs b/win/C#/Presets/PlistPresetHandler.cs
index 8b39662bc..871ef38a8 100644
--- a/win/C#/Presets/Import.cs
+++ b/win/C#/Presets/PlistPresetHandler.cs
@@ -1,15 +1,38 @@
-using System;
+/* PlistPresetHandler.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+using System;
using System.IO;
+using System.Text;
using System.Xml;
using System.Windows.Forms;
using System.Collections;
using Handbrake.Functions;
+using Handbrake.Model;
namespace Handbrake.Presets
{
- class Import
+ public class PlistPresetHandler
{
- public QueryParser importMacPreset(string filename)
+ /* WARNING This file is not complete!!!!!!
+ *
+ * TODO
+ * 1. Hookup all the widgets in the GUI so it exports real values.
+ * 2. Check for any missing key/value pairs
+ * 3. Test with MacGui / Cleanup code / Retest
+ */
+
+ private XmlTextWriter Writer;
+
+ /// <summary>
+ /// Import a Plist preset generated by the Mac or Linux GUI
+ /// </summary>
+ /// <param name="filename"></param>
+ /// <returns></returns>
+ public static QueryParser Import(string filename)
{
XmlNode root = null;
try
@@ -269,6 +292,182 @@ namespace Handbrake.Presets
return queryParsed;
}
- // --- It's the end of the road
+ /// <summary>
+ /// Export a preset to a Plist file readable by the Mac and Linux GUI's
+ /// </summary>
+ /// <param name="path"></param>
+ public void Export(string path)
+ {
+ Writer = new XmlTextWriter("C:\\test.xml", Encoding.UTF8);
+
+ // Header
+ Writer.WriteStartDocument();
+ Writer.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN", @"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
+
+ Writer.WriteStartElement("plist");
+ Writer.WriteStartElement("array");
+
+ // Add New Preset Here. Can write multiple presets here if required in future.
+ WritePreset();
+
+ // Footer
+ Writer.WriteEndElement();
+ Writer.WriteEndElement();
+
+ Writer.WriteEndDocument();
+
+ // Closeout
+ Writer.Close();
+ }
+
+ /// <summary>
+ /// Write a Plist file
+ /// </summary>
+ private void WritePreset()
+ {
+ Writer.WriteStartElement("dict");
+ AudioListArrayDict();
+ AddEncodeSettings();
+
+ Writer.WriteEndElement();
+ }
+
+ /// <summary>
+ /// Add all the encode settings to the preset
+ /// </summary>
+ private void AddEncodeSettings()
+ {
+ AddEncodeElement("ChapterMarkers", "integer", "");
+ AddEncodeElement("Default", "integer", "");
+ AddEncodeElement("FileFormat", "String", "");
+ AddBooleanElement("Folder", true);
+ AddEncodeElement("Mp4HttpOptimize", "integer", "");
+ AddEncodeElement("Mp4LargeFile", "integer", "");
+ AddEncodeElement("Mp4iPodCompatible", "integer", "");
+ AddEncodeElement("PictureAutoCrop", "integer", "");
+ AddEncodeElement("PictureBottomCrop", "integer", "");
+ AddEncodeElement("PictureDeblock", "integer", "");
+ AddEncodeElement("PictureDecomb", "integer", "");
+ AddEncodeElement("PictureDecombCustom", "string", "");
+ AddEncodeElement("PictureDecombDeinterlace", "integer", "");
+ AddEncodeElement("PictureDeinterlace", "integer", "");
+ AddEncodeElement("PictureDeinterlaceCustom", "string", "");
+ AddEncodeElement("PictureDenoise", "integer", "");
+ AddEncodeElement("PictureDenoiseCustom", "string", "");
+ AddEncodeElement("PictureDetelecine", "integer", "");
+ AddEncodeElement("PictureDetelecineCustom", "string", "");
+ AddEncodeElement("PictureHeight", "integer", "");
+ AddEncodeElement("PictureKeepRatio", "integer", "");
+ AddEncodeElement("PictureLeftCrop", "integer", "");
+ AddEncodeElement("PicturePAR", "integer", "");
+ AddEncodeElement("PictureRightCrop", "integer", "");
+ AddEncodeElement("PictureTopCrop", "integer", "");
+ AddEncodeElement("PictureWidth", "integer", "");
+ AddEncodeElement("PresetBuildNumber", "string", "");
+ AddEncodeElement("PresetDescription", "string", "");
+ AddEncodeElement("PresetName", "string", "");
+ AddEncodeElement("Type", "integer", "");
+ AddEncodeElement("UsesMaxPictureSettings", "integer", "");
+ AddEncodeElement("UsesPictureFilters", "integer", "");
+ AddEncodeElement("UsesPictureSettings", "integer", "");
+ AddEncodeElement("VideoAvgBitrate", "string", "");
+ AddEncodeElement("VideoEncoder", "string", "");
+ AddEncodeElement("VideoFramerate", "string", "");
+ AddEncodeElement("VideoGrayScale", "integer", "");
+ AddEncodeElement("VideoQualitySlider", "real", "");
+ AddEncodeElement("VideoQualityType", "integer", "");
+ AddEncodeElement("VideoTargetSize", "string", "");
+ AddEncodeElement("VideoTurboTwoPass", "integer", "");
+ AddEncodeElement("VideoTwoPass", "integer", "");
+ AddEncodeElement("x264Option", "string", "");
+ }
+
+ /// <summary>
+ /// Add Preset setting + value
+ /// </summary>
+ /// <param name="keyName"></param>
+ /// <param name="value"></param>
+ private void AddBooleanElement(string keyName, Boolean value)
+ {
+ Writer.WriteStartElement("key");
+ Writer.WriteString(keyName);
+ Writer.WriteEndElement();
+ if (value)
+ {
+ Writer.WriteStartElement("true");
+ Writer.WriteEndElement();
+ }
+ else
+ {
+ Writer.WriteStartElement("false");
+ Writer.WriteEndElement();
+ }
+ }
+
+ /// <summary>
+ /// Add Preset setting + value
+ /// </summary>
+ /// <param name="keyName"></param>
+ /// <param name="type"></param>
+ /// <param name="value"></param>
+ private void AddEncodeElement(string keyName, string type, string value)
+ {
+ Writer.WriteElementString("key", keyName);
+ Writer.WriteElementString(type, value);
+ }
+
+ /// <summary>
+ /// Add List of audio tracks
+ /// </summary>
+ private void AudioListArrayDict()
+ {
+ Writer.WriteStartElement("key");
+ Writer.WriteString("AudioList");
+ Writer.WriteEndElement();
+
+ Writer.WriteStartElement("array");
+ AddAudioItem();
+ AddAudioItem();
+ Writer.WriteEndElement();
+ }
+
+ /// <summary>
+ /// Add List of audio tracks
+ /// </summary>
+ private void AddAudioItem()
+ {
+ int bitrate = 448;
+ string encoder = "AC3 Passthru";
+ string mixdown = "AC3 Passthru";
+ string sample = "Auto";
+ int track = 1;
+ double drc = 0.0;
+ string desc = "English (AC3) (5.1 ch)";
+
+ Writer.WriteStartElement("dict");
+
+ Writer.WriteElementString("key", "AudioBitrate");
+ Writer.WriteElementString("string", bitrate.ToString());
+
+ Writer.WriteElementString("key", "AudioEncoder");
+ Writer.WriteElementString("string", encoder);
+
+ Writer.WriteElementString("key", "AudioMixdown");
+ Writer.WriteElementString("string", mixdown);
+
+ Writer.WriteElementString("key", "AudioSamplerate");
+ Writer.WriteElementString("string", sample);
+
+ Writer.WriteElementString("key", "AudioTrack");
+ Writer.WriteElementString("integer", track.ToString());
+
+ Writer.WriteElementString("key", "AudioTrackDRCSlider");
+ Writer.WriteElementString("real", drc.ToString());
+
+ Writer.WriteElementString("key", "AudioTrackDescription");
+ Writer.WriteElementString("string", desc);
+
+ Writer.WriteEndElement();
+ }
}
} \ No newline at end of file
diff --git a/win/C#/Presets/preset.cs b/win/C#/Presets/Preset.cs
index 088d39c85..088d39c85 100644
--- a/win/C#/Presets/preset.cs
+++ b/win/C#/Presets/Preset.cs
diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs
index a26538b73..155086b52 100644
--- a/win/C#/Presets/PresetsHandler.cs
+++ b/win/C#/Presets/PresetsHandler.cs
@@ -16,24 +16,24 @@ namespace Handbrake.Presets
{
public class PresetsHandler
{
- List<Preset> _presets = new List<Preset>();
- List<Preset> _userPresets = new List<Preset>();
+ List<Preset> Presets = new List<Preset>();
+ List<Preset> UserPresets = new List<Preset>();
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Preset>));
- readonly string _userPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\user_presets.xml";
- readonly string _hbPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml";
+ readonly string UserPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\user_presets.xml";
+ readonly string HbPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml";
/// <summary>
/// Add a new preset to the system
/// </summary>
/// <param name="presetName">String, The name of the new preset</param>
/// <param name="query">String, the CLI query for the new preset</param>
- /// <param name="pictureSettings"> Bool, store crop/picture sizes in the _presets</param>
+ /// <param name="pictureSettings"> Bool, store crop/picture sizes in the Presets</param>
public Boolean Add(string presetName, string query, Boolean pictureSettings)
{
if (CheckIfPresetExists(presetName) == false)
{
Preset newPreset = new Preset { Name = presetName, Query = query, PictureSettings = pictureSettings, Version = Properties.Settings.Default.hb_version };
- _userPresets.Add(newPreset);
+ UserPresets.Add(newPreset);
UpdatePresetFiles();
return true;
}
@@ -50,36 +50,36 @@ namespace Handbrake.Presets
List<Preset> newUserPresets = new List<Preset>();
// Built In Presets
- foreach (Preset item in _presets)
+ foreach (Preset item in Presets)
{
if (item.Name != name)
{
newPresets.Add(item);
}
}
- _presets = newPresets;
+ Presets = newPresets;
// User Presets
- foreach (Preset item in _userPresets)
+ foreach (Preset item in UserPresets)
{
if (item.Name != name)
{
newUserPresets.Add(item);
}
}
- _userPresets = newUserPresets;
+ UserPresets = newUserPresets;
- // Rebuild the _userPresets.xml file
+ // Rebuild the UserPresets.xml file
UpdatePresetFiles();
UpdatePresetFiles();
}
/// <summary>
- /// Remove all built in _presets;
+ /// Remove all built in Presets;
/// </summary>
public void RemoveBuiltInPresets()
{
- _presets.Clear();
+ Presets.Clear();
UpdatePresetFiles();
}
@@ -92,7 +92,7 @@ namespace Handbrake.Presets
public void Update(string presetName, string query, Boolean pictureSettings)
{
// User Presets
- foreach (Preset item in _userPresets)
+ foreach (Preset item in UserPresets)
{
if (item.Name == presetName)
{
@@ -112,14 +112,14 @@ namespace Handbrake.Presets
public Preset GetPreset(string name)
{
// Built In Presets
- foreach (Preset item in _presets)
+ foreach (Preset item in Presets)
{
if (item.Name == name)
return item;
}
// User Presets
- foreach (Preset item in _userPresets)
+ foreach (Preset item in UserPresets)
{
if (item.Name == name)
return item;
@@ -133,7 +133,7 @@ namespace Handbrake.Presets
/// </summary>
public void UpdateBuiltInPresets()
{
- // Create a new tempory file and execute the CLI to get the built in _presets.
+ // Create a new tempory file and execute the CLI to get the built in Presets.
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
string presetsPath = Path.Combine(Path.GetTempPath(), "temp_presets.dat");
string strCmdLine = String.Format(@"cmd /c """"{0}"" --preset-list >""{1}"" 2>&1""", handbrakeCLIPath, presetsPath);
@@ -147,8 +147,8 @@ namespace Handbrake.Presets
hbproc.Close();
}
- // Clear the current built in _presets and now parse the tempory _presets file.
- _presets.Clear();
+ // Clear the current built in Presets and now parse the tempory Presets file.
+ Presets.Clear();
if (File.Exists(presetsPath))
{
@@ -179,33 +179,33 @@ namespace Handbrake.Presets
Version = Properties.Settings.Default.hb_version,
PictureSettings = pic
};
- _presets.Add(newPreset);
+ Presets.Add(newPreset);
}
}
presetInput.Close();
presetInput.Dispose();
}
- // Finally, Create a new or update the current _presets.xml file
+ // Finally, Create a new or update the current Presets.xml file
UpdatePresetFiles();
}
/// <summary>
- /// Load in the preset data from _presets.xml and _userPresets.xml
- /// Load it into the 2 arraylist's _presets and _userPresets
+ /// Load in the preset data from Presets.xml and UserPresets.xml
+ /// Load it into the 2 arraylist's Presets and UserPresets
/// </summary>
private void LoadPresetData()
{
- // First clear the _presets arraylists
- _presets.Clear();
- _userPresets.Clear();
+ // First clear the Presets arraylists
+ Presets.Clear();
+ UserPresets.Clear();
try
{
- // Load in the users _presets from _userPresets.xml
- if (File.Exists(_hbPresetFile))
+ // Load in the users Presets from UserPresets.xml
+ if (File.Exists(HbPresetFile))
{
- using (FileStream strm = new FileStream(_hbPresetFile, FileMode.Open, FileAccess.Read))
+ using (FileStream strm = new FileStream(HbPresetFile, FileMode.Open, FileAccess.Read))
{
if (strm.Length != 0)
{
@@ -213,7 +213,7 @@ namespace Handbrake.Presets
if (list != null)
foreach (Preset preset in list)
- _presets.Add(preset);
+ Presets.Add(preset);
}
}
}
@@ -222,16 +222,16 @@ namespace Handbrake.Presets
{
MessageBox.Show(
"HandBrakes preset file appears to have been corrupted. This file will now be re-generated!\n" +
- "If the problem presists, please delete the file: \n\n" + _hbPresetFile, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ "If the problem presists, please delete the file: \n\n" + HbPresetFile, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
UpdateBuiltInPresets();
}
try
{
- // Load in the users _presets from _userPresets.xml
- if (File.Exists(_userPresetFile))
+ // Load in the users Presets from UserPresets.xml
+ if (File.Exists(UserPresetFile))
{
- using (FileStream strm = new FileStream(_userPresetFile, FileMode.Open, FileAccess.Read))
+ using (FileStream strm = new FileStream(UserPresetFile, FileMode.Open, FileAccess.Read))
{
if (strm.Length != 0)
{
@@ -239,7 +239,7 @@ namespace Handbrake.Presets
if (list != null)
foreach (Preset preset in list)
- _userPresets.Add(preset);
+ UserPresets.Add(preset);
}
}
}
@@ -250,16 +250,16 @@ namespace Handbrake.Presets
"Your User presets file appears to have been corrupted.\n" +
"Your presets will not be loaded. You may need to re-create your presets.\n\n" +
"Your user presets file has been renamed to 'user_presets.xml.old' and is located in:\n " +
- Path.GetDirectoryName(_userPresetFile) + "\n" +
+ Path.GetDirectoryName(UserPresetFile) + "\n" +
"You may be able to recover some presets if you know the XML language.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// Recover from Error.
- if (File.Exists(_userPresetFile))
+ if (File.Exists(UserPresetFile))
{
- string disabledFile = _userPresetFile + ".old";
+ string disabledFile = UserPresetFile + ".old";
if (File.Exists(disabledFile))
File.Delete(disabledFile);
- File.Move(_userPresetFile, disabledFile);
+ File.Move(UserPresetFile, disabledFile);
}
}
@@ -276,10 +276,10 @@ namespace Handbrake.Presets
string category = string.Empty;
TreeNode rootNode = null;
- if (_presets.Count != 0) // Built In Presets
+ if (Presets.Count != 0) // Built In Presets
{
- foreach (Preset preset in _presets)
+ foreach (Preset preset in Presets)
{
if (preset.Category != category)
{
@@ -294,7 +294,7 @@ namespace Handbrake.Presets
}
rootNode = null; category = null;
- foreach (Preset preset in _userPresets) // User Presets
+ foreach (Preset preset in UserPresets) // User Presets
{
if (preset.Category != category && preset.Category != null)
{
@@ -317,16 +317,16 @@ namespace Handbrake.Presets
{
try
{
- using (FileStream strm = new FileStream(_hbPresetFile, FileMode.Create, FileAccess.Write))
+ using (FileStream strm = new FileStream(HbPresetFile, FileMode.Create, FileAccess.Write))
{
- Ser.Serialize(strm, _presets);
+ Ser.Serialize(strm, Presets);
strm.Close();
strm.Dispose();
}
- using (FileStream strm = new FileStream(_userPresetFile, FileMode.Create, FileAccess.Write))
+ using (FileStream strm = new FileStream(UserPresetFile, FileMode.Create, FileAccess.Write))
{
- Ser.Serialize(strm, _userPresets);
+ Ser.Serialize(strm, UserPresets);
strm.Close();
strm.Dispose();
}
@@ -338,7 +338,7 @@ namespace Handbrake.Presets
}
/// <summary>
- /// Check if the preset "name" exists in either _presets or _userPresets lists.
+ /// Check if the preset "name" exists in either Presets or UserPresets lists.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
@@ -348,14 +348,14 @@ namespace Handbrake.Presets
return true;
// Built In Presets
- foreach (Preset item in _presets)
+ foreach (Preset item in Presets)
{
if (item.Name == name)
return true;
}
// User Presets
- foreach (Preset item in _userPresets)
+ foreach (Preset item in UserPresets)
{
if (item.Name == name)
return true;
@@ -365,7 +365,7 @@ namespace Handbrake.Presets
}
/// <summary>
- /// Check if the user preset "name" exists in _userPresets list.
+ /// Check if the user preset "name" exists in UserPresets list.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
@@ -375,7 +375,7 @@ namespace Handbrake.Presets
return false;
// User Presets
- foreach (Preset item in _userPresets)
+ foreach (Preset item in UserPresets)
{
if (item.Name == name)
return true;
@@ -385,16 +385,16 @@ namespace Handbrake.Presets
}
/// <summary>
- /// Check if the built in _presets stored are not out of date.
+ /// Check if the built in Presets stored are not out of date.
/// Update them if they are.
/// </summary>
/// <returns></returns>
public Boolean CheckIfPresetsAreOutOfDate()
{
LoadPresetData();
- // 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)
+ // 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();
return true;