diff options
author | sr55 <[email protected]> | 2018-06-10 21:21:45 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-06-10 21:22:13 +0100 |
commit | c70981efae72a8392c18a7e92db667eddbc55485 (patch) | |
tree | 99b00bbc8287434684d99603710a189c4ef243aa /win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs | |
parent | ae881a0c1aa77a80deba7a3c81ab907e8e3d62ad (diff) |
WinGui: Implement most of the HTTP Worker Process stubs.
Diffstat (limited to 'win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/Instance/HandBrakeInstanceManager.cs | 78 |
1 files changed, 78 insertions, 0 deletions
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 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="HandBrakeInstanceManager.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 hand brake instance manager. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Instance +{ + using HandBrake.Interop.Interop; + using HandBrake.Interop.Interop.Interfaces; + using HandBrake.Interop.Model; + + /// <summary> + /// The HandBrake Instance manager. + /// Only supports scanning right now. + /// </summary> + public static class HandBrakeInstanceManager + { + private static IEncodeInstance encodeInstance; + + /// <summary> + /// Initializes static members of the <see cref="HandBrakeInstanceManager"/> class. + /// </summary> + static HandBrakeInstanceManager() + { + } + + /// <summary> + /// The init. + /// </summary> + public static void Init() + { + // Nothing to do. Triggers static constructor. + } + + /// <summary> + /// The get encode instance. + /// </summary> + /// <param name="verbosity"> + /// The verbosity. + /// </param> + /// <param name="configuration"> + /// The configuratio. + /// </param> + /// <returns> + /// The <see cref="IHandBrakeInstance"/>. + /// </returns> + 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; + } + } +} |