diff --git a/Photino.NET/PhotinoDllImports.cs b/Photino.NET/PhotinoDllImports.cs index a1429ec..b747419 100644 --- a/Photino.NET/PhotinoDllImports.cs +++ b/Photino.NET/PhotinoDllImports.cs @@ -330,7 +330,7 @@ public partial class PhotinoWindow [LibraryImport(DLL_NAME, SetLastError = true, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })] - public static partial IntPtr Photino_ShowSaveFile(IntPtr inst, string title, string defaultPath, string[] filters, int filtersCount); + public static partial IntPtr Photino_ShowSaveFile(IntPtr inst, string title, string defaultPath, string defaultFileName, string[] filters, int filtersCount); [LibraryImport(DLL_NAME, SetLastError = true, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })] @@ -343,7 +343,7 @@ public partial class PhotinoWindow public static extern IntPtr Photino_ShowOpenFolder(IntPtr inst, [MarshalAs(UnmanagedType.LPUTF8Str)] string title, [MarshalAs(UnmanagedType.LPUTF8Str)] string defaultPath, bool multiSelect, out int resultCount); [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl, SetLastError = true, CharSet = CharSet.Ansi)] - public static extern IntPtr Photino_ShowSaveFile(IntPtr inst, [MarshalAs(UnmanagedType.LPUTF8Str)] string title, [MarshalAs(UnmanagedType.LPUTF8Str)] string defaultPath, string[] filters, int filtersCount); + public static extern IntPtr Photino_ShowSaveFile(IntPtr inst, [MarshalAs(UnmanagedType.LPUTF8Str)] string title, [MarshalAs(UnmanagedType.LPUTF8Str)] string defaultPath, [MarshalAs(UnmanagedType.LPUTF8Str)] string defaultFileName, string[] filters, int filtersCount); [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl, SetLastError = true, CharSet = CharSet.Ansi)] public static extern PhotinoDialogResult Photino_ShowMessage(IntPtr inst, [MarshalAs(UnmanagedType.LPUTF8Str)] string title, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, PhotinoDialogButtons buttons, PhotinoDialogIcon icon); diff --git a/Photino.NET/PhotinoWindow.NET.cs b/Photino.NET/PhotinoWindow.NET.cs index 94515f2..03093a5 100644 --- a/Photino.NET/PhotinoWindow.NET.cs +++ b/Photino.NET/PhotinoWindow.NET.cs @@ -2447,7 +2447,7 @@ public void SendNotification(string title, string body) public string[] ShowOpenFolder(string title = "Select folder", string defaultPath = null, bool multiSelect = false) => ShowOpenDialog(true, title, defaultPath, multiSelect, null); /// - /// Show an save folder dialog native to the OS. + /// Show a save folder dialog native to the OS. /// /// /// Filter names are not used on macOS. @@ -2460,6 +2460,25 @@ public void SendNotification(string title, string body) /// Array of for filtering. /// public string ShowSaveFile(string title = "Save file", string defaultPath = null, (string Name, string[] Extensions)[] filters = null) + { + return ShowSaveFile(title, defaultPath, null, filters); + } + + /// + /// Show a save folder dialog native to the OS. + /// + /// + /// Filter names are not used on macOS. + /// + /// + /// Thrown when the window is not initialized. + /// + /// Title of the dialog + /// Default path. Defaults to + /// Default file name in the text input field. + /// Array of for filtering. + /// + public string ShowSaveFile(string title = "Save file", string defaultPath = null, string defaultFileName = null, (string Name, string[] Extensions)[] filters = null) { defaultPath ??= Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); filters ??= Array.Empty<(string, string[])>(); @@ -2469,7 +2488,7 @@ public string ShowSaveFile(string title = "Save file", string defaultPath = null Invoke(() => { - var ptrResult = Photino_ShowSaveFile(_nativeInstance, title, defaultPath, nativeFilters, filters.Length); + var ptrResult = Photino_ShowSaveFile(_nativeInstance, title, defaultPath, defaultFileName, nativeFilters, filters.Length); result = Marshal.PtrToStringAuto(ptrResult); });