From f4aa8e707587e0b404a9b35e552279b904c25673 Mon Sep 17 00:00:00 2001 From: Alexander Filippov Date: Sun, 17 Aug 2025 05:35:47 +0200 Subject: [PATCH] Improve namespace and assmebly names. --- Runtime/Native/NativeFunctions.cs | 4 ++-- Runtime/NativeWrappers.cs | 16 ++++++++-------- ...rp.asmdef => Shazbot.NativeFileDialog.asmdef} | 4 ++-- ...meta => Shazbot.NativeFileDialog.asmdef.meta} | 0 package.json | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) rename Runtime/{NativeFileDialogSharp.asmdef => Shazbot.NativeFileDialog.asmdef} (83%) rename Runtime/{NativeFileDialogSharp.asmdef.meta => Shazbot.NativeFileDialog.asmdef.meta} (100%) diff --git a/Runtime/Native/NativeFunctions.cs b/Runtime/Native/NativeFunctions.cs index 9b702ea..0018545 100644 --- a/Runtime/Native/NativeFunctions.cs +++ b/Runtime/Native/NativeFunctions.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace NativeFileDialogSharp.Native +namespace NativeFileDialog.Native { public struct nfdpathset_t { @@ -55,7 +55,7 @@ namespace NativeFileDialogSharp.Native [DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern unsafe void NFD_Free(IntPtr ptr); } - + public static class NativeFunctions32 { public const string LibraryName = "nfd_x86"; diff --git a/Runtime/NativeWrappers.cs b/Runtime/NativeWrappers.cs index 54f41d4..bb4fbdd 100644 --- a/Runtime/NativeWrappers.cs +++ b/Runtime/NativeWrappers.cs @@ -3,22 +3,22 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -using NativeFileDialogSharp.Native; +using NativeFileDialog.Native; -namespace NativeFileDialogSharp +namespace NativeFileDialog { public static class Dialog { private static readonly Encoder utf8encoder = Encoding.UTF8.GetEncoder(); private static readonly bool need32bit = Is32BitWindowsOnNetFramework(); - + private static bool Is32BitWindowsOnNetFramework() { try { // we call a function that does nothing just to test if we can load it properly - NativeFileDialogSharp.Native.NativeFunctions.NFD_Dummy(); + NativeFileDialog.Native.NativeFunctions.NFD_Dummy(); return false; } catch @@ -26,7 +26,7 @@ namespace NativeFileDialogSharp // a call to a default library failed, let's attempt the other one try { - NativeFileDialogSharp.Native.NativeFunctions32.NFD_Dummy(); + NativeFileDialog.Native.NativeFunctions32.NFD_Dummy(); return true; } catch @@ -78,7 +78,7 @@ namespace NativeFileDialogSharp string path = null; string errorMessage = null; IntPtr outPathIntPtr; - var result = need32bit + var result = need32bit ? NativeFunctions32.NFD_OpenDialog(filterListNts, defaultPathNts, out outPathIntPtr) : NativeFunctions.NFD_OpenDialog(filterListNts, defaultPathNts, out outPathIntPtr); if (result == nfdresult_t.NFD_ERROR) @@ -104,8 +104,8 @@ namespace NativeFileDialogSharp string path = null; string errorMessage = null; IntPtr outPathIntPtr; - var result = need32bit - ? NativeFunctions32.NFD_SaveDialog(filterListNts, defaultPathNts, out outPathIntPtr) + var result = need32bit + ? NativeFunctions32.NFD_SaveDialog(filterListNts, defaultPathNts, out outPathIntPtr) : NativeFunctions.NFD_SaveDialog(filterListNts, defaultPathNts, out outPathIntPtr); if (result == nfdresult_t.NFD_ERROR) { diff --git a/Runtime/NativeFileDialogSharp.asmdef b/Runtime/Shazbot.NativeFileDialog.asmdef similarity index 83% rename from Runtime/NativeFileDialogSharp.asmdef rename to Runtime/Shazbot.NativeFileDialog.asmdef index 5e17121..cb2c836 100644 --- a/Runtime/NativeFileDialogSharp.asmdef +++ b/Runtime/Shazbot.NativeFileDialog.asmdef @@ -1,6 +1,6 @@ { - "name": "NativeFileDialogSharp", - "rootNamespace": "NativeFileDialogSharp", + "name": "Shazbot.NativeFileDialog", + "rootNamespace": "NativeFileDialog", "references": [], "includePlatforms": [ "Editor", diff --git a/Runtime/NativeFileDialogSharp.asmdef.meta b/Runtime/Shazbot.NativeFileDialog.asmdef.meta similarity index 100% rename from Runtime/NativeFileDialogSharp.asmdef.meta rename to Runtime/Shazbot.NativeFileDialog.asmdef.meta diff --git a/package.json b/package.json index 5f1c353..8c0c58d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ru.shazbot.nativefiledialog", - "version": "1.0.0", + "version": "1.0.1", "displayName": "Native File Dialog", "description": "Based on https://github.com/milleniumbug/NativeFileDialogSharp", "licensesUrl": "https://git.well-placed.de/InnoLab/NativeFileDialogPackage/src/LICENSE.md",