diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-03-06 14:48:10 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-07 10:55:57 -0800 |
| commit | 3d2d46f62fc01e2653d0251ad9703090574e7c41 (patch) | |
| tree | ffdf7dce6c646f38b5e3ad8325c2ce78ca891a1a /src/api/burn/WixToolset.Mba.Core/StrUtil.cs | |
| parent | a8504dc4eb1c2d09965b0858699ac737336ef3c1 (diff) | |
| download | wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.gz wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.bz2 wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.zip | |
Better .nupkg names
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/StrUtil.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/StrUtil.cs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/StrUtil.cs b/src/api/burn/WixToolset.Mba.Core/StrUtil.cs deleted file mode 100644 index 5daef8e3..00000000 --- a/src/api/burn/WixToolset.Mba.Core/StrUtil.cs +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Mba.Core | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Runtime.InteropServices; | ||
| 7 | using System.Security; | ||
| 8 | using System.Text; | ||
| 9 | |||
| 10 | internal static class StrUtil | ||
| 11 | { | ||
| 12 | [DllImport("mbanative.dll", ExactSpelling = true)] | ||
| 13 | internal static extern void StrFree( | ||
| 14 | IntPtr scz | ||
| 15 | ); | ||
| 16 | |||
| 17 | internal sealed class StrHandle : SafeHandleZeroIsDefaultAndInvalid | ||
| 18 | { | ||
| 19 | protected override bool ReleaseHandle() | ||
| 20 | { | ||
| 21 | StrFree(this.handle); | ||
| 22 | return true; | ||
| 23 | } | ||
| 24 | |||
| 25 | public string ToUniString() | ||
| 26 | { | ||
| 27 | return Marshal.PtrToStringUni(this.handle); | ||
| 28 | } | ||
| 29 | |||
| 30 | public SecureString ToSecureString() | ||
| 31 | { | ||
| 32 | if (this.handle == IntPtr.Zero) | ||
| 33 | { | ||
| 34 | return null; | ||
| 35 | } | ||
| 36 | |||
| 37 | SecureString value = new SecureString(); | ||
| 38 | char c; | ||
| 39 | for (int charIndex = 0; ; charIndex++) | ||
| 40 | { | ||
| 41 | c = (char)Marshal.ReadInt16(this.handle, charIndex * UnicodeEncoding.CharSize); | ||
| 42 | if (c == '\0') | ||
| 43 | { | ||
| 44 | break; | ||
| 45 | } | ||
| 46 | |||
| 47 | value.AppendChar(c); | ||
| 48 | } | ||
| 49 | |||
| 50 | return value; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | } | ||
| 54 | } | ||
