summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-05-21 20:12:02 +0000
committersr55 <[email protected]>2011-05-21 20:12:02 +0000
commit73c528c06ec24e5b40f7456e8cd16f8a05f87f92 (patch)
tree50b7c3a0a57eea87427bb2e7d5d5232fb68ac94e /win
parent02881d96d39571587046a513902ac79fd5e45ecf (diff)
WinGui: Add Exported Preset contents to the error dialog for the presets service for debugging.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3992 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs76
1 files changed, 39 insertions, 37 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index c3bfa7fb7..75d9805cc 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -11,6 +11,7 @@ namespace HandBrake.ApplicationServices.Services
using System.Diagnostics;
using System.IO;
using System.Linq;
+ using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Xml.Serialization;
@@ -222,55 +223,56 @@ namespace HandBrake.ApplicationServices.Services
if (File.Exists(presetsPath))
{
- StreamReader presetInput = new StreamReader(presetsPath);
-
- string category = String.Empty;
-
- while (!presetInput.EndOfStream)
+ using (StreamReader presetInput = new StreamReader(presetsPath))
{
- string line = presetInput.ReadLine();
+ StringBuilder contents = new StringBuilder();
- // Found the beginning of a preset block
- if (line != null && line.Contains("<") && !line.Contains("<<"))
- {
- category = line.Replace("<", string.Empty).Trim();
- }
+ string category = String.Empty;
- // Found a preset
- if (line != null && line.Contains("+"))
+ while (!presetInput.EndOfStream)
{
- Regex r = new Regex("(: )"); // Split on hyphens.
- string[] presetName = r.Split(line);
+ string line = presetInput.ReadLine();
+ contents.AppendLine(line);
- bool pic = false;
- if (presetName[2].Contains("crop"))
+ // Found the beginning of a preset block )
+ if (line != null && line.Contains("<") && !line.Contains("<<"))
{
- pic = true;
+ category = line.Replace("<", string.Empty).Trim();
}
- Preset newPreset = new Preset
+ // Found a preset
+ if (line != null && line.Contains("+"))
+ {
+ Regex r = new Regex("(: )"); // Split on hyphens.
+ string[] presetName = r.Split(line);
+
+ bool pic = false;
+ if (presetName[2].Contains("crop"))
{
- Category = category,
- Name = presetName[0].Replace("+", string.Empty).Trim(),
- Query = presetName[2],
- Version = Properties.Settings.Default.HandBrakeVersion,
- CropSettings = pic,
- Description = string.Empty, // Maybe one day we will populate this.
- IsBuildIn = true
- };
-
- this.presets.Add(newPreset);
+ pic = true;
+ }
+
+ Preset newPreset = new Preset
+ {
+ Category = category,
+ Name = presetName[0].Replace("+", string.Empty).Trim(),
+ Query = presetName[2],
+ Version = Properties.Settings.Default.HandBrakeVersion,
+ CropSettings = pic,
+ Description = string.Empty, // Maybe one day we will populate this.
+ IsBuildIn = true
+ };
+
+ this.presets.Add(newPreset);
+ }
}
- }
- // Verify we have presets.
- if (this.presets.Count == 0)
- {
- throw new GeneralApplicationException("Failed to load built-in presets.", "Restarting HandBrake may resolve this issue", null);
+ // Verify we have presets.
+ if (this.presets.Count == 0)
+ {
+ throw new GeneralApplicationException("Failed to load built-in presets.", "Restarting HandBrake may resolve this issue", new Exception(contents.ToString()));
+ }
}
-
- presetInput.Close();
- presetInput.Dispose();
}
else
{