diff options
4 files changed, 9 insertions, 136 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 705911f4a..4fc9b2fad 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -104,7 +104,6 @@ <Compile Include="Utilities\EnumHelper.cs" />
<Compile Include="Utilities\GrowlCommunicator.cs" />
<Compile Include="Utilities\InteropModelCreator.cs" />
- <Compile Include="Utilities\PlistHelper.cs" />
<Compile Include="Utilities\SystemInfo.cs" />
<Compile Include="Utilities\Win32.cs" />
<Compile Include="Utilities\Win7.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 454627fa9..a77b84306 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -266,7 +266,7 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>
public override string ToString()
{
- if (!string.IsNullOrEmpty(this.Playlist))
+ if (!string.IsNullOrEmpty(this.Playlist) && !this.Playlist.StartsWith(" "))
{
this.Playlist = string.Format(" {0}", this.Playlist);
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistHelper.cs deleted file mode 100644 index f5e810771..000000000 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistHelper.cs +++ /dev/null @@ -1,130 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="PlistHelper.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// A Plist Helper
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Utilities
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Xml;
-
- /// <summary>
- /// A Plist Helper
- /// </summary>
- public class PlistHelper
- {
- /// <summary>
- /// Get the Audio Track XML Nodes from a plist preset file
- /// </summary>
- /// <param name="filename">
- /// A Plist preset file
- /// </param>
- /// <returns>
- /// A List of XmlNodes which contain audio tracks
- /// </returns>
- public static List<XmlNode> GetAudioTracks(string filename)
- {
- // Data Store
- List<XmlNode> audioTracks = new List<XmlNode>();
-
- // Load the file and get the Root note, or return if none found
- XmlNode root = LoadFile(filename);
- if (root == null)
- {
- return null;
- }
-
- // Get the Audio Tracks
- XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[1];
- for (int i = 0; i < audioListDict.ChildNodes.Count; i++)
- {
- XmlNode audioChannel = audioListDict.ChildNodes[i]; // <dict>
- audioTracks.Add(audioChannel);
- }
-
- return audioTracks;
- }
-
- /// <summary>
- /// Get the settings portion of a presets file
- /// </summary>
- /// <param name="filename">
- /// A Plist preset file
- /// </param>
- /// <returns>
- /// A Dictionary of plist key against an XML node containing the setting.
- /// </returns>
- public static Dictionary<string, XmlNode> GetPresetSettings(string filename)
- {
- // Data Store
- Dictionary<string, XmlNode> settings = new Dictionary<string, XmlNode>();
-
- // Load the file and get the Root note, or return if none found
- XmlNode root = LoadFile(filename);
- if (root == null)
- {
- return null;
- }
-
- // Get the Preset Settings, starting from the 3rd node (skipping the audio notes we've just prcessed)
- XmlNode presetSettings = root.ChildNodes[2].ChildNodes[0].FirstChild;
- for (int i = 2; i < presetSettings.ChildNodes.Count; i += 2)
- {
- string key = presetSettings.ChildNodes[i].InnerText;
- XmlNode node = presetSettings.ChildNodes[i + 1];
- settings.Add(key, node);
- }
-
- return settings;
- }
-
- /// <summary>
- /// Load a Plist Preset file and return it as an XML document
- /// </summary>
- /// <param name="filename">
- /// A Plist preset file
- /// </param>
- /// <returns>
- /// An XML document
- /// </returns>
- private static XmlNode LoadFile(string filename)
- {
- try
- {
- if (!File.Exists(filename))
- {
- return null;
- }
-
- StreamReader sr = File.OpenText(filename);
- string fromfile = string.Empty;
- int fileChar;
- while ((fileChar = sr.Read()) != -1)
- {
- fromfile += Convert.ToChar(fileChar);
- }
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(fromfile);
-
- XmlNode root = doc;
- if (!root.HasChildNodes)
- {
- return null;
- }
-
- return root;
- }
- catch (Exception)
- {
- return null;
- }
- }
- }
-}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index c1df4b8be..30f884779 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -634,11 +634,11 @@ namespace HandBrakeWPF.ViewModels }
set
{
- if (!Equals(this.selectedTitle, value))
+ if (!object.Equals(this.selectedTitle, value))
{
this.selectedTitle = value;
- if (selectedTitle == null)
+ if (this.selectedTitle == null)
{
return;
}
@@ -652,7 +652,11 @@ namespace HandBrakeWPF.ViewModels // Default the Start and End Point dropdowns
this.SelectedStartPoint = 1;
- this.SelectedEndPoint = selectedTitle.Chapters.Last().ChapterNumber;
+ this.SelectedEndPoint = this.selectedTitle.Chapters != null &&
+ this.selectedTitle.Chapters.Count != 0
+ ? this.selectedTitle.Chapters.Last().ChapterNumber
+ : 1;
+
this.SelectedPointToPoint = PointToPointMode.Chapters;
this.SelectedAngle = 1;
@@ -662,7 +666,7 @@ namespace HandBrakeWPF.ViewModels }
this.NotifyOfPropertyChange(() => this.CurrentTask);
- this.Duration = selectedTitle.Duration.ToString();
+ this.Duration = this.selectedTitle.Duration.ToString();
// Setup the tab controls
this.SetupTabs();
|