From c70981efae72a8392c18a7e92db667eddbc55485 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 10 Jun 2018 21:21:45 +0100 Subject: WinGui: Implement most of the HTTP Worker Process stubs. --- .../Instance/HandBrakeInstanceManager.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs (limited to 'win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs') diff --git a/win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs b/win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs new file mode 100644 index 000000000..3fcf00e8f --- /dev/null +++ b/win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs @@ -0,0 +1,78 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The hand brake instance manager. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Instance +{ + using HandBrake.Interop.Interop; + using HandBrake.Interop.Interop.Interfaces; + using HandBrake.Interop.Model; + + /// + /// The HandBrake Instance manager. + /// Only supports scanning right now. + /// + public static class HandBrakeInstanceManager + { + private static IEncodeInstance encodeInstance; + + /// + /// Initializes static members of the class. + /// + static HandBrakeInstanceManager() + { + } + + /// + /// The init. + /// + public static void Init() + { + // Nothing to do. Triggers static constructor. + } + + /// + /// The get encode instance. + /// + /// + /// The verbosity. + /// + /// + /// The configuratio. + /// + /// + /// The . + /// + public static IEncodeInstance GetEncodeInstance(int verbosity, HBConfiguration configuration) + { + if (encodeInstance != null) + { + encodeInstance.Dispose(); + encodeInstance = null; + } + + IEncodeInstance newInstance; + + if (configuration.RemoteServiceEnabled) + { + newInstance = new RemoteInstance(configuration.RemoteServicePort); + } + else + { + newInstance = new HandBrakeInstance(); + } + + newInstance.Initialize(verbosity); + encodeInstance = newInstance; + + HandBrakeUtils.SetDvdNav(!configuration.IsDvdNavDisabled); + + return encodeInstance; + } + } +} -- cgit v1.2.3