Files
NativeFileDialogs.NET/NativeFileDialogs.AutoGen/nfd.cs
T

564 lines
25 KiB
C#

// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
using __CallingConvention = global::System.Runtime.InteropServices.CallingConvention;
using __IntPtr = global::System.IntPtr;
namespace NativeFileDialogs.AutoGen
{
public enum NfdresultT : uint
{
NFD_ERROR = 0,
NFD_OKAY = 1,
NFD_CANCEL = 2
}
public unsafe partial class MaxAlignT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 32)]
public partial struct __Internal
{
internal long __clang_max_align_nonce1;
internal fixed byte __clang_max_align_nonce2[128];
}
public __IntPtr __Instance { get; protected set; }
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.MaxAlignT> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.MaxAlignT>();
protected bool __ownsNativeInstance;
internal static MaxAlignT __CreateInstance(__IntPtr native, bool skipVTables = false)
{
return new MaxAlignT(native.ToPointer(), skipVTables);
}
internal static MaxAlignT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (NativeToManagedMap.TryGetValue(native, out var managed))
return (MaxAlignT)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
NativeToManagedMap[native] = result;
return result;
}
internal static MaxAlignT __CreateInstance(__Internal native, bool skipVTables = false)
{
return new MaxAlignT(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private MaxAlignT(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected MaxAlignT(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true, callNativeDtor : __ownsNativeInstance );
}
partial void DisposePartial(bool disposing);
internal protected virtual void Dispose(bool disposing, bool callNativeDtor )
{
if (__Instance == IntPtr.Zero)
return;
NativeToManagedMap.TryRemove(__Instance, out _);
DisposePartial(disposing);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public long ClangMaxAlignNonce1
{
get
{
return ((__Internal*)__Instance)->__clang_max_align_nonce1;
}
set
{
((__Internal*)__Instance)->__clang_max_align_nonce1 = value;
}
}
}
public unsafe partial class NfdpathsetenumT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
public partial struct __Internal
{
internal __IntPtr ptr;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "_ZN16nfdpathsetenum_tC2ERKS_", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void cctor(__IntPtr __instance, __IntPtr __0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdpathsetenumT> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdpathsetenumT>();
protected bool __ownsNativeInstance;
internal static NfdpathsetenumT __CreateInstance(__IntPtr native, bool skipVTables = false)
{
return new NfdpathsetenumT(native.ToPointer(), skipVTables);
}
internal static NfdpathsetenumT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (NativeToManagedMap.TryGetValue(native, out var managed))
return (NfdpathsetenumT)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
NativeToManagedMap[native] = result;
return result;
}
internal static NfdpathsetenumT __CreateInstance(__Internal native, bool skipVTables = false)
{
return new NfdpathsetenumT(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private NfdpathsetenumT(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected NfdpathsetenumT(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public NfdpathsetenumT()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public NfdpathsetenumT(global::NativeFileDialogs.AutoGen.NfdpathsetenumT __0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
*((global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal*) __0.__Instance);
}
public void Dispose()
{
Dispose(disposing: true, callNativeDtor : __ownsNativeInstance );
}
partial void DisposePartial(bool disposing);
internal protected virtual void Dispose(bool disposing, bool callNativeDtor )
{
if (__Instance == IntPtr.Zero)
return;
NativeToManagedMap.TryRemove(__Instance, out _);
DisposePartial(disposing);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public __IntPtr Ptr
{
get
{
return ((__Internal*)__Instance)->ptr;
}
set
{
((__Internal*)__Instance)->ptr = (__IntPtr) value;
}
}
}
public unsafe partial class NfdnfilteritemT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
{
internal __IntPtr name;
internal __IntPtr spec;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "_ZN16nfdnfilteritem_tC2ERKS_", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void cctor(__IntPtr __instance, __IntPtr __0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT>();
private bool __name_OwnsNativeMemory = false;
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
internal static NfdnfilteritemT __CreateInstance(__IntPtr native, bool skipVTables = false)
{
return new NfdnfilteritemT(native.ToPointer(), skipVTables);
}
internal static NfdnfilteritemT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (NativeToManagedMap.TryGetValue(native, out var managed))
return (NfdnfilteritemT)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
NativeToManagedMap[native] = result;
return result;
}
internal static NfdnfilteritemT __CreateInstance(__Internal native, bool skipVTables = false)
{
return new NfdnfilteritemT(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private NfdnfilteritemT(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected NfdnfilteritemT(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public NfdnfilteritemT()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public NfdnfilteritemT(global::NativeFileDialogs.AutoGen.NfdnfilteritemT __0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
*((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __0.__Instance);
if (__0.__name_OwnsNativeMemory)
this.Name = __0.Name;
if (__0.__spec_OwnsNativeMemory)
this.Spec = __0.Spec;
}
public void Dispose()
{
Dispose(disposing: true, callNativeDtor : __ownsNativeInstance );
}
partial void DisposePartial(bool disposing);
internal protected virtual void Dispose(bool disposing, bool callNativeDtor )
{
if (__Instance == IntPtr.Zero)
return;
NativeToManagedMap.TryRemove(__Instance, out _);
DisposePartial(disposing);
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public string Name
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, ((__Internal*)__Instance)->name);
}
set
{
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
__name_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->name = global::System.IntPtr.Zero;
return;
}
var __bytes0 = global::System.Text.Encoding.UTF8.GetBytes(value);
var __bytePtr0 = Marshal.AllocHGlobal(__bytes0.Length + 1);
Marshal.Copy(__bytes0, 0, __bytePtr0, __bytes0.Length);
Marshal.WriteByte(__bytePtr0 + __bytes0.Length, 0);
((__Internal*)__Instance)->name = (__IntPtr) __bytePtr0;
}
}
public string Spec
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, ((__Internal*)__Instance)->spec);
}
set
{
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
__spec_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->spec = global::System.IntPtr.Zero;
return;
}
var __bytes0 = global::System.Text.Encoding.UTF8.GetBytes(value);
var __bytePtr0 = Marshal.AllocHGlobal(__bytes0.Length + 1);
Marshal.Copy(__bytes0, 0, __bytePtr0, __bytes0.Length);
Marshal.WriteByte(__bytePtr0 + __bytes0.Length, 0);
((__Internal*)__Instance)->spec = (__IntPtr) __bytePtr0;
}
}
}
public unsafe partial class nfd
{
public partial struct __Internal
{
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_FreePathN(sbyte* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Init", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_Init();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Quit", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_Quit();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(sbyte** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogMultipleN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_SaveDialogN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogN(sbyte** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultName);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PickFolderN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderN(sbyte** outPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_GetError", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr NFD_GetError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_ClearError", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_ClearError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetCount", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetCount(__IntPtr pathSet, uint* count);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFreePathN([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetEnum", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, __IntPtr outEnumerator);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreeEnum", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFreeEnum(__IntPtr enumerator);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(__IntPtr enumerator, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_Free", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFree(__IntPtr pathSet);
}
public static void NFD_FreePathN(sbyte* filePath)
{
__Internal.NFD_FreePathN(filePath);
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_Init()
{
var __ret = __Internal.NFD_Init();
return __ret;
}
public static void NFD_Quit()
{
__Internal.NFD_Quit();
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(sbyte** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT[] filterList, uint filterCount, string defaultPath)
{
global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] __filterList;
if (filterList is null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
}
}
var __arg1 = __filterList;
var __ret = __Internal.NFD_OpenDialogN(outPath, __arg1, filterCount, defaultPath);
return __ret;
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.NfdnfilteritemT[] filterList, uint filterCount, string defaultPath)
{
global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] __filterList;
if (filterList is null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
}
}
var __arg1 = __filterList;
var __ret = __Internal.NFD_OpenDialogMultipleN(outPaths, __arg1, filterCount, defaultPath);
return __ret;
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogN(sbyte** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT[] filterList, uint filterCount, string defaultPath, string defaultName)
{
global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[] __filterList;
if (filterList is null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
}
}
var __arg1 = __filterList;
var __ret = __Internal.NFD_SaveDialogN(outPath, __arg1, filterCount, defaultPath, defaultName);
return __ret;
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderN(sbyte** outPath, string defaultPath)
{
var __ret = __Internal.NFD_PickFolderN(outPath, defaultPath);
return __ret;
}
public static string NFD_GetError()
{
var __ret = __Internal.NFD_GetError();
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, __ret);
}
public static void NFD_ClearError()
{
__Internal.NFD_ClearError();
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetCount(__IntPtr pathSet, ref uint count)
{
fixed (uint* __count1 = &count)
{
var __arg1 = __count1;
var __ret = __Internal.NFD_PathSetGetCount(pathSet, __arg1);
return __ret;
}
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, sbyte** outPath)
{
var __ret = __Internal.NFD_PathSetGetPathN(pathSet, index, outPath);
return __ret;
}
public static void NFD_PathSetFreePathN(string filePath)
{
__Internal.NFD_PathSetFreePathN(filePath);
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, global::NativeFileDialogs.AutoGen.NfdpathsetenumT outEnumerator)
{
var __arg1 = outEnumerator is null ? __IntPtr.Zero : outEnumerator.__Instance;
var __ret = __Internal.NFD_PathSetGetEnum(pathSet, __arg1);
return __ret;
}
public static void NFD_PathSetFreeEnum(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
__Internal.NFD_PathSetFreeEnum(__arg0);
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator, sbyte** outPath)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
var __ret = __Internal.NFD_PathSetEnumNextN(__arg0, outPath);
return __ret;
}
public static void NFD_PathSetFree(__IntPtr pathSet)
{
__Internal.NFD_PathSetFree(pathSet);
}
}
}