diff options
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs new file mode 100644 index 000000000..d49d789c8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakePresetService.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 preset service.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Json.Presets;
+ using HandBrake.ApplicationServices.Services.Logging;
+ using HandBrake.ApplicationServices.Services.Logging.Model;
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// The hand brake preset service.
+ /// </summary>
+ public class HandBrakePresetService
+ {
+ /// <summary>
+ /// Initializes static members of the <see cref="HandBrakePresetService"/> class.
+ /// </summary>
+ static HandBrakePresetService()
+ {
+ HBFunctions.hb_presets_builtin_init();
+ }
+
+ /// <summary>
+ /// The get built in presets.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static IList<PresetCategory> GetBuiltInPresets()
+ {
+ IntPtr presets = HBFunctions.hb_presets_builtin_get_json();
+ string presetJson = Marshal.PtrToStringAnsi(presets);
+
+ LogHelper.LogMessage(new LogMessage(presetJson, LogMessageType.progressJson, LogLevel.debug));
+
+ IList<PresetCategory> presetList = JsonConvert.DeserializeObject<IList<PresetCategory>>(presetJson);
+
+ return presetList;
+ }
+ }
+}
|