diff options
author | Scott <[email protected]> | 2015-09-26 21:09:05 +0100 |
---|---|---|
committer | Scott <[email protected]> | 2015-09-26 21:30:32 +0100 |
commit | c4008d7a492fa08449de6e19414a1acf101e53f5 (patch) | |
tree | 0ee2c53bd8961590f8714b79a5a49e671d4af767 | |
parent | 1320d77d36f096c7aa5b1697d3aaf9aa35d5e199 (diff) |
App Services Cleanup Contd
Moving Exceptions and more utilities to the GUI project.
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/App.xaml.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Exceptions/GeneralApplicationException.cs (renamed from win/CS/HandBrake.ApplicationServices/Exceptions/GeneralApplicationException.cs) | 106 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Presets/PresetService.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/UserSettingService.cs | 3 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs (renamed from win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs) | 308 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs | 3 |
12 files changed, 224 insertions, 221 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 334414f1f..89562540f 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -80,7 +80,6 @@ <Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Exceptions\GeneralApplicationException.cs" />
<Compile Include="Attributes\ShortName.cs" />
<Compile Include="Interop\EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="Interop\EventArgs\EncodeProgressEventArgs.cs" />
@@ -191,7 +190,6 @@ <DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Utilities\CharCodesUtilities.cs" />
- <Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs index 7899f4520..eea8feb02 100644 --- a/win/CS/HandBrakeWPF/App.xaml.cs +++ b/win/CS/HandBrakeWPF/App.xaml.cs @@ -16,12 +16,12 @@ namespace HandBrakeWPF using Caliburn.Micro;
- using HandBrake.ApplicationServices.Exceptions;
-
using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels;
using HandBrakeWPF.ViewModels.Interfaces;
+ using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
+
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Exceptions/GeneralApplicationException.cs b/win/CS/HandBrakeWPF/Exceptions/GeneralApplicationException.cs index 59c952a90..10c5192af 100644 --- a/win/CS/HandBrake.ApplicationServices/Exceptions/GeneralApplicationException.cs +++ b/win/CS/HandBrakeWPF/Exceptions/GeneralApplicationException.cs @@ -1,53 +1,53 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="GeneralApplicationException.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>
-// The Encode Failure Exception
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Exceptions
-{
- using System;
-
- /// <summary>
- /// The Encode Failure Exception
- /// </summary>
- public class GeneralApplicationException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="GeneralApplicationException"/> class.
- /// </summary>
- /// <param name="error">
- /// The error.
- /// </param>
- /// <param name="solution">
- /// The solution.
- /// </param>
- /// <param name="innerException">
- /// The inner Exception.
- /// </param>
- public GeneralApplicationException(string error, string solution, Exception innerException)
- {
- this.Error = error;
- this.Solution = solution;
- this.ActualException = innerException;
- }
-
- /// <summary>
- /// Gets or sets FailureReason.
- /// </summary>
- public string Error { get; set; }
-
- /// <summary>
- /// Gets or sets Solution.
- /// </summary>
- public string Solution { get; set; }
-
- /// <summary>
- /// Gets or sets InnerException.
- /// </summary>
- public Exception ActualException { get; set; }
- }
-}
+// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="GeneralApplicationException.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> +// The Encode Failure Exception +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Exceptions +{ + using System; + + /// <summary> + /// The Encode Failure Exception + /// </summary> + public class GeneralApplicationException : Exception + { + /// <summary> + /// Initializes a new instance of the <see cref="GeneralApplicationException"/> class. + /// </summary> + /// <param name="error"> + /// The error. + /// </param> + /// <param name="solution"> + /// The solution. + /// </param> + /// <param name="innerException"> + /// The inner Exception. + /// </param> + public GeneralApplicationException(string error, string solution, Exception innerException) + { + this.Error = error; + this.Solution = solution; + this.ActualException = innerException; + } + + /// <summary> + /// Gets or sets FailureReason. + /// </summary> + public string Error { get; set; } + + /// <summary> + /// Gets or sets Solution. + /// </summary> + public string Solution { get; set; } + + /// <summary> + /// Gets or sets InnerException. + /// </summary> + public Exception ActualException { get; set; } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index d47736b6c..808b3d015 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -153,6 +153,7 @@ <Compile Include="EventArgs\QueueCompletedEventArgs.cs" />
<Compile Include="EventArgs\QueueProgressEventArgs.cs" />
<Compile Include="EventArgs\SettingChangedEventArgs.cs" />
+ <Compile Include="Exceptions\GeneralApplicationException.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Model\Audio\AudioTrackDefaultsMode.cs" />
<Compile Include="Model\Audio\AudioBehaviourModes.cs" />
@@ -230,6 +231,7 @@ <Compile Include="Utilities\EnumHelper.cs" />
<Compile Include="Utilities\Execute.cs" />
<Compile Include="Utilities\ExtensionMethods.cs" />
+ <Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\HandBrakeApp.cs" />
<Compile Include="Utilities\Interfaces\INotifyPropertyChangedEx.cs" />
<Compile Include="Utilities\PropertyChangedBase.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs index c73ad2605..195e66200 100644 --- a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs @@ -23,6 +23,7 @@ namespace HandBrakeWPF.Helpers using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Queue.Model;
+ using HandBrakeWPF.Utilities;
using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
diff --git a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs index 83ac7a083..4179ed3c7 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs @@ -14,15 +14,16 @@ namespace HandBrakeWPF.Services.Encode using System.IO; using System.Text; - using HandBrake.ApplicationServices.Exceptions; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Utilities; + + using HandBrakeWPF.Utilities; using EncodeCompletedEventArgs = HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs; using EncodeCompletedStatus = HandBrakeWPF.Services.Encode.Interfaces.EncodeCompletedStatus; using EncodeProgessStatus = HandBrakeWPF.Services.Encode.Interfaces.EncodeProgessStatus; using EncodeProgressEventArgs = HandBrakeWPF.Services.Encode.EventArgs.EncodeProgressEventArgs; using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask; + using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException; /// <summary> /// A Base Class for the Encode Services. diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index ce666f8aa..38299e5b1 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -18,7 +18,6 @@ namespace HandBrakeWPF.Services.Presets using System.Windows;
using System.Xml.Serialization;
- using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Model;
@@ -31,9 +30,12 @@ namespace HandBrakeWPF.Services.Presets using HandBrakeWPF.Services.Presets.Factories;
using HandBrakeWPF.Services.Presets.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
+ using HandBrakeWPF.Utilities;
using Newtonsoft.Json;
+ using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
+
/// <summary>
/// The preset service manages HandBrake's presets
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs index 4056633bb..94d9775d4 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs @@ -16,14 +16,12 @@ namespace HandBrakeWPF.Services.Queue using System.Linq;
using System.Xml.Serialization;
- using HandBrake.ApplicationServices.Exceptions;
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Utilities;
-
using HandBrakeWPF.Services.Queue.Model;
+ using HandBrakeWPF.Utilities;
using EncodeCompletedEventArgs = HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs;
using Execute = Caliburn.Micro.Execute;
+ using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
using IEncode = HandBrakeWPF.Services.Encode.Interfaces.IEncode;
using QueueCompletedEventArgs = HandBrakeWPF.EventArgs.QueueCompletedEventArgs;
using QueueProgressEventArgs = HandBrakeWPF.EventArgs.QueueProgressEventArgs;
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index 2aae331d6..b43ec3ce3 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -31,6 +31,7 @@ namespace HandBrakeWPF.Services.Scan using HandBrakeWPF.Services.Scan.EventArgs; using HandBrakeWPF.Services.Scan.Interfaces; using HandBrakeWPF.Services.Scan.Model; + using HandBrakeWPF.Utilities; using Chapter = HandBrakeWPF.Services.Scan.Model.Chapter; using ScanProgressEventArgs = HandBrake.ApplicationServices.Interop.EventArgs.ScanProgressEventArgs; diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs index 6c5c6629b..8f0093009 100644 --- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs @@ -16,10 +16,9 @@ namespace HandBrakeWPF.Services using System.Reflection;
using System.Xml.Serialization;
- using HandBrake.ApplicationServices.Exceptions;
-
using HandBrakeWPF.Services.Interfaces;
+ using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs index f92332c61..18583acd8 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs @@ -1,154 +1,156 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="GeneralUtilities.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 Set of Static Utilites
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Utilities
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
-
- /// <summary>
- /// A Set of Static Utilites
- /// </summary>
- public class GeneralUtilities
- {
- #region Constants and Fields
-
- /// <summary>
- /// The Default Log Directory
- /// </summary>
- private static readonly string LogDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets the number of HandBrake instances running.
- /// </summary>
- public static int ProcessId
- {
- get
- {
- return Process.GetCurrentProcess().Id;
- }
- }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// Clear all the log files older than 30 Days
- /// </summary>
- /// <param name="daysToKeep">
- /// The Number of Days to Keep
- /// </param>
- public static void ClearLogFiles(int daysToKeep)
- {
- if (Directory.Exists(LogDir))
- {
- // Get all the log files
- var info = new DirectoryInfo(LogDir);
- FileInfo[] logFiles = info.GetFiles("*.txt");
-
- // Delete old and excessivly large files (> ~50MB).
- foreach (FileInfo file in logFiles)
- {
- try
- {
- if (file.LastWriteTime < DateTime.Now.AddDays(-daysToKeep))
- {
- File.Delete(file.FullName);
- }
- else if (file.Length > 50000000)
- {
- File.Delete(file.FullName);
- }
- }
- catch (Exception)
- {
- // Silently ignore files we can't delete. They are probably being used by the app right now.
- }
- }
- }
- }
-
- /// <summary>
- /// Generate the header for the log file.
- /// </summary>
- /// <returns>
- /// The generatedlog header.
- /// </returns>
- public static StringBuilder CreateLogHeader()
- {
- var logHeader = new StringBuilder();
-
- StringBuilder gpuBuilder = new StringBuilder();
- foreach (var item in SystemInfo.GetGPUInfo)
- {
- gpuBuilder.AppendLine(string.Format(" {0}", item));
- }
-
- if (string.IsNullOrEmpty(gpuBuilder.ToString().Trim()))
- {
- gpuBuilder.Append("GPU Information is unavailable");
- }
-
- logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion()));
- logHeader.AppendLine(String.Format("OS: {0} - {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "64bit" : "32bit"));
- logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
- logHeader.AppendLine(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
- logHeader.AppendLine(String.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd()));
- logHeader.AppendLine(String.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
- logHeader.AppendLine(String.Format("Temp Dir: {0}", Path.GetTempPath()));
- logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath));
- logHeader.AppendLine(String.Format("Data Dir: {0}\n", Application.UserAppDataPath));
-
- logHeader.AppendLine("-------------------------------------------");
-
- return logHeader;
- }
-
- /// <summary>
- /// Return the standard log format line of text for a given log message
- /// </summary>
- /// <param name="message">
- /// The Log Message
- /// </param>
- /// <returns>
- /// A Log Message in the format: "[hh:mm:ss] message"
- /// </returns>
- public static string LogLine(string message)
- {
- return string.Format("[{0}] {1}", DateTime.Now.TimeOfDay, message);
- }
-
- /// <summary>
- /// The find hand brake instance ids.
- /// </summary>
- /// <param name="id">
- /// The id.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>. True if it's a running HandBrake instance.
- /// </returns>
- public static bool IsPidACurrentHandBrakeInstance(int id)
- {
- List<int> ids = Process.GetProcessesByName("HandBrake").Select(process => process.Id).ToList();
- return ids.Contains(id);
- }
-
- #endregion
- }
+// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="GeneralUtilities.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 Set of Static Utilites +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Utilities +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.Linq; + using System.Text; + using System.Windows.Forms; + + using HandBrake.ApplicationServices.Utilities; + + /// <summary> + /// A Set of Static Utilites + /// </summary> + public class GeneralUtilities + { + #region Constants and Fields + + /// <summary> + /// The Default Log Directory + /// </summary> + private static readonly string LogDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; + + #endregion + + #region Properties + + /// <summary> + /// Gets the number of HandBrake instances running. + /// </summary> + public static int ProcessId + { + get + { + return Process.GetCurrentProcess().Id; + } + } + + #endregion + + #region Public Methods + + /// <summary> + /// Clear all the log files older than 30 Days + /// </summary> + /// <param name="daysToKeep"> + /// The Number of Days to Keep + /// </param> + public static void ClearLogFiles(int daysToKeep) + { + if (Directory.Exists(LogDir)) + { + // Get all the log files + var info = new DirectoryInfo(LogDir); + FileInfo[] logFiles = info.GetFiles("*.txt"); + + // Delete old and excessivly large files (> ~50MB). + foreach (FileInfo file in logFiles) + { + try + { + if (file.LastWriteTime < DateTime.Now.AddDays(-daysToKeep)) + { + File.Delete(file.FullName); + } + else if (file.Length > 50000000) + { + File.Delete(file.FullName); + } + } + catch (Exception) + { + // Silently ignore files we can't delete. They are probably being used by the app right now. + } + } + } + } + + /// <summary> + /// Generate the header for the log file. + /// </summary> + /// <returns> + /// The generatedlog header. + /// </returns> + public static StringBuilder CreateLogHeader() + { + var logHeader = new StringBuilder(); + + StringBuilder gpuBuilder = new StringBuilder(); + foreach (var item in SystemInfo.GetGPUInfo) + { + gpuBuilder.AppendLine(string.Format(" {0}", item)); + } + + if (string.IsNullOrEmpty(gpuBuilder.ToString().Trim())) + { + gpuBuilder.Append("GPU Information is unavailable"); + } + + logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion())); + logHeader.AppendLine(String.Format("OS: {0} - {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "64bit" : "32bit")); + logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount)); + logHeader.AppendLine(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory)); + logHeader.AppendLine(String.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd())); + logHeader.AppendLine(String.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height)); + logHeader.AppendLine(String.Format("Temp Dir: {0}", Path.GetTempPath())); + logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath)); + logHeader.AppendLine(String.Format("Data Dir: {0}\n", Application.UserAppDataPath)); + + logHeader.AppendLine("-------------------------------------------"); + + return logHeader; + } + + /// <summary> + /// Return the standard log format line of text for a given log message + /// </summary> + /// <param name="message"> + /// The Log Message + /// </param> + /// <returns> + /// A Log Message in the format: "[hh:mm:ss] message" + /// </returns> + public static string LogLine(string message) + { + return string.Format("[{0}] {1}", DateTime.Now.TimeOfDay, message); + } + + /// <summary> + /// The find hand brake instance ids. + /// </summary> + /// <param name="id"> + /// The id. + /// </param> + /// <returns> + /// The <see cref="bool"/>. True if it's a running HandBrake instance. + /// </returns> + public static bool IsPidACurrentHandBrakeInstance(int id) + { + List<int> ids = Process.GetProcessesByName("HandBrake").Select(process => process.Id).ToList(); + return ids.Contains(id); + } + + #endregion + } }
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index 7971357fd..a76d24547 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -16,8 +16,6 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
- using HandBrake.ApplicationServices.Exceptions;
-
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
@@ -30,6 +28,7 @@ namespace HandBrakeWPF.ViewModels using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
+ using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
/// <summary>
/// The Chapters View Model
|