summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/Interop
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs22
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs3
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs8
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs25
4 files changed, 53 insertions, 5 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
index a51a44fd1..98eb6071b 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
@@ -17,6 +17,7 @@ namespace HandBrake.Interop.Interop
using HandBrake.Interop.Interop.HbLib;
using HandBrake.Interop.Interop.Helpers;
using HandBrake.Interop.Interop.Json.Presets;
+ using HandBrake.Interop.Interop.Model;
using Newtonsoft.Json;
@@ -50,7 +51,7 @@ namespace HandBrake.Interop.Interop
/// <returns>
/// The <see cref="PresetCategory"/>.
/// </returns>
- public static PresetTransportContainer GetPresetFromFile(string filename)
+ public static PresetTransportContainer GetPresetsFromFile(string filename)
{
IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
string presetJson = Marshal.PtrToStringAnsi(presetStringPointer);
@@ -88,5 +89,24 @@ namespace HandBrake.Interop.Interop
writer.Write(preset);
}
}
+
+ public static PresetVersion GetCurrentPresetVersion()
+ {
+ IntPtr major = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
+ IntPtr minor = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
+ IntPtr micro = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
+
+ HBFunctions.hb_presets_current_version(major, minor, micro);
+
+ int majorVersion = Marshal.ReadInt32(major);
+ int minorVersion = Marshal.ReadInt32(minor);
+ int microVersion = Marshal.ReadInt32(micro);
+
+ Marshal.FreeHGlobal(major);
+ Marshal.FreeHGlobal(minor);
+ Marshal.FreeHGlobal(micro);
+
+ return new PresetVersion(majorVersion, minorVersion, microVersion);
+ }
}
}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs
index 689ceb937..7fc1ed500 100644
--- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs
@@ -469,5 +469,8 @@ namespace HandBrake.Interop.Interop.HbLib
// char * hb_presets_read_file_json(const char *filename);
[DllImport("hb", EntryPoint = "hb_presets_read_file_json", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_presets_read_file_json(IntPtr filename);
+
+ [DllImport("hb", EntryPoint = "hb_presets_current_version", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_presets_current_version(IntPtr major, IntPtr minor, IntPtr micro);
}
}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs
index 91ce48de5..4d72e70ff 100644
--- a/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs
+++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs
@@ -37,7 +37,7 @@ namespace HandBrake.Interop.Interop.Json.Presets
/// <param name="versionMicro">
/// The version micro.
/// </param>
- public PresetTransportContainer(string versionMajor, string versionMinor, string versionMicro)
+ public PresetTransportContainer(int versionMajor, int versionMinor, int versionMicro)
{
this.VersionMajor = versionMajor;
this.VersionMicro = versionMicro;
@@ -52,16 +52,16 @@ namespace HandBrake.Interop.Interop.Json.Presets
/// <summary>
/// Gets or sets the version major.
/// </summary>
- public string VersionMajor { get; set; }
+ public int VersionMajor { get; set; }
/// <summary>
/// Gets or sets the version micro.
/// </summary>
- public string VersionMicro { get; set; }
+ public int VersionMicro { get; set; }
/// <summary>
/// Gets or sets the version minor.
/// </summary>
- public string VersionMinor { get; set; }
+ public int VersionMinor { get; set; }
}
}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs b/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs
new file mode 100644
index 000000000..dbe5578f8
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs
@@ -0,0 +1,25 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PresetVersion.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>
+// Defines the PresetVersion type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ public class PresetVersion
+ {
+ public PresetVersion(int major, int minor, int micro)
+ {
+ this.Major = major;
+ this.Minor = minor;
+ this.Micro = micro;
+ }
+
+ public int Major { get; }
+ public int Minor { get; }
+ public int Micro { get; }
+ }
+}