summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-09-25 15:23:17 +0000
committersr55 <[email protected]>2012-09-25 15:23:17 +0000
commit83af0dca6f4ecc16d5a4dcc6b6ccd97b707f7156 (patch)
tree5deeb98145f9fccd54ccf05007a06702e9197271 /win/CS/HandBrakeWPF
parentc9c4474cc265ea02f25fc5e94b161705402ab807 (diff)
WinGui: LibHb Encode and Scan support (off by default for the moment until I have time to test this and tidy up some of the code) Can be turned on in preferences.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4980 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj10
-rw-r--r--win/CS/HandBrakeWPF/Isolation/BackgroundServiceConnector.cs289
-rw-r--r--win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedEncodeService.cs24
-rw-r--r--win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedScanService.cs24
-rw-r--r--win/CS/HandBrakeWPF/Isolation/IsolatedEncodeService.cs192
-rw-r--r--win/CS/HandBrakeWPF/Isolation/IsolatedScanService.cs223
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs257
-rw-r--r--win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs243
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs5
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs54
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs23
-rw-r--r--win/CS/HandBrakeWPF/Views/Images/warningsmall.pngbin0 -> 618 bytes
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml3
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml8
15 files changed, 552 insertions, 808 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index dcaf10f3d..bae0eff7a 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -55,7 +55,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x64\Debug\</OutputPath>
+ <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@@ -128,18 +128,15 @@
<Compile Include="Converters\Options\OptionsTabConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitlesQueueDisplayConverter.cs" />
<Compile Include="Converters\Video\VideoEncoderConverter.cs" />
- <Compile Include="Isolation\BackgroundServiceConnector.cs" />
- <Compile Include="Isolation\IsolatedEncodeService.cs" />
- <Compile Include="Isolation\Interfaces\IIsolatedEncodeService.cs" />
- <Compile Include="Isolation\Interfaces\IIsolatedScanService.cs" />
- <Compile Include="Isolation\IsolatedScanService.cs" />
<Compile Include="Services\DriveDetectService.cs" />
+ <Compile Include="Services\EncodeServiceWrapper.cs" />
<Compile Include="Services\Interfaces\IDriveDetectService.cs" />
<Compile Include="Model\ShellWindow.cs" />
<Compile Include="Model\SourceMenuItem.cs" />
<Compile Include="Model\UpdateCheckInformation.cs" />
<Compile Include="Model\DownloadStatus.cs" />
<Compile Include="Services\Interfaces\IUpdateService.cs" />
+ <Compile Include="Services\ScanServiceWrapper.cs" />
<Compile Include="Services\UpdateService.cs" />
<Compile Include="Views\ShellView.xaml.cs">
<DependentUpon>ShellView.xaml</DependentUpon>
@@ -368,6 +365,7 @@
<Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Resource Include="Views\Images\warningsmall.png" />
<Resource Include="Views\Images\Refresh.ico" />
<Resource Include="Views\Images\Complete.png" />
<Resource Include="Views\Images\Working0.png" />
diff --git a/win/CS/HandBrakeWPF/Isolation/BackgroundServiceConnector.cs b/win/CS/HandBrakeWPF/Isolation/BackgroundServiceConnector.cs
deleted file mode 100644
index 13bf132ee..000000000
--- a/win/CS/HandBrakeWPF/Isolation/BackgroundServiceConnector.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="BackgroundServiceConnector.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>
-// Background Service Connector.
-// HandBrake has the ability to connect to a service app that will control HandBrakeCLI or Libhb.
-// This acts as process isolation.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Isolation
-{
- using System;
- using System.Diagnostics;
- using System.ServiceModel;
- using System.Threading;
-
- using HandBrake.ApplicationServices.EventArgs;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- using HandBrakeWPF.Services.Interfaces;
-
- /// <summary>
- /// Background Service Connector.
- /// HandBrake has the ability to connect to a service app that will control HandBrakeCLI or Libhb.
- /// This acts as process isolation.
- /// </summary>
- public class BackgroundServiceConnector : IHbServiceCallback, IDisposable
- {
- #region Constants and Fields
-
- /// <summary>
- /// The error service.
- /// </summary>
- private readonly IErrorService errorService;
-
- /// <summary>
- /// The user setting service.
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// Gets or sets the pipe factory.
- /// DuplexChannelFactory is necessary for Callbacks.
- /// </summary>
- private static DuplexChannelFactory<IServerService> pipeFactory;
-
- /// <summary>
- /// The background process.
- /// </summary>
- private static Process backgroundProcess;
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BackgroundServiceConnector"/> class.
- /// </summary>
- /// <param name="errorService">
- /// The error service.
- /// </param>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public BackgroundServiceConnector(IErrorService errorService, IUserSettingService userSettingService)
- {
- this.errorService = errorService;
- this.userSettingService = userSettingService;
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether is connected.
- /// </summary>
- public bool IsConnected { get; set; }
-
- /// <summary>
- /// Gets or sets the service.
- /// </summary>
- public IServerService Service { get; set; }
-
- #endregion
-
- #region Public Server Management Methods
-
- /// <summary>
- /// The can connect.
- /// </summary>
- /// <returns>
- /// The System.Boolean.
- /// </returns>
- public bool CanConnect()
- {
- return true;
- }
-
- /// <summary>
- /// The connect.
- /// </summary>
- public void Connect()
- {
- string port = this.userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);
-
- if (backgroundProcess == null)
- {
- ProcessStartInfo processStartInfo = new ProcessStartInfo(
- "HandBrake.Server.exe", port)
- {
- UseShellExecute = false,
- CreateNoWindow = true,
- RedirectStandardOutput = true,
- };
-
- backgroundProcess = new Process { StartInfo = processStartInfo };
- backgroundProcess.Start();
- }
-
- // When the process writes out a line, it's pipe server is ready and can be contacted for
- // work. Reading line blocks until this happens.
- backgroundProcess.StandardOutput.ReadLine();
-
- ThreadPool.QueueUserWorkItem(delegate
- {
- try
- {
- pipeFactory = new DuplexChannelFactory<IServerService>(
- new InstanceContext(this),
- new NetTcpBinding(),
- new EndpointAddress(string.Format("net.tcp://127.0.0.1:{0}/IHbService", port)));
-
- // Connect and Subscribe to the Server
- Service = pipeFactory.CreateChannel();
- Service.Subscribe();
- IsConnected = true;
- }
- catch (Exception exc)
- {
- Caliburn.Micro.Execute.OnUIThread(() => this.errorService.ShowError("Unable to connect to background worker service", "Please restart HandBrake", exc));
- }
- });
- }
-
- /// <summary>
- /// The disconnect.
- /// </summary>
- public void Disconnect()
- {
- try
- {
- if (backgroundProcess != null && !backgroundProcess.HasExited)
- {
- Service.Unsubscribe();
- }
- }
- catch (Exception exc)
- {
- this.errorService.ShowError("Unable to disconnect from service", "It may have already close. Check for any left over HandBrake.Server.exe processes", exc);
- }
- }
-
- #endregion
-
- #region Public Service Methods
-
- ///// <summary>
- ///// The scan source.
- ///// </summary>
- ///// <param name="path">
- ///// The path.
- ///// </param>
- ///// <param name="title">
- ///// The title.
- ///// </param>
- ///// <param name="previewCount">
- ///// The preview count.
- ///// </param>
- //public void ScanSource(string path, int title, int previewCount)
- //{
- // ThreadPool.QueueUserWorkItem(delegate { this.Service.ScanSource(path, title, previewCount); });
- //}
-
- ///// <summary>
- ///// The stop scan.
- ///// </summary>
- //public void StopScan()
- //{
- // ThreadPool.QueueUserWorkItem(delegate { this.Service.StopScan(); });
- //}
-
- ///// <summary>
- ///// Start an Encode
- ///// </summary>
- ///// <param name="job">
- ///// The job.
- ///// </param>
- ///// <param name="enableLogging">
- ///// The enable logging.
- ///// </param>
- //public void StartEncode(QueueTask job, bool enableLogging)
- //{
- // ThreadPool.QueueUserWorkItem(delegate { this.Service.StartEncode(job, enableLogging); });
- //}
-
- ///// <summary>
- ///// Stop an Encode
- ///// </summary>
- //public void StopEncode()
- //{
- // ThreadPool.QueueUserWorkItem(delegate { this.Service.StopEncode(); });
- //}
-
- #endregion
-
- #region Implemented Interfaces
-
- #region IDisposable
-
- /// <summary>
- /// The dispose.
- /// </summary>
- public void Dispose()
- {
- Service.Unsubscribe();
- }
-
- #endregion
-
- #region IHbServiceCallback
-
- /// <summary>
- /// The scan completed.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public virtual void ScanCompletedCallback(ScanCompletedEventArgs eventArgs)
- {
- }
-
- /// <summary>
- /// The scan progress.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public virtual void ScanProgressCallback(ScanProgressEventArgs eventArgs)
- {
- }
-
- /// <summary>
- /// The scan started callback.
- /// </summary>
- public virtual void ScanStartedCallback()
- {
- }
-
- /// <summary>
- /// The encode progress callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event Args.
- /// </param>
- public virtual void EncodeProgressCallback(EncodeProgressEventArgs eventArgs)
- {
- }
-
- /// <summary>
- /// The encode completed callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event Args.
- /// </param>
- public virtual void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs)
- {
- }
-
- /// <summary>
- /// The encode started callback.
- /// </summary>
- public virtual void EncodeStartedCallback()
- {
- }
-
- #endregion
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedEncodeService.cs b/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedEncodeService.cs
deleted file mode 100644
index fb9912ccf..000000000
--- a/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedEncodeService.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IIsolatedEncodeService.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 Isolated Encode Service interface.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Isolation.Interfaces
-{
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- /// <summary>
- /// The Isolated Encode Service interface.
- /// </summary>
- public interface IIsolatedEncodeService : IEncode
- {
- /// <summary>
- /// The disconnect.
- /// </summary>
- void Disconnect();
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedScanService.cs b/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedScanService.cs
deleted file mode 100644
index 7b94deb58..000000000
--- a/win/CS/HandBrakeWPF/Isolation/Interfaces/IIsolatedScanService.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IIsolatedScanService.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 Isolated Scan Service interface.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Isolation.Interfaces
-{
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- /// <summary>
- /// The Isolated Scan Service interface.
- /// </summary>
- public interface IIsolatedScanService : IScan
- {
- /// <summary>
- /// The disconnect.
- /// </summary>
- void Disconnect();
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrakeWPF/Isolation/IsolatedEncodeService.cs
deleted file mode 100644
index 322d30f9f..000000000
--- a/win/CS/HandBrakeWPF/Isolation/IsolatedEncodeService.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IsolatedEncodeService.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>
-// Isolated Scan Service
-// This is an implementation of the IEncode implementation that runs scans on a seperate process
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Isolation
-{
- using System;
- using System.Threading;
-
- using HandBrake.ApplicationServices.EventArgs;
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- using HandBrakeWPF.Isolation.Interfaces;
- using HandBrakeWPF.Services.Interfaces;
-
- /// <summary>
- /// Isolated Scan Service.
- /// This is an implementation of the IEncode implementation that runs scans on a seperate process
- /// </summary>
- public class IsolatedEncodeService : BackgroundServiceConnector, IIsolatedEncodeService
- {
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IsolatedEncodeService"/> class.
- /// </summary>
- /// <param name="errorService">
- /// The error Service.
- /// </param>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public IsolatedEncodeService(IErrorService errorService, IUserSettingService userSettingService)
- : base(errorService, userSettingService)
- {
- try
- {
- if (this.CanConnect())
- {
- this.Connect();
- }
- }
- catch (Exception exception)
- {
- errorService.ShowError(
- "Unable to connect to scan worker process.", "Try restarting HandBrake", exception);
- }
- }
-
- #endregion
-
- #region Events
-
- /// <summary>
- /// The encode completed.
- /// </summary>
- public event EncodeCompletedStatus EncodeCompleted;
-
- /// <summary>
- /// The encode started.
- /// </summary>
- public event EventHandler EncodeStarted;
-
- /// <summary>
- /// The encode status changed.
- /// </summary>
- public event EncodeProgessStatus EncodeStatusChanged;
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets ActivityLog.
- /// </summary>
- public string ActivityLog
- {
- get
- {
- return this.IsConnected ? this.Service.EncodeActivityLog : "Unable to connect to background worker service ...";
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether IsEncoding.
- /// </summary>
- public bool IsEncoding
- {
- get
- {
- return this.IsConnected && this.Service.IsEncoding;
- }
- }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// The encode completed callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public override void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs)
- {
- if (this.EncodeCompleted != null)
- {
- ThreadPool.QueueUserWorkItem(delegate { this.EncodeCompleted(this, eventArgs); });
- }
-
- base.EncodeCompletedCallback(eventArgs);
- }
-
- /// <summary>
- /// The encode progress callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public override void EncodeProgressCallback(EncodeProgressEventArgs eventArgs)
- {
- if (this.EncodeStatusChanged != null)
- {
- ThreadPool.QueueUserWorkItem(delegate { this.EncodeStatusChanged(this, eventArgs); });
- }
-
- base.EncodeProgressCallback(eventArgs);
- }
-
- #endregion
-
- #region Implemented Interfaces
-
- #region IEncode
-
- /// <summary>
- /// Copy the log file to the desired destinations
- /// </summary>
- /// <param name="destination">
- /// The destination.
- /// </param>
- public void ProcessLogs(string destination)
- {
- ThreadPool.QueueUserWorkItem(delegate { Service.ProcessEncodeLogs(destination); });
- }
-
- /// <summary>
- /// Attempt to Safely kill a DirectRun() CLI
- /// NOTE: This will not work with a MinGW CLI
- /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
- /// </summary>
- public void SafelyStop()
- {
- ThreadPool.QueueUserWorkItem(delegate { Service.StopEncode(); });
- }
-
- /// <summary>
- /// Start with a LibHb EncodeJob Object
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- /// <param name="enableLogging">
- /// The enable Logging.
- /// </param>
- public void Start(QueueTask job, bool enableLogging)
- {
- ThreadPool.QueueUserWorkItem(
- delegate { Service.StartEncode(job, enableLogging); });
- }
-
- /// <summary>
- /// Kill the CLI process
- /// </summary>
- public void Stop()
- {
- ThreadPool.QueueUserWorkItem(delegate { Service.StopEncode(); });
- }
-
- #endregion
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Isolation/IsolatedScanService.cs b/win/CS/HandBrakeWPF/Isolation/IsolatedScanService.cs
deleted file mode 100644
index b50f1b3ea..000000000
--- a/win/CS/HandBrakeWPF/Isolation/IsolatedScanService.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IsolatedScanService.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>
-// Isolated Scan Service
-// This is an implementation of the IScan implementation that runs scans on a seperate process
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Isolation
-{
- using System;
- using System.Threading;
-
- using HandBrake.ApplicationServices.EventArgs;
- using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- using HandBrakeWPF.Isolation.Interfaces;
- using HandBrakeWPF.Services.Interfaces;
-
- /// <summary>
- /// Isolated Scan Service.
- /// This is an implementation of the IScan implementation that runs scans on a seperate process
- /// </summary>
- public class IsolatedScanService : BackgroundServiceConnector, IIsolatedScanService
- {
- #region Constants and Fields
-
- /// <summary>
- /// The post action.
- /// </summary>
- private Action<bool> postScanAction;
-
- #endregion
-
- #region Events
-
- /// <summary>
- /// The scan completed.
- /// </summary>
- public event ScanCompletedStatus ScanCompleted;
-
- /// <summary>
- /// The scan stared.
- /// </summary>
- public event EventHandler ScanStared;
-
- /// <summary>
- /// The scan status changed.
- /// </summary>
- public event ScanProgessStatus ScanStatusChanged;
-
- #endregion
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IsolatedScanService"/> class.
- /// </summary>
- /// <param name="errorService">
- /// The error Service.
- /// </param>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public IsolatedScanService(IErrorService errorService, IUserSettingService userSettingService)
- : base(errorService, userSettingService)
- {
- try
- {
- if (this.CanConnect())
- {
- this.Connect();
- }
- }
- catch (Exception exception)
- {
- errorService.ShowError(
- "Unable to connect to scan worker process.", "Try restarting HandBrake", exception);
- }
- }
-
- #region Properties
-
- /// <summary>
- /// Gets ActivityLog.
- /// </summary>
- public string ActivityLog
- {
- get
- {
- return Service.ScanActivityLog;
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether IsScanning.
- /// </summary>
- public bool IsScanning
- {
- get
- {
- return Service.IsScanning;
- }
- }
-
- /// <summary>
- /// Gets the Souce Data.
- /// </summary>
- public Source SouceData
- {
- get
- {
- return Service.SouceData;
- }
- }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// The scan completed callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public override void ScanCompletedCallback(ScanCompletedEventArgs eventArgs)
- {
- if (this.postScanAction != null)
- {
- this.postScanAction(true);
- }
-
- if (this.ScanCompleted != null)
- {
- ThreadPool.QueueUserWorkItem(delegate { this.ScanCompleted(this, eventArgs); });
- }
-
- base.ScanCompletedCallback(eventArgs);
- }
-
- /// <summary>
- /// The scan progress callback.
- /// </summary>
- /// <param name="eventArgs">
- /// The event args.
- /// </param>
- public override void ScanProgressCallback(ScanProgressEventArgs eventArgs)
- {
- if (this.ScanStatusChanged != null)
- {
- ThreadPool.QueueUserWorkItem(delegate { this.ScanStatusChanged(this, eventArgs); });
- }
-
- base.ScanProgressCallback(eventArgs);
- }
-
- /// <summary>
- /// The scan started callback.
- /// </summary>
- public override void ScanStartedCallback()
- {
- if (this.ScanStared != null)
- {
- ThreadPool.QueueUserWorkItem(delegate { this.ScanStared(this, EventArgs.Empty); });
- }
-
- base.ScanStartedCallback();
- }
-
- #endregion
-
- #region Implemented Interfaces
-
- #region IScan
-
- /// <summary>
- /// Take a Scan Log file, and process it as if it were from the CLI.
- /// </summary>
- /// <param name="path">
- /// The path to the log file.
- /// </param>
- public void DebugScanLog(string path)
- {
- throw new NotImplementedException("Not available in process isolation mode!");
- }
-
- /// <summary>
- /// Scan a Source Path.
- /// Title 0: scan all
- /// </summary>
- /// <param name="sourcePath">
- /// Path to the file to scan
- /// </param>
- /// <param name="title">
- /// int title number. 0 for scan all
- /// </param>
- /// <param name="previewCount">
- /// The preview Count.
- /// </param>
- /// <param name="postAction">
- /// The post Action.
- /// </param>
- public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction)
- {
- this.postScanAction = postAction;
- Service.ScanSource(sourcePath, title, previewCount);
- }
-
- /// <summary>
- /// Kill the scan
- /// </summary>
- public void Stop()
- {
- Service.StopScan();
- }
-
- #endregion
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
new file mode 100644
index 000000000..79d79164f
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -0,0 +1,257 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncodeServiceWrapper.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>
+// We have multiple implementations of IEncode. This is a wrapper class for the GUI so that the
+// implementation used is controllable via user settings.
+// Over time, this class will go away when the LibHB and process isolation code matures.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using System;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Exceptions;
+ using HandBrake.ApplicationServices.Isolation;
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Interfaces;
+
+ using EncodeCompletedEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs;
+ using EncodeProgressEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs;
+
+ /// <summary>
+ /// We have multiple implementations of Iencode. This is a wrapper class for the GUI so that the
+ /// implementation used is controllable via user settings.
+ /// Over time, this class will go away when the LibHB and process isolation code matures.
+ /// </summary>
+ public class EncodeServiceWrapper : IEncodeServiceWrapper
+ {
+ #region Constants and Fields
+
+ /// <summary>
+ /// The encode service.
+ /// </summary>
+ private readonly IEncode encodeService;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncodeServiceWrapper"/> class.
+ /// </summary>
+ /// <param name="userSettingService">
+ /// The user setting service.
+ /// </param>
+ public EncodeServiceWrapper(IUserSettingService userSettingService)
+ {
+ var useLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
+ var useProcessIsolation =
+ userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
+ var port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);
+
+ if (useLibHb)
+ {
+ try
+ {
+ if (useProcessIsolation)
+ {
+ this.encodeService = new IsolatedEncodeService(port);
+ }
+ else
+ {
+ IHandBrakeInstance handBrakeInstance = IoC.Get<IHandBrakeInstance>();
+ this.encodeService = new LibEncode(userSettingService, handBrakeInstance);
+ }
+ }
+ catch (Exception exc)
+ {
+ // Try to recover from errors.
+ userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);
+ throw new GeneralApplicationException(
+ "Unable to initialise LibHB or Background worker service",
+ "Falling back to using HandBrakeCLI.exe. Setting has been reset",
+ exc);
+ }
+ }
+ else
+ {
+ this.encodeService = new Encode(userSettingService);
+ }
+
+ this.encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
+ this.encodeService.EncodeStarted += this.EncodeServiceEncodeStarted;
+ this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
+ }
+
+ #endregion
+
+ #region Events
+
+ /// <summary>
+ /// The encode completed.
+ /// </summary>
+ public event EncodeCompletedStatus EncodeCompleted;
+
+ /// <summary>
+ /// The encode started.
+ /// </summary>
+ public event EventHandler EncodeStarted;
+
+ /// <summary>
+ /// The encode status changed.
+ /// </summary>
+ public event EncodeProgessStatus EncodeStatusChanged;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets ActivityLog.
+ /// </summary>
+ public string ActivityLog
+ {
+ get
+ {
+ return this.encodeService.ActivityLog;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether IsEncoding.
+ /// </summary>
+ public bool IsEncoding
+ {
+ get
+ {
+ return this.encodeService.IsEncoding;
+ }
+ }
+
+ #endregion
+
+ #region Implemented Interfaces
+
+ #region IEncode
+
+ /// <summary>
+ /// Copy the log file to the desired destinations
+ /// </summary>
+ /// <param name="destination">
+ /// The destination.
+ /// </param>
+ public void ProcessLogs(string destination)
+ {
+ this.encodeService.ProcessLogs(destination);
+ }
+
+ /// <summary>
+ /// Attempt to Safely kill a DirectRun() CLI
+ /// NOTE: This will not work with a MinGW CLI
+ /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
+ /// </summary>
+ public void SafelyStop()
+ {
+ this.encodeService.SafelyStop();
+ }
+
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ this.encodeService.Shutdown();
+ this.encodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
+ this.encodeService.EncodeStarted -= this.EncodeServiceEncodeStarted;
+ this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
+ }
+
+ /// <summary>
+ /// Start with a LibHb EncodeJob Object
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <param name="enableLogging">
+ /// The enable Logging.
+ /// </param>
+ public void Start(QueueTask job, bool enableLogging)
+ {
+ this.encodeService.Start(job, enableLogging);
+ }
+
+ /// <summary>
+ /// Kill the CLI process
+ /// </summary>
+ public void Stop()
+ {
+ this.encodeService.Stop();
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// The encode service_ encode completed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EncodeCompletedEventArgs.
+ /// </param>
+ private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
+ {
+ if (EncodeCompleted != null)
+ {
+ this.EncodeCompleted(sender, e);
+ }
+ }
+
+ /// <summary>
+ /// The encode service_ encode started.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs
+ /// </param>
+ private void EncodeServiceEncodeStarted(object sender, EventArgs e)
+ {
+ if (EncodeStarted != null)
+ {
+ this.EncodeStarted(sender, e);
+ }
+ }
+
+ /// <summary>
+ /// The encode service_ encode status changed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EncodeProgressEventArgs.
+ /// </param>
+ private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e)
+ {
+ if (EncodeStatusChanged != null)
+ {
+ this.EncodeStatusChanged(sender, e);
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs
new file mode 100644
index 000000000..a25213a6b
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs
@@ -0,0 +1,243 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScanServiceWrapper.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>
+// We have multiple implementations of IScan. This is a wrapper class for the GUI so that the
+// implementation used is controllable via user settings.
+// Over time, this class will go away when the LibHB and process isolation code matures.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using System;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Exceptions;
+ using HandBrake.ApplicationServices.Isolation;
+ using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Services;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Interfaces;
+
+ /// <summary>
+ /// We have multiple implementations of IScan. This is a wrapper class for the GUI so that the
+ /// implementation used is controllable via user settings.
+ /// Over time, this class will go away when the LibHB and process isolation code matures.
+ /// </summary>
+ public class ScanServiceWrapper : IScanServiceWrapper
+ {
+ #region Constants and Fields
+
+ /// <summary>
+ /// The scan service.
+ /// </summary>
+ private readonly IScan scanService;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ScanServiceWrapper"/> class.
+ /// </summary>
+ /// <param name="userSettingService">
+ /// The user setting service.
+ /// </param>
+ public ScanServiceWrapper(IUserSettingService userSettingService)
+ {
+ var useLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
+ var useProcessIsolation =
+ userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
+ string port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);
+
+ if (useLibHb)
+ {
+ try
+ {
+ if (useProcessIsolation)
+ {
+ this.scanService = new IsolatedScanService(port);
+ }
+ else
+ {
+ IHandBrakeInstance handBrakeInstance = IoC.Get<IHandBrakeInstance>();
+ this.scanService = new LibScan(userSettingService, handBrakeInstance);
+ }
+ }
+ catch(Exception exc)
+ {
+ // Try to recover from errors.
+ userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);
+ throw new GeneralApplicationException("Unable to initialise LibHB or Background worker service", "Falling back to using HandBrakeCLI.exe. Setting has been reset", exc);
+ }
+ }
+ else
+ {
+ this.scanService = new ScanService(userSettingService);
+ }
+
+ this.scanService.ScanCompleted += this.ScanServiceScanCompleted;
+ this.scanService.ScanStared += this.ScanServiceScanStared;
+ this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;
+ }
+
+ /// <summary>
+ /// The scan service scan status changed event
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The ScanProgressEventArgs.
+ /// </param>
+ private void ScanServiceScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e)
+ {
+ this.ScanStatusChanged(sender, e);
+ }
+
+ /// <summary>
+ /// The scan service scan stared event
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs
+ /// </param>
+ private void ScanServiceScanStared(object sender, EventArgs e)
+ {
+ this.ScanStared(sender, e);
+ }
+
+ /// <summary>
+ /// The scan service scan completed event
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The ScanCompletedEventArgs
+ /// </param>
+ private void ScanServiceScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
+ {
+ this.ScanCompleted(sender, e);
+ }
+
+ #endregion
+
+ #region Events
+
+ /// <summary>
+ /// The scan completed.
+ /// </summary>
+ public event ScanCompletedStatus ScanCompleted;
+
+ /// <summary>
+ /// The scan stared.
+ /// </summary>
+ public event EventHandler ScanStared;
+
+ /// <summary>
+ /// The scan status changed.
+ /// </summary>
+ public event ScanProgessStatus ScanStatusChanged;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets ActivityLog.
+ /// </summary>
+ public string ActivityLog
+ {
+ get
+ {
+ return this.scanService.ActivityLog;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether IsScanning.
+ /// </summary>
+ public bool IsScanning
+ {
+ get
+ {
+ return this.scanService.IsScanning;
+ }
+ }
+
+ /// <summary>
+ /// Gets the Souce Data.
+ /// </summary>
+ public Source SouceData
+ {
+ get
+ {
+ return this.scanService.SouceData;
+ }
+ }
+
+ #endregion
+
+ #region Implemented Interfaces
+
+ #region IScan
+
+ /// <summary>
+ /// Take a Scan Log file, and process it as if it were from the CLI.
+ /// </summary>
+ /// <param name="path">
+ /// The path to the log file.
+ /// </param>
+ public void DebugScanLog(string path)
+ {
+ this.scanService.DebugScanLog(path);
+ }
+
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ this.scanService.Shutdown();
+ }
+
+ /// <summary>
+ /// Scan a Source Path.
+ /// Title 0: scan all
+ /// </summary>
+ /// <param name="sourcePath">
+ /// Path to the file to scan
+ /// </param>
+ /// <param name="title">
+ /// int title number. 0 for scan all
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ /// <param name="postAction">
+ /// The post Action.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction)
+ {
+ this.scanService.Scan(sourcePath, title, previewCount, postAction);
+ }
+
+ /// <summary>
+ /// Kill the scan
+ /// </summary>
+ public void Stop()
+ {
+ this.scanService.Stop();
+ }
+
+ #endregion
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index dadae2026..e34f98ada 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -21,6 +21,8 @@ namespace HandBrakeWPF.Startup
using Castle.Windsor;
using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop;
using ViewModels;
using ViewModels.Interfaces;
@@ -49,11 +51,14 @@ namespace HandBrakeWPF.Startup
// Initialise the ApplicationServices IWindsorInstaller
this.windsorContainer.Register(Component.For<IWindsorInstaller>().ImplementedBy<ServicesWindsorInstaller>());
+ this.windsorContainer.Register(Component.For<IWindsorInstaller>().ImplementedBy<InteropWindsorInstaller>());
this.windsorContainer.Install(windsorContainer.ResolveAll<IWindsorInstaller>());
// Services
this.windsorContainer.Register(Component.For<IUpdateService>().ImplementedBy<UpdateService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IDriveDetectService>().ImplementedBy<DriveDetectService>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IScanServiceWrapper>().ImplementedBy<ScanServiceWrapper>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IEncodeServiceWrapper>().ImplementedBy<EncodeServiceWrapper>().LifeStyle.Is(LifestyleType.Singleton));
// Shell
this.windsorContainer.Register(Component.For<IErrorService>().ImplementedBy<ErrorService>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index 77cd9ab8f..440b65bf5 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -176,6 +176,11 @@ namespace HandBrakeWPF
/// </summary>
public const string EnableDebugFeatures = "EnableDebugFeatures";
+ /// <summary>
+ /// Enable the use of LibHb instead of HandBrakeCLI
+ /// </summary>
+ public const string EnableLibHb = "EnableLibHb";
+
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 86c8d3a14..a0e9d62c2 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -29,8 +29,6 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Commands;
using HandBrakeWPF.Helpers;
- using HandBrakeWPF.Isolation;
- using HandBrakeWPF.Isolation.Interfaces;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -85,12 +83,12 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// The Source Scan Service.
/// </summary>
- private IScan scanService;
+ private readonly IScanServiceWrapper scanService;
/// <summary>
/// The Encode Service
/// </summary>
- private IEncode encodeService;
+ private readonly IEncodeServiceWrapper encodeService;
/// <summary>
/// HandBrakes Main Window Title
@@ -191,7 +189,7 @@ namespace HandBrakeWPF.ViewModels
/// <param name="driveDetectService">
/// The drive Detect Service.
/// </param>
- public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
+ public MainViewModel(IUserSettingService userSettingService, IScanServiceWrapper scanService, IEncodeServiceWrapper encodeService, IPresetService presetService,
IErrorService errorService, IShellViewModel shellViewModel, IUpdateService updateService, IDriveDetectService driveDetectService)
{
GeneralUtilities.SetInstanceId();
@@ -817,11 +815,6 @@ namespace HandBrakeWPF.ViewModels
this.SourceMenu = this.GenerateSourceMenu();
this.driveDetectService.StartDetection(this.DriveTrayChanged);
-
- if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation))
- {
- this.EnableIsolationServices();
- }
}
/// <summary>
@@ -832,19 +825,8 @@ namespace HandBrakeWPF.ViewModels
// Shutdown Service
this.driveDetectService.Close();
- IIsolatedScanService isolatedScanService = this.scanService as IsolatedScanService;
- if (isolatedScanService != null)
- {
- // Kill any background services for this instance of HandBrake.
- isolatedScanService.Disconnect();
- }
-
- IIsolatedEncodeService isolatedEncodeService = this.encodeService as IIsolatedEncodeService;
- if (isolatedEncodeService != null)
- {
- // Kill any background services for this instance of HandBrake.
- isolatedEncodeService.Disconnect();
- }
+ this.scanService.Shutdown();
+ this.encodeService.Shutdown();
// Unsubscribe from Events.
this.scanService.ScanStared -= this.ScanStared;
@@ -977,7 +959,6 @@ namespace HandBrakeWPF.ViewModels
this.errorService.ShowMessageBox("There are jobs on the queue with the same destination path. Please choose a different path for this job.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
}
-
if (!this.IsEncoding)
{
this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.QueueManager.Count);
@@ -1111,7 +1092,6 @@ namespace HandBrakeWPF.ViewModels
return;
}
-
if (File.Exists(this.Destination))
{
MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
@@ -1200,30 +1180,6 @@ namespace HandBrakeWPF.ViewModels
}
}
- /// <summary>
- /// The test isolation services.
- /// Swaps out the implementation of IScan to the IsolatedScanService version.
- /// </summary>
- public void EnableIsolationServices()
- {
- // Unhook the old services
- this.scanService.ScanStared -= this.ScanStared;
- this.scanService.ScanCompleted -= this.ScanCompleted;
- this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
- this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;
-
- // Replace the Services
- this.scanService = new IsolatedScanService(this.errorService, this.userSettingService);
- this.encodeService = new IsolatedEncodeService(this.errorService, this.userSettingService);
- this.queueProcessor.SwapEncodeService(this.encodeService);
-
- // Add the new Event Hooks
- this.scanService.ScanStared += this.ScanStared;
- this.scanService.ScanCompleted += this.ScanCompleted;
- this.scanService.ScanStatusChanged += this.ScanStatusChanged;
- this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
- }
-
#endregion
#region Main Window Public Methods
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 7b65a5ef8..1bd773bc0 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -354,6 +354,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private bool enableDebugFeatures;
+ /// <summary>
+ /// Backing field for EnableLibHb
+ /// </summary>
+ private bool enableLibHb;
+
#endregion
#region Constructors and Destructors
@@ -1374,6 +1379,22 @@ namespace HandBrakeWPF.ViewModels
}
}
+ /// <summary>
+ /// Gets or sets a value indicating whether enable lib hb.
+ /// </summary>
+ public bool EnableLibHb
+ {
+ get
+ {
+ return this.enableLibHb;
+ }
+ set
+ {
+ this.enableLibHb = value;
+ this.NotifyOfPropertyChange(() => this.EnableLibHb);
+ }
+ }
+
#endregion
#endregion
@@ -1670,6 +1691,7 @@ namespace HandBrakeWPF.ViewModels
this.ServerPort = port;
this.EnableProcessIsolation = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
this.EnableDebugFeatures = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableDebugFeatures);
+ this.EnableLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
}
/// <summary>
@@ -1887,6 +1909,7 @@ namespace HandBrakeWPF.ViewModels
userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);
userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString());
userSettingService.SetUserSetting(UserSettingConstants.EnableDebugFeatures, this.EnableDebugFeatures);
+ userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/Images/warningsmall.png b/win/CS/HandBrakeWPF/Views/Images/warningsmall.png
new file mode 100644
index 000000000..78f246f04
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/Images/warningsmall.png
Binary files differ
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index d0135db47..4412c7bfb 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -337,7 +337,8 @@
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">
<CheckBox Content="Enable Process Isolation (Run Scans and Encodes via an intermediate service)" IsChecked="{Binding EnableProcessIsolation}" />
-
+ <CheckBox Content="Enable LibHB (uses hb.dll instead of HandBrakeCLI.exe)" Margin="0,5,0,0" IsChecked="{Binding EnableLibHb}" />
+
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" Grid.Column="1">
<TextBlock Text="Server Port:" VerticalAlignment="Center" />
<TextBox Width="50" MaxLength="5" Text="{Binding ServerPort}" />
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 0c995c9e9..80a1e6e2c 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -465,4 +465,12 @@
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
</value>
</item>
+ <item>
+ <key>
+ <string>EnableLibHb</string>
+ </key>
+ <value>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
+ </value>
+ </item>
</dictionary> \ No newline at end of file