// ----------------------------------------------------------------------------
//
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
//
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
using __CallingConvention = global::System.Runtime.InteropServices.CallingConvention;
using __IntPtr = global::System.IntPtr;
#pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required
namespace NativeFileDialogs.AutoGen
{
public enum Result
{
/// Programmatic error
Error = 0,
/// User pressed okay, or successful return
Okay = 1,
/// User pressed cancel
Cancel = 2
}
public unsafe partial class PathSetEnumerator : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
public partial struct __Internal
{
internal __IntPtr ptr;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "??0nfdpathsetenum_t@@QEAA@AEBU0@@Z", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr cctor(__IntPtr __instance, __IntPtr _0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
new global::System.Collections.Concurrent.ConcurrentDictionary();
internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.PathSetEnumerator managed)
{
NativeToManagedMap[native] = managed;
}
internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.PathSetEnumerator managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
}
protected bool __ownsNativeInstance;
internal static PathSetEnumerator __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
return new PathSetEnumerator(native.ToPointer(), skipVTables);
}
internal static PathSetEnumerator __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (__TryGetNativeToManagedMapping(native, out var managed))
return (PathSetEnumerator)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
internal static PathSetEnumerator __CreateInstance(__Internal native, bool skipVTables = false)
{
return new PathSetEnumerator(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private PathSetEnumerator(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
protected PathSetEnumerator(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public PathSetEnumerator()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
public PathSetEnumerator(global::NativeFileDialogs.AutoGen.PathSetEnumerator _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
*((global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.PathSetEnumerator.__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 FilterItemU8 : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
{
internal __IntPtr name;
internal __IntPtr spec;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "??0nfdu8filteritem_t@@QEAA@AEBU0@@Z", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr cctor(__IntPtr __instance, __IntPtr _0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
new global::System.Collections.Concurrent.ConcurrentDictionary();
internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.FilterItemU8 managed)
{
NativeToManagedMap[native] = managed;
}
internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.FilterItemU8 managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
}
private bool __name_OwnsNativeMemory = false;
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
internal static FilterItemU8 __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
return new FilterItemU8(native.ToPointer(), skipVTables);
}
internal static FilterItemU8 __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (__TryGetNativeToManagedMapping(native, out var managed))
return (FilterItemU8)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
internal static FilterItemU8 __CreateInstance(__Internal native, bool skipVTables = false)
{
return new FilterItemU8(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private FilterItemU8(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
protected FilterItemU8(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public FilterItemU8()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
public FilterItemU8(global::NativeFileDialogs.AutoGen.FilterItemU8 _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
*((global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.FilterItemU8.__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;
}
}
}
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public unsafe partial class FilterItemN : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
{
internal __IntPtr name;
internal __IntPtr spec;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "??0nfdnfilteritem_t@@QEAA@AEBU0@@Z", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr cctor(__IntPtr __instance, __IntPtr _0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
new global::System.Collections.Concurrent.ConcurrentDictionary();
internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.FilterItemN managed)
{
NativeToManagedMap[native] = managed;
}
internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.FilterItemN managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
}
private bool __name_OwnsNativeMemory = false;
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
internal static FilterItemN __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
return new FilterItemN(native.ToPointer(), skipVTables);
}
internal static FilterItemN __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (__TryGetNativeToManagedMapping(native, out var managed))
return (FilterItemN)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
internal static FilterItemN __CreateInstance(__Internal native, bool skipVTables = false)
{
return new FilterItemN(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private FilterItemN(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
protected FilterItemN(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public FilterItemN()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
public FilterItemN(global::NativeFileDialogs.AutoGen.FilterItemN _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
*((global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.FilterItemN.__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.Unicode, ((__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 __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__Internal*)__Instance)->name = (__IntPtr) __bytePtr0;
}
}
public string Spec
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.Unicode, ((__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 __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__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 FreePathN(char* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void FreePathU8(sbyte* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Init", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result Init();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Quit", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void Quit();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result OpenDialogN(char** outPath, global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result OpenDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.FilterItemU8.__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.Result OpenDialogMultipleN(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogMultipleU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result OpenDialogMultipleU8(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.FilterItemU8.__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.Result SaveDialogN(char** outPath, global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultName);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_SaveDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result SaveDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.FilterItemU8.__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.Result PickFolderN(char** outPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PickFolderU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PickFolderU8(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 GetError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_ClearError", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void ClearError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetCount", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PathSetGetCount(__IntPtr pathSet, uint* count);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void PathSetFreePathN([MarshalAs(UnmanagedType.LPWStr)] string filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void PathSetFreePathU8([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.Result PathSetGetEnum(__IntPtr pathSet, __IntPtr outEnumerator);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreeEnum", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void PathSetFreeEnum(__IntPtr enumerator);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PathSetEnumeratorNextN(__IntPtr enumerator, char** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.Result PathSetEnumeratorNextU8(__IntPtr enumerator, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_Free", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void PathSetFree(__IntPtr pathSet);
}
/// Free a file path that was returned by the dialogs.
/// Note: use NFD_PathSet_FreePathN() to free path from pathset instead of this function.
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void FreePathN(char* filePath)
{
__Internal.FreePathN(filePath);
}
/// Free a file path that was returned by the dialogs.
/// Note: use NFD_PathSet_FreePathU8() to free path from pathset instead of this function.
public static void FreePathU8(sbyte* filePath)
{
__Internal.FreePathU8(filePath);
}
///
/// Initialize NFD. Call this for every thread that might use NFD, before calling any other NFD
/// functions on that thread.
///
public static global::NativeFileDialogs.AutoGen.Result Init()
{
var ___ret = __Internal.Init();
return ___ret;
}
/// Call this to de-initialize NFD, if NFD_Init returned NFD_OKAY.
public static void Quit()
{
__Internal.Quit();
}
/// Single file open dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It's the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result OpenDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.OpenDialogN(outPath, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// Single file open dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
public static global::NativeFileDialogs.AutoGen.Result OpenDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.OpenDialogU8(outPath, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// Multiple file open dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeN() if this function
/// returns NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result OpenDialogMultipleN(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.OpenDialogMultipleN(outPaths, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// Multiple file open dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeU8() if this function
/// returns NFD_OKAY.
///
public static global::NativeFileDialogs.AutoGen.Result OpenDialogMultipleU8(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.OpenDialogMultipleU8(outPaths, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// Save dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result SaveDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.SaveDialogN(outPath, __arg1, filterCount, defaultPath, defaultName);
return ___ret;
}
}
/// Save dialog
/// If zero, filterList is ignored (you can use null).
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
public static global::NativeFileDialogs.AutoGen.Result SaveDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
{
Span __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.SaveDialogU8(outPath, __arg1, filterCount, defaultPath, defaultName);
return ___ret;
}
}
/// Select folder dialog
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result PickFolderN(char** outPath, string defaultPath)
{
var ___ret = __Internal.PickFolderN(outPath, defaultPath);
return ___ret;
}
/// Select folder dialog
/// If null, the operating system will decide.
///
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
public static global::NativeFileDialogs.AutoGen.Result PickFolderU8(sbyte** outPath, string defaultPath)
{
var ___ret = __Internal.PickFolderU8(outPath, defaultPath);
return ___ret;
}
/// Get the last error
/// The last error that was set, or null if there is no error.
///
/// This is set when a function returns NFD_ERROR.
/// The memory is owned by NFD and should not be freed by user code.
/// This is *always* ASCII printable characters, so it can be interpreted as UTF-8 without any
/// conversion.
///
public static string GetError()
{
var ___ret = __Internal.GetError();
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, ___ret);
}
/// Clear the error.
public static void ClearError()
{
__Internal.ClearError();
}
/// Get the number of entries stored in pathSet.
///
/// Note: some paths might be invalid (NFD_ERROR will be returned by NFD_PathSet_GetPath),
/// so we might not actually have this number of usable paths.
///
public static global::NativeFileDialogs.AutoGen.Result PathSetGetCount(__IntPtr pathSet, ref uint count)
{
fixed (uint* __count1 = &count)
{
var __arg1 = __count1;
var ___ret = __Internal.PathSetGetCount(pathSet, __arg1);
return ___ret;
}
}
/// Get the UTF-8 path at offset index.
///
/// It is the caller's responsibility to free `outPath` via NFD_PathSet_FreePathN() if this function
/// returns NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath)
{
var ___ret = __Internal.PathSetGetPathN(pathSet, index, outPath);
return ___ret;
}
/// Get the native path at offset index.
///
/// It is the caller's responsibility to free `outPath` via NFD_PathSet_FreePathU8() if this
/// function returns NFD_OKAY.
///
public static global::NativeFileDialogs.AutoGen.Result PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath)
{
var ___ret = __Internal.PathSetGetPathU8(pathSet, index, outPath);
return ___ret;
}
/// Free the path gotten by NFD_PathSet_GetPathN().
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void PathSetFreePathN(string filePath)
{
__Internal.PathSetFreePathN(filePath);
}
/// Free the path gotten by NFD_PathSet_GetPathU8().
public static void PathSetFreePathU8(string filePath)
{
__Internal.PathSetFreePathU8(filePath);
}
/// Gets an enumerator of the path set.
///
/// It is the caller's responsibility to free `enumerator` via NFD_PathSet_FreeEnum()
/// if this function returns NFD_OKAY, and it should be freed before freeing the pathset.
///
public static global::NativeFileDialogs.AutoGen.Result PathSetGetEnum(__IntPtr pathSet, global::NativeFileDialogs.AutoGen.PathSetEnumerator outEnumerator)
{
var __arg1 = outEnumerator is null ? __IntPtr.Zero : outEnumerator.__Instance;
var ___ret = __Internal.PathSetGetEnum(pathSet, __arg1);
return ___ret;
}
/// Frees an enumerator of the path set.
public static void PathSetFreeEnum(global::NativeFileDialogs.AutoGen.PathSetEnumerator enumerator)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
__Internal.PathSetFreeEnum(__arg0);
}
/// Gets the next item from the path set enumerator.
///
/// If there are no more items, then *outPaths will be set to null.
/// It is the caller's responsibility to free `*outPath` via NFD_PathSet_FreePathN()
/// if this function returns NFD_OKAY and `*outPath` is not null.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.Result PathSetEnumeratorNextN(global::NativeFileDialogs.AutoGen.PathSetEnumerator enumerator, char** outPath)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
var ___ret = __Internal.PathSetEnumeratorNextN(__arg0, outPath);
return ___ret;
}
/// Gets the next item from the path set enumerator.
///
/// If there are no more items, then *outPaths will be set to null.
/// It is the caller's responsibility to free `*outPath` via NFD_PathSet_FreePathU8()
/// if this function returns NFD_OKAY and `*outPath` is not null.
///
public static global::NativeFileDialogs.AutoGen.Result PathSetEnumeratorNextU8(global::NativeFileDialogs.AutoGen.PathSetEnumerator enumerator, sbyte** outPath)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
var ___ret = __Internal.PathSetEnumeratorNextU8(__arg0, outPath);
return ___ret;
}
/// Free the pathSet
public static void PathSetFree(__IntPtr pathSet)
{
__Internal.PathSetFree(pathSet);
}
}
}