Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeUnicodeStringHandle.cs
Go to the documentation of this file.
1using System;
3
5
6internal sealed class SafeUnicodeStringHandle : SafeHandle
7{
8 public sealed override bool IsInvalid => handle == IntPtr.Zero;
9
11 : base(IntPtr.Zero, ownsHandle: true)
12 {
14 }
15
17 : base(IntPtr.Zero, ownsHandle: true)
18 {
19 checked
20 {
21 if (s != default(ReadOnlySpan<char>))
22 {
23 int num = s.Length + 1;
24 int cb = num * 2;
27 s.CopyTo(destination);
28 destination[s.Length] = '\0';
29 }
30 }
31 }
32
33 protected sealed override bool ReleaseHandle()
34 {
36 return true;
37 }
38}
static void FreeHGlobal(IntPtr hglobal)
Definition Marshal.cs:1680
static unsafe IntPtr StringToHGlobalUni(string? s)
Definition Marshal.cs:1310
static IntPtr AllocHGlobal(int cb)
Definition Marshal.cs:625
static readonly IntPtr Zero
Definition IntPtr.cs:18
unsafe void * ToPointer()
Definition IntPtr.cs:210