From 63afade403a605a2dc0e209c5f60b4d629d3749a Mon Sep 17 00:00:00 2001
From: Jeremy Pritts <49847914+ds5678@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:26:59 -0500
Subject: [PATCH] Rename during CppSharp generation
---
.../Program.cs | 18 +-
.../Program.cs | 24 +-
.../Program.cs | 12 +-
.../Program.cs | 18 +-
NativeFileDialogs.AutoGen/nfd.cs | 308 +++++++++---------
.../NativeFileDialogsLibrary.cs | 49 ++-
NativeFileDialogs.Net/Nfd.cs | 28 +-
NativeFileDialogs.Net/NfdException.cs | 2 +-
NativeFileDialogs.Net/NfdManager.cs | 4 +-
...sultTExtensions.cs => ResultExtensions.cs} | 8 +-
10 files changed, 259 insertions(+), 212 deletions(-)
rename NativeFileDialogs.Net/{NfdresultTExtensions.cs => ResultExtensions.cs} (61%)
diff --git a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialog/Program.cs b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialog/Program.cs
index 097ec9f..68cdec6 100644
--- a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialog/Program.cs
+++ b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialog/Program.cs
@@ -7,16 +7,16 @@ using NativeFileDialogs.AutoGen;
unsafe
{
- nfd.NFD_Init();
+ nfd.Init();
- Nfdu8filteritemT[] filterItem = new[]
+ FilterItemU8[] filterItem = new[]
{
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Source code",
Spec = "c,cpp,cc",
},
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Headers",
Spec = "h,hpp",
@@ -24,20 +24,20 @@ unsafe
};
sbyte* outPathPtr;
- NfdresultT result = nfd.NFD_OpenDialogU8(&outPathPtr, filterItem, (uint)filterItem.Length, null);
+ Result result = nfd.OpenDialogU8(&outPathPtr, filterItem, (uint)filterItem.Length, null);
switch (result)
{
- case NfdresultT.NFD_OKAY:
+ case Result.Okay:
Console.WriteLine("Success!");
Console.WriteLine(new string(outPathPtr));
break;
- case NfdresultT.NFD_CANCEL:
+ case Result.Cancel:
Console.WriteLine("User pressed Cancel.");
break;
default:
- Console.WriteLine($"Error: {nfd.NFD_GetError()}");
+ Console.WriteLine($"Error: {nfd.GetError()}");
break;
}
- nfd.NFD_Quit();
+ nfd.Quit();
}
diff --git a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialogMultiple/Program.cs b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialogMultiple/Program.cs
index 40dc1ea..22dda13 100644
--- a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialogMultiple/Program.cs
+++ b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.OpenDialogMultiple/Program.cs
@@ -7,16 +7,16 @@ using NativeFileDialogs.AutoGen;
unsafe
{
- nfd.NFD_Init();
+ nfd.Init();
- Nfdu8filteritemT[] filterItems = new[]
+ FilterItemU8[] filterItems = new[]
{
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Source code",
Spec = "c,cpp,cc",
},
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Headers",
Spec = "h,hpp",
@@ -24,34 +24,34 @@ unsafe
};
IntPtr pathSet;
- NfdresultT result = nfd.NFD_OpenDialogMultipleU8(&pathSet, filterItems, (uint)filterItems.Length, null);
+ Result result = nfd.OpenDialogMultipleU8(&pathSet, filterItems, (uint)filterItems.Length, null);
switch (result)
{
- case NfdresultT.NFD_OKAY:
+ case Result.Okay:
Console.WriteLine("Success!");
uint count = 0;
- nfd.NFD_PathSetGetCount(pathSet, ref count);
+ nfd.PathSetGetCount(pathSet, ref count);
string[] outPaths = new string[count];
for (uint i = 0; i < count; i++)
{
sbyte* pathPtr;
- nfd.NFD_PathSetGetPathU8(pathSet, i, &pathPtr);
+ nfd.PathSetGetPathU8(pathSet, i, &pathPtr);
outPaths[i] = new string(pathPtr);
}
- nfd.NFD_PathSetFree(pathSet);
+ nfd.PathSetFree(pathSet);
foreach (string path in outPaths)
Console.WriteLine($"- {path}");
break;
- case NfdresultT.NFD_CANCEL:
+ case Result.Cancel:
Console.WriteLine("User pressed Cancel.");
break;
default:
- Console.WriteLine($"Error: {nfd.NFD_GetError()}");
+ Console.WriteLine($"Error: {nfd.GetError()}");
break;
}
- nfd.NFD_Quit();
+ nfd.Quit();
}
diff --git a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.PickFolder/Program.cs b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.PickFolder/Program.cs
index 7a928ac..23c7ddb 100644
--- a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.PickFolder/Program.cs
+++ b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.PickFolder/Program.cs
@@ -7,23 +7,23 @@ using NativeFileDialogs.AutoGen;
unsafe
{
- nfd.NFD_Init();
+ nfd.Init();
sbyte* outPathPtr;
- NfdresultT result = nfd.NFD_PickFolderU8(&outPathPtr, null);
+ Result result = nfd.PickFolderU8(&outPathPtr, null);
switch (result)
{
- case NfdresultT.NFD_OKAY:
+ case Result.Okay:
Console.WriteLine("Success!");
Console.WriteLine(new string(outPathPtr));
break;
- case NfdresultT.NFD_CANCEL:
+ case Result.Cancel:
Console.WriteLine("User pressed Cancel.");
break;
default:
- Console.WriteLine($"Error: {nfd.NFD_GetError()}");
+ Console.WriteLine($"Error: {nfd.GetError()}");
break;
}
- nfd.NFD_Quit();
+ nfd.Quit();
}
diff --git a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.SaveDialog/Program.cs b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.SaveDialog/Program.cs
index e5840e0..d199a8a 100644
--- a/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.SaveDialog/Program.cs
+++ b/Examples/AutoGen/NativeFileDialogs.AutoGen.Example.SaveDialog/Program.cs
@@ -7,16 +7,16 @@ using NativeFileDialogs.AutoGen;
unsafe
{
- nfd.NFD_Init();
+ nfd.Init();
- Nfdu8filteritemT[] filterItem = new[]
+ FilterItemU8[] filterItem = new[]
{
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Source code",
Spec = "c,cpp,cc",
},
- new Nfdu8filteritemT
+ new FilterItemU8
{
Name = "Headers",
Spec = "h,hpp",
@@ -24,20 +24,20 @@ unsafe
};
sbyte* savePathPtr;
- NfdresultT result = nfd.NFD_SaveDialogU8(&savePathPtr, filterItem, (uint)filterItem.Length, null, "Untitled.c");
+ Result result = nfd.SaveDialogU8(&savePathPtr, filterItem, (uint)filterItem.Length, null, "Untitled.c");
switch (result)
{
- case NfdresultT.NFD_OKAY:
+ case Result.Okay:
Console.WriteLine("Success!");
Console.WriteLine(new string(savePathPtr));
break;
- case NfdresultT.NFD_CANCEL:
+ case Result.Cancel:
Console.WriteLine("User pressed Cancel.");
break;
default:
- Console.WriteLine($"Error: {nfd.NFD_GetError()}");
+ Console.WriteLine($"Error: {nfd.GetError()}");
break;
}
- nfd.NFD_Quit();
+ nfd.Quit();
}
diff --git a/NativeFileDialogs.AutoGen/nfd.cs b/NativeFileDialogs.AutoGen/nfd.cs
index 58ec745..eb041ff 100644
--- a/NativeFileDialogs.AutoGen/nfd.cs
+++ b/NativeFileDialogs.AutoGen/nfd.cs
@@ -14,17 +14,17 @@ using __IntPtr = global::System.IntPtr;
namespace NativeFileDialogs.AutoGen
{
- public enum NfdresultT
+ public enum Result
{
/// Programmatic error
- NFD_ERROR = 0,
+ Error = 0,
/// User pressed okay, or successful return
- NFD_OKAY = 1,
+ Okay = 1,
/// User pressed cancel
- NFD_CANCEL = 2
+ Cancel = 2
}
- public unsafe partial class NfdpathsetenumT : IDisposable
+ public unsafe partial class PathSetEnumerator : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
public partial struct __Internal
@@ -37,15 +37,15 @@ namespace NativeFileDialogs.AutoGen
public __IntPtr __Instance { get; protected set; }
- internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
- new global::System.Collections.Concurrent.ConcurrentDictionary();
+ 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.NfdpathsetenumT managed)
+ internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.PathSetEnumerator managed)
{
NativeToManagedMap[native] = managed;
}
- internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.NfdpathsetenumT managed)
+ internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.PathSetEnumerator managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
@@ -53,28 +53,28 @@ namespace NativeFileDialogs.AutoGen
protected bool __ownsNativeInstance;
- internal static NfdpathsetenumT __CreateInstance(__IntPtr native, bool skipVTables = false)
+ internal static PathSetEnumerator __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
- return new NfdpathsetenumT(native.ToPointer(), skipVTables);
+ return new PathSetEnumerator(native.ToPointer(), skipVTables);
}
- internal static NfdpathsetenumT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
+ 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 (NfdpathsetenumT)managed;
+ return (PathSetEnumerator)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
- internal static NfdpathsetenumT __CreateInstance(__Internal native, bool skipVTables = false)
+ internal static PathSetEnumerator __CreateInstance(__Internal native, bool skipVTables = false)
{
- return new NfdpathsetenumT(native, skipVTables);
+ return new PathSetEnumerator(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
@@ -84,33 +84,33 @@ namespace NativeFileDialogs.AutoGen
return ret.ToPointer();
}
- private NfdpathsetenumT(__Internal native, bool skipVTables = false)
+ private PathSetEnumerator(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- protected NfdpathsetenumT(void* native, bool skipVTables = false)
+ protected PathSetEnumerator(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
- public NfdpathsetenumT()
+ public PathSetEnumerator()
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- public NfdpathsetenumT(global::NativeFileDialogs.AutoGen.NfdpathsetenumT _0)
+ public PathSetEnumerator(global::NativeFileDialogs.AutoGen.PathSetEnumerator _0)
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
- *((global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdpathsetenumT.__Internal*) _0.__Instance);
+ *((global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.PathSetEnumerator.__Internal*) _0.__Instance);
}
public void Dispose()
@@ -145,7 +145,7 @@ namespace NativeFileDialogs.AutoGen
}
}
- public unsafe partial class Nfdu8filteritemT : IDisposable
+ public unsafe partial class FilterItemU8 : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
@@ -159,15 +159,15 @@ namespace NativeFileDialogs.AutoGen
public __IntPtr __Instance { get; protected set; }
- internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
- new global::System.Collections.Concurrent.ConcurrentDictionary();
+ 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.Nfdu8filteritemT managed)
+ internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.FilterItemU8 managed)
{
NativeToManagedMap[native] = managed;
}
- internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.Nfdu8filteritemT managed)
+ internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.FilterItemU8 managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
@@ -177,28 +177,28 @@ namespace NativeFileDialogs.AutoGen
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
- internal static Nfdu8filteritemT __CreateInstance(__IntPtr native, bool skipVTables = false)
+ internal static FilterItemU8 __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
- return new Nfdu8filteritemT(native.ToPointer(), skipVTables);
+ return new FilterItemU8(native.ToPointer(), skipVTables);
}
- internal static Nfdu8filteritemT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
+ 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 (Nfdu8filteritemT)managed;
+ return (FilterItemU8)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
- internal static Nfdu8filteritemT __CreateInstance(__Internal native, bool skipVTables = false)
+ internal static FilterItemU8 __CreateInstance(__Internal native, bool skipVTables = false)
{
- return new Nfdu8filteritemT(native, skipVTables);
+ return new FilterItemU8(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
@@ -208,33 +208,33 @@ namespace NativeFileDialogs.AutoGen
return ret.ToPointer();
}
- private Nfdu8filteritemT(__Internal native, bool skipVTables = false)
+ private FilterItemU8(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- protected Nfdu8filteritemT(void* native, bool skipVTables = false)
+ protected FilterItemU8(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
- public Nfdu8filteritemT()
+ public FilterItemU8()
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- public Nfdu8filteritemT(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT _0)
+ public FilterItemU8(global::NativeFileDialogs.AutoGen.FilterItemU8 _0)
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
- *((global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) _0.__Instance);
+ *((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)
@@ -315,7 +315,7 @@ namespace NativeFileDialogs.AutoGen
}
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public unsafe partial class NfdnfilteritemT : IDisposable
+ public unsafe partial class FilterItemN : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
@@ -329,15 +329,15 @@ namespace NativeFileDialogs.AutoGen
public __IntPtr __Instance { get; protected set; }
- internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap =
- new global::System.Collections.Concurrent.ConcurrentDictionary();
+ 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.NfdnfilteritemT managed)
+ internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.FilterItemN managed)
{
NativeToManagedMap[native] = managed;
}
- internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.NfdnfilteritemT managed)
+ internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.FilterItemN managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
@@ -347,28 +347,28 @@ namespace NativeFileDialogs.AutoGen
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
- internal static NfdnfilteritemT __CreateInstance(__IntPtr native, bool skipVTables = false)
+ internal static FilterItemN __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
- return new NfdnfilteritemT(native.ToPointer(), skipVTables);
+ return new FilterItemN(native.ToPointer(), skipVTables);
}
- internal static NfdnfilteritemT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
+ 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 (NfdnfilteritemT)managed;
+ return (FilterItemN)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
- internal static NfdnfilteritemT __CreateInstance(__Internal native, bool skipVTables = false)
+ internal static FilterItemN __CreateInstance(__Internal native, bool skipVTables = false)
{
- return new NfdnfilteritemT(native, skipVTables);
+ return new FilterItemN(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
@@ -378,33 +378,33 @@ namespace NativeFileDialogs.AutoGen
return ret.ToPointer();
}
- private NfdnfilteritemT(__Internal native, bool skipVTables = false)
+ private FilterItemN(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- protected NfdnfilteritemT(void* native, bool skipVTables = false)
+ protected FilterItemN(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
- public NfdnfilteritemT()
+ public FilterItemN()
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
- public NfdnfilteritemT(global::NativeFileDialogs.AutoGen.NfdnfilteritemT _0)
+ public FilterItemN(global::NativeFileDialogs.AutoGen.FilterItemN _0)
{
- __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
+ __Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
- *((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) _0.__Instance);
+ *((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)
@@ -483,107 +483,107 @@ namespace NativeFileDialogs.AutoGen
public partial struct __Internal
{
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern void NFD_FreePathN(char* filePath);
+ internal static extern void FreePathN(char* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern void NFD_FreePathU8(sbyte* filePath);
+ internal static extern void FreePathU8(sbyte* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Init", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_Init();
+ internal static extern global::NativeFileDialogs.AutoGen.Result Init();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Quit", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern void NFD_Quit();
+ internal static extern void Quit();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogN", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(char** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
+ 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.NfdresultT NFD_OpenDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
+ 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.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
+ 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.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
+ 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.NfdresultT NFD_SaveDialogN(char** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultName);
+ 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.NfdresultT NFD_SaveDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultName);
+ 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.NfdresultT NFD_PickFolderN(char** outPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
+ 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.NfdresultT NFD_PickFolderU8(sbyte** outPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
+ 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 NFD_GetError();
+ internal static extern __IntPtr GetError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_ClearError", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern void NFD_ClearError();
+ internal static extern void ClearError();
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetCount", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetCount(__IntPtr pathSet, uint* count);
+ 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.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath);
+ 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.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath);
+ 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 NFD_PathSetFreePathN([MarshalAs(UnmanagedType.LPWStr)] string filePath);
+ internal static extern void PathSetFreePathN([MarshalAs(UnmanagedType.LPWStr)] string filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern void NFD_PathSetFreePathU8([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string filePath);
+ 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.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, __IntPtr outEnumerator);
+ 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 NFD_PathSetFreeEnum(__IntPtr enumerator);
+ internal static extern void PathSetFreeEnum(__IntPtr enumerator);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextN", CallingConvention = __CallingConvention.Cdecl)]
- internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(__IntPtr enumerator, char** outPath);
+ 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.NfdresultT NFD_PathSetEnumNextU8(__IntPtr enumerator, sbyte** outPath);
+ 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 NFD_PathSetFree(__IntPtr pathSet);
+ 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 NFD_FreePathN(char* filePath)
+ public static void FreePathN(char* filePath)
{
- __Internal.NFD_FreePathN(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 NFD_FreePathU8(sbyte* filePath)
+ public static void FreePathU8(sbyte* filePath)
{
- __Internal.NFD_FreePathU8(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.NfdresultT NFD_Init()
+ public static global::NativeFileDialogs.AutoGen.Result Init()
{
- var ___ret = __Internal.NFD_Init();
+ var ___ret = __Internal.Init();
return ___ret;
}
/// Call this to de-initialize NFD, if NFD_Init returned NFD_OKAY.
- public static void NFD_Quit()
+ public static void Quit()
{
- __Internal.NFD_Quit();
+ __Internal.Quit();
}
/// Single file open dialog
@@ -594,24 +594,24 @@ namespace NativeFileDialogs.AutoGen
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result OpenDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
+ __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.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_OpenDialogN(outPath, __arg1, filterCount, defaultPath);
+ var ___ret = __Internal.OpenDialogN(outPath, __arg1, filterCount, defaultPath);
return ___ret;
}
}
@@ -623,24 +623,24 @@ namespace NativeFileDialogs.AutoGen
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result OpenDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
+ __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.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_OpenDialogU8(outPath, __arg1, filterCount, defaultPath);
+ var ___ret = __Internal.OpenDialogU8(outPath, __arg1, filterCount, defaultPath);
return ___ret;
}
}
@@ -653,24 +653,24 @@ namespace NativeFileDialogs.AutoGen
/// returns NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result OpenDialogMultipleN(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
+ __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.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_OpenDialogMultipleN(outPaths, __arg1, filterCount, defaultPath);
+ var ___ret = __Internal.OpenDialogMultipleN(outPaths, __arg1, filterCount, defaultPath);
return ___ret;
}
}
@@ -682,24 +682,24 @@ namespace NativeFileDialogs.AutoGen
/// It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeU8() if this function
/// returns NFD_OKAY.
///
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result OpenDialogMultipleU8(__IntPtr* outPaths, Span filterList, uint filterCount, string defaultPath)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
+ __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.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_OpenDialogMultipleU8(outPaths, __arg1, filterCount, defaultPath);
+ var ___ret = __Internal.OpenDialogMultipleU8(outPaths, __arg1, filterCount, defaultPath);
return ___ret;
}
}
@@ -712,24 +712,24 @@ namespace NativeFileDialogs.AutoGen
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
+ public static global::NativeFileDialogs.AutoGen.Result SaveDialogN(char** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal[filterList.Length];
+ __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.NfdnfilteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemN.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemN.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemN.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_SaveDialogN(outPath, __arg1, filterCount, defaultPath, defaultName);
+ var ___ret = __Internal.SaveDialogN(outPath, __arg1, filterCount, defaultPath, defaultName);
return ___ret;
}
}
@@ -741,24 +741,24 @@ namespace NativeFileDialogs.AutoGen
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
+ public static global::NativeFileDialogs.AutoGen.Result SaveDialogU8(sbyte** outPath, Span filterList, uint filterCount, string defaultPath, string defaultName)
{
- Span __filterList;
+ Span __filterList;
if (filterList == null)
__filterList = null;
else
{
- __filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
+ __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.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
+ __filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal() : *(global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal*) __element.__Instance;
}
}
- fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
+ fixed (global::NativeFileDialogs.AutoGen.FilterItemU8.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
- var ___ret = __Internal.NFD_SaveDialogU8(outPath, __arg1, filterCount, defaultPath, defaultName);
+ var ___ret = __Internal.SaveDialogU8(outPath, __arg1, filterCount, defaultPath, defaultName);
return ___ret;
}
}
@@ -770,9 +770,9 @@ namespace NativeFileDialogs.AutoGen
/// NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderN(char** outPath, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result PickFolderN(char** outPath, string defaultPath)
{
- var ___ret = __Internal.NFD_PickFolderN(outPath, defaultPath);
+ var ___ret = __Internal.PickFolderN(outPath, defaultPath);
return ___ret;
}
@@ -782,9 +782,9 @@ namespace NativeFileDialogs.AutoGen
/// It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
/// returns NFD_OKAY.
///
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderU8(sbyte** outPath, string defaultPath)
+ public static global::NativeFileDialogs.AutoGen.Result PickFolderU8(sbyte** outPath, string defaultPath)
{
- var ___ret = __Internal.NFD_PickFolderU8(outPath, defaultPath);
+ var ___ret = __Internal.PickFolderU8(outPath, defaultPath);
return ___ret;
}
@@ -796,16 +796,16 @@ namespace NativeFileDialogs.AutoGen
/// This is *always* ASCII printable characters, so it can be interpreted as UTF-8 without any
/// conversion.
///
- public static string NFD_GetError()
+ public static string GetError()
{
- var ___ret = __Internal.NFD_GetError();
+ var ___ret = __Internal.GetError();
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, ___ret);
}
/// Clear the error.
- public static void NFD_ClearError()
+ public static void ClearError()
{
- __Internal.NFD_ClearError();
+ __Internal.ClearError();
}
/// Get the number of entries stored in pathSet.
@@ -813,12 +813,12 @@ namespace NativeFileDialogs.AutoGen
/// 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.NfdresultT NFD_PathSetGetCount(__IntPtr pathSet, ref uint count)
+ public static global::NativeFileDialogs.AutoGen.Result PathSetGetCount(__IntPtr pathSet, ref uint count)
{
fixed (uint* __count1 = &count)
{
var __arg1 = __count1;
- var ___ret = __Internal.NFD_PathSetGetCount(pathSet, __arg1);
+ var ___ret = __Internal.PathSetGetCount(pathSet, __arg1);
return ___ret;
}
}
@@ -829,9 +829,9 @@ namespace NativeFileDialogs.AutoGen
/// returns NFD_OKAY.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath)
+ public static global::NativeFileDialogs.AutoGen.Result PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath)
{
- var ___ret = __Internal.NFD_PathSetGetPathN(pathSet, index, outPath);
+ var ___ret = __Internal.PathSetGetPathN(pathSet, index, outPath);
return ___ret;
}
@@ -840,23 +840,23 @@ namespace NativeFileDialogs.AutoGen
/// It is the caller's responsibility to free `outPath` via NFD_PathSet_FreePathU8() if this
/// function returns NFD_OKAY.
///
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath)
+ public static global::NativeFileDialogs.AutoGen.Result PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath)
{
- var ___ret = __Internal.NFD_PathSetGetPathU8(pathSet, index, 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 NFD_PathSetFreePathN(string filePath)
+ public static void PathSetFreePathN(string filePath)
{
- __Internal.NFD_PathSetFreePathN(filePath);
+ __Internal.PathSetFreePathN(filePath);
}
/// Free the path gotten by NFD_PathSet_GetPathU8().
- public static void NFD_PathSetFreePathU8(string filePath)
+ public static void PathSetFreePathU8(string filePath)
{
- __Internal.NFD_PathSetFreePathU8(filePath);
+ __Internal.PathSetFreePathU8(filePath);
}
/// Gets an enumerator of the path set.
@@ -864,18 +864,18 @@ namespace NativeFileDialogs.AutoGen
/// 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.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, global::NativeFileDialogs.AutoGen.NfdpathsetenumT outEnumerator)
+ 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.NFD_PathSetGetEnum(pathSet, __arg1);
+ var ___ret = __Internal.PathSetGetEnum(pathSet, __arg1);
return ___ret;
}
/// Frees an enumerator of the path set.
- public static void NFD_PathSetFreeEnum(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator)
+ public static void PathSetFreeEnum(global::NativeFileDialogs.AutoGen.PathSetEnumerator enumerator)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
- __Internal.NFD_PathSetFreeEnum(__arg0);
+ __Internal.PathSetFreeEnum(__arg0);
}
/// Gets the next item from the path set enumerator.
@@ -885,10 +885,10 @@ namespace NativeFileDialogs.AutoGen
/// if this function returns NFD_OKAY and `*outPath` is not null.
///
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
- public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator, char** outPath)
+ 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.NFD_PathSetEnumNextN(__arg0, outPath);
+ var ___ret = __Internal.PathSetEnumeratorNextN(__arg0, outPath);
return ___ret;
}
@@ -898,17 +898,17 @@ namespace NativeFileDialogs.AutoGen
/// 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.NfdresultT NFD_PathSetEnumNextU8(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator, sbyte** outPath)
+ 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.NFD_PathSetEnumNextU8(__arg0, outPath);
+ var ___ret = __Internal.PathSetEnumeratorNextU8(__arg0, outPath);
return ___ret;
}
/// Free the pathSet
- public static void NFD_PathSetFree(__IntPtr pathSet)
+ public static void PathSetFree(__IntPtr pathSet)
{
- __Internal.NFD_PathSetFree(pathSet);
+ __Internal.PathSetFree(pathSet);
}
}
}
diff --git a/NativeFileDialogs.CppSharpGenerator/NativeFileDialogsLibrary.cs b/NativeFileDialogs.CppSharpGenerator/NativeFileDialogsLibrary.cs
index 646145e..9d53179 100644
--- a/NativeFileDialogs.CppSharpGenerator/NativeFileDialogsLibrary.cs
+++ b/NativeFileDialogs.CppSharpGenerator/NativeFileDialogsLibrary.cs
@@ -7,9 +7,11 @@ using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Passes;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
+using System.Text.RegularExpressions;
namespace NativeFileDialogs.CppSharpGenerator;
@@ -41,7 +43,18 @@ public class NativeFileDialogsLibrary : ILibrary
public void SetupPasses(Driver driver)
{
+ driver.Context.TranslationUnitPasses.RemovePrefix("NFD_");
+ driver.Context.TranslationUnitPasses.RemovePrefix("nfd");
+
driver.Context.TranslationUnitPasses.RenameDeclsUpperCase(RenameTargets.Any);
+
+ driver.Context.TranslationUnitPasses.AddPass(new RegexRenamePass("^([A-Z]+)$", m => m.Value.ToLowerInvariant(), RenameTargets.EnumItem));
+
+ driver.Context.TranslationUnitPasses.RenameWithPattern("T$", "", RenameTargets.Enum | RenameTargets.Class);
+
+ driver.Context.TranslationUnitPasses.RenameWithPattern("^(.+)filteritem$", "FilterItem$1", RenameTargets.Enum | RenameTargets.Class);
+
+ driver.Context.TranslationUnitPasses.RenameWithPattern("(Pathsetenum)|(PathSetEnum)", "PathSetEnumerator", RenameTargets.Any);
}
public void Preprocess(Driver driver, ASTContext ctx)
@@ -54,7 +67,7 @@ public class NativeFileDialogsLibrary : ILibrary
{
AddWindowsOnlyAttribute(function);
}
- AddWindowsOnlyAttribute(ctx.FindClass("NfdnfilteritemT").First());
+ AddWindowsOnlyAttribute(ctx.FindClass("FilterItemN").First());
}
public void GenerateCode(Driver driver, List outputs)
@@ -65,4 +78,38 @@ public class NativeFileDialogsLibrary : ILibrary
{
declaration.Attributes.Add(new Attribute() { Type = typeof(SupportedOSPlatformAttribute), Value = "\"windows\"" });
}
+
+ private class RegexRenamePass : RenamePass
+ {
+ public string Pattern { get; }
+
+ public MatchEvaluator MatchEvaluator { get; }
+
+ public RegexRenamePass([StringSyntax("regex")] string pattern, MatchEvaluator matchEvaluator, RenameTargets targets = RenameTargets.Any)
+ {
+ Pattern = pattern;
+ MatchEvaluator = matchEvaluator;
+ Targets = targets;
+ }
+
+ public override bool Rename(Declaration decl, [NotNullWhen(true)] out string? newName)
+ {
+ if (base.Rename(decl, out newName))
+ {
+ return true;
+ }
+
+ string text = Regex.Replace(decl.Name, Pattern, MatchEvaluator);
+ if (!decl.Name.Equals(text, System.StringComparison.Ordinal))
+ {
+ newName = text;
+ return true;
+ }
+
+ newName = null;
+ return false;
+ }
+
+ public override string ToString() => "RegexRenamePass: " + Pattern;
+ }
}
diff --git a/NativeFileDialogs.Net/Nfd.cs b/NativeFileDialogs.Net/Nfd.cs
index b78b34b..08d8a64 100644
--- a/NativeFileDialogs.Net/Nfd.cs
+++ b/NativeFileDialogs.Net/Nfd.cs
@@ -15,13 +15,13 @@ public static class Nfd
public static NfdStatus OpenDialog(out string? outPath, IDictionary? filters = null, string? defaultPath = null)
{
manager.PushDialog();
- Nfdu8filteritemT[] filterItems = ToFilterItems(filters);
+ FilterItemU8[] filterItems = ToFilterItems(filters);
NfdStatus status;
unsafe
{
sbyte* outPathPtr;
- status = nfd.NFD_OpenDialogU8(&outPathPtr, filterItems, (uint)filterItems.Length, defaultPath).ToNfdStatus();
+ status = nfd.OpenDialogU8(&outPathPtr, filterItems, (uint)filterItems.Length, defaultPath).ToNfdStatus();
outPath = status == NfdStatus.Cancelled ? null : new string(outPathPtr);
}
@@ -32,28 +32,28 @@ public static class Nfd
public static NfdStatus OpenDialogMultiple(out string[]? outPaths, IDictionary? filters = null, string? defaultPath = null)
{
manager.PushDialog();
- Nfdu8filteritemT[] filterItems = ToFilterItems(filters);
+ FilterItemU8[] filterItems = ToFilterItems(filters);
NfdStatus status;
unsafe
{
IntPtr pathSet;
- status = nfd.NFD_OpenDialogMultipleU8(&pathSet, filterItems, (uint)filterItems.Length, defaultPath).ToNfdStatus();
+ status = nfd.OpenDialogMultipleU8(&pathSet, filterItems, (uint)filterItems.Length, defaultPath).ToNfdStatus();
if (status == NfdStatus.Ok)
{
uint count = 0;
- nfd.NFD_PathSetGetCount(pathSet, ref count).ToNfdStatus();
+ nfd.PathSetGetCount(pathSet, ref count).ToNfdStatus();
outPaths = new string[count];
for (uint i = 0; i < count; i++)
{
sbyte* pathPtr;
- nfd.NFD_PathSetGetPathU8(pathSet, i, &pathPtr);
+ nfd.PathSetGetPathU8(pathSet, i, &pathPtr);
outPaths[i] = new string(pathPtr);
}
- nfd.NFD_PathSetFree(pathSet);
+ nfd.PathSetFree(pathSet);
}
else
{
@@ -73,7 +73,7 @@ public static class Nfd
unsafe
{
sbyte* outPathPtr;
- status = nfd.NFD_PickFolderU8(&outPathPtr, defaultPath).ToNfdStatus();
+ status = nfd.PickFolderU8(&outPathPtr, defaultPath).ToNfdStatus();
outPath = status == NfdStatus.Cancelled ? null : new string(outPathPtr);
}
@@ -84,13 +84,13 @@ public static class Nfd
public static NfdStatus SaveDialog(out string? savePath, IDictionary? filters = null, string defaultName = "Untitled", string? defaultPath = null)
{
manager.PushDialog();
- Nfdu8filteritemT[] filterItems = ToFilterItems(filters);
+ FilterItemU8[] filterItems = ToFilterItems(filters);
NfdStatus status;
unsafe
{
sbyte* savePathPtr;
- status = nfd.NFD_SaveDialogU8(&savePathPtr, filterItems, (uint)filterItems.Length, defaultPath, defaultName).ToNfdStatus();
+ status = nfd.SaveDialogU8(&savePathPtr, filterItems, (uint)filterItems.Length, defaultPath, defaultName).ToNfdStatus();
savePath = status == NfdStatus.Cancelled ? null : new string(savePathPtr);
}
@@ -98,16 +98,16 @@ public static class Nfd
return status;
}
- internal static Nfdu8filteritemT[] ToFilterItems(IDictionary? filters)
+ internal static FilterItemU8[] ToFilterItems(IDictionary? filters)
{
if (filters == null)
- return Array.Empty();
+ return Array.Empty();
- Nfdu8filteritemT[] filterItems = new Nfdu8filteritemT[filters.Count];
+ FilterItemU8[] filterItems = new FilterItemU8[filters.Count];
int i = 0;
foreach ((string key, string value) in filters)
{
- filterItems[i++] = new Nfdu8filteritemT
+ filterItems[i++] = new FilterItemU8
{
Name = key,
Spec = value,
diff --git a/NativeFileDialogs.Net/NfdException.cs b/NativeFileDialogs.Net/NfdException.cs
index 9d68e31..7a939f5 100644
--- a/NativeFileDialogs.Net/NfdException.cs
+++ b/NativeFileDialogs.Net/NfdException.cs
@@ -9,5 +9,5 @@ namespace NativeFileDialogs.Net;
public class NfdException : Exception
{
- public NfdException() : base(nfd.NFD_GetError()) { }
+ public NfdException() : base(nfd.GetError()) { }
}
diff --git a/NativeFileDialogs.Net/NfdManager.cs b/NativeFileDialogs.Net/NfdManager.cs
index 52ff348..e33e0db 100644
--- a/NativeFileDialogs.Net/NfdManager.cs
+++ b/NativeFileDialogs.Net/NfdManager.cs
@@ -16,7 +16,7 @@ internal class NfdManager
{
NfdStatus status = NfdStatus.Ok;
if (counter == 0)
- status = nfd.NFD_Init().ToNfdStatus();
+ status = nfd.Init().ToNfdStatus();
counter++;
return status;
@@ -32,7 +32,7 @@ internal class NfdManager
counter--;
if (counter == 0)
- nfd.NFD_Quit();
+ nfd.Quit();
return NfdStatus.Ok;
}
diff --git a/NativeFileDialogs.Net/NfdresultTExtensions.cs b/NativeFileDialogs.Net/ResultExtensions.cs
similarity index 61%
rename from NativeFileDialogs.Net/NfdresultTExtensions.cs
rename to NativeFileDialogs.Net/ResultExtensions.cs
index b0c9272..be0d239 100644
--- a/NativeFileDialogs.Net/NfdresultTExtensions.cs
+++ b/NativeFileDialogs.Net/ResultExtensions.cs
@@ -6,14 +6,14 @@ using NativeFileDialogs.AutoGen;
namespace NativeFileDialogs.Net;
-internal static class NfdresultTExtensions
+internal static class ResultExtensions
{
- public static NfdStatus ToNfdStatus(this NfdresultT result)
+ public static NfdStatus ToNfdStatus(this Result result)
{
return result switch
{
- NfdresultT.NFD_OKAY => NfdStatus.Ok,
- NfdresultT.NFD_CANCEL => NfdStatus.Cancelled,
+ Result.Okay => NfdStatus.Ok,
+ Result.Cancel => NfdStatus.Cancelled,
_ => throw new NfdException(),
};
}