diff options
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs index 3a36ddfc9..3a7f1c01e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs @@ -12,13 +12,13 @@ namespace HandBrake.Interop using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
- - using HandBrake.Interop.HbLib; - - /// <summary> - /// Helper utilities for native interop. - /// </summary> - public static class InteropUtilities +
+ using HandBrake.Interop.HbLib;
+
+ /// <summary>
+ /// Helper utilities for native interop.
+ /// </summary>
+ public static class InteropUtilities
{
/// <summary>
/// Reads the given native structure pointer.
@@ -49,35 +49,35 @@ namespace HandBrake.Interop }
return returnList;
- } - - /// <summary> - /// Converts the given native array to a managed collection. - /// </summary> - /// <typeparam name="T">The type of item in the list.</typeparam> - /// <param name="arrayPtr">The pointer to the array.</param> - /// <param name="count">The number of items in the array.</param> - /// <returns>The converted collection.</returns> - public static IEnumerable<T> ConvertArray<T>(IntPtr arrayPtr, int count) - { - IntPtr currentItem = arrayPtr; - - var result = new List<T>(); - for (int i = 0; i < count; i++) - { - T nativeEncoder = ReadStructure<T>(currentItem); - result.Add(nativeEncoder); - - currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T))); - } - - return result; - } - - /// <summary> - /// Creats a new, empty native HandBrake list. - /// </summary> - /// <param name="capacity">The capacity of the new list.</param> + }
+
+ /// <summary>
+ /// Converts the given native array to a managed collection.
+ /// </summary>
+ /// <typeparam name="T">The type of item in the list.</typeparam>
+ /// <param name="arrayPtr">The pointer to the array.</param>
+ /// <param name="count">The number of items in the array.</param>
+ /// <returns>The converted collection.</returns>
+ public static IEnumerable<T> ConvertArray<T>(IntPtr arrayPtr, int count)
+ {
+ IntPtr currentItem = arrayPtr;
+
+ var result = new List<T>();
+ for (int i = 0; i < count; i++)
+ {
+ T nativeEncoder = ReadStructure<T>(currentItem);
+ result.Add(nativeEncoder);
+
+ currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T)));
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Creats a new, empty native HandBrake list.
+ /// </summary>
+ /// <param name="capacity">The capacity of the new list.</param>
/// <returns>The new native list.</returns>
public static NativeList CreateNativeList(int capacity)
{
|