From 8ef09f9fed656bacc3a25e790796e9f144a5fac8 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Fri, 8 May 2026 01:28:31 +1000 Subject: v0.14a --- Util.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Util.cs (limited to 'Util.cs') diff --git a/Util.cs b/Util.cs new file mode 100644 index 0000000..9f261ee --- /dev/null +++ b/Util.cs @@ -0,0 +1,17 @@ +using System.Runtime.InteropServices; +using System.Security; + +namespace HyperBooru.PowerShell; + +internal static class Util { + internal static string ToInsecureString(this SecureString x) { + IntPtr rawString = IntPtr.Zero; + try { + rawString = Marshal.SecureStringToBSTR(x); + return Marshal.PtrToStringBSTR(rawString); + } finally { + if(rawString != IntPtr.Zero) + Marshal.FreeBSTR(rawString); + } + } +} -- cgit v1.3