diff options
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs index e2610905d..8d4f34e9e 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs @@ -14,6 +14,7 @@ namespace HandBrake.ApplicationServices.Interop using System.Runtime.InteropServices;
using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Services.Logging;
using HandBrake.ApplicationServices.Services.Logging.Model;
@@ -43,5 +44,26 @@ namespace HandBrake.ApplicationServices.Interop return presetList;
}
+
+ /// <summary>
+ /// The get preset from file.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <returns>
+ /// The <see cref="PresetCategory"/>.
+ /// </returns>
+ public static PresetTransportContainer GetPresetFromFile(string filename)
+ {
+ IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
+ string presetJson = Marshal.PtrToStringAnsi(presetStringPointer);
+
+ LogHelper.LogMessage(new LogMessage(presetJson, LogMessageType.libhb, LogLevel.debug));
+
+ PresetTransportContainer preset = JsonConvert.DeserializeObject<PresetTransportContainer>(presetJson);
+
+ return preset;
+ }
}
}
|