Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UTF8_ToManaged()

static unsafe string nativefiledialog.UTF8_ToManaged ( IntPtr s,
bool freePtr = false )
inlinestaticprivate

Definition at line 45 of file nativefiledialog.cs.

46 {
47 if (s == IntPtr.Zero)
48 {
49 return null;
50 }
51 byte* ptr;
52 for (ptr = (byte*)(void*)s; *ptr != 0; ptr++)
53 {
54 }
55 int num = (int)(ptr - (byte*)(void*)s);
56 if (num == 0)
57 {
58 return string.Empty;
59 }
60 char* ptr2 = stackalloc char[num];
61 int chars = Encoding.UTF8.GetChars((byte*)(void*)s, num, ptr2, num);
62 string result = new string(ptr2, 0, chars);
63 if (freePtr)
64 {
65 free(s);
66 }
67 return result;
68 }
static Encoding UTF8
Definition Encoding.cs:526
static void free(IntPtr ptr)
static readonly IntPtr Zero
Definition IntPtr.cs:18

References System.chars, free(), System.s, System.Text.Encoding.UTF8, and System.IntPtr.Zero.

Referenced by NFD_GetError(), NFD_OpenDialog(), NFD_PathSet_GetPath(), NFD_PickFolder(), and NFD_SaveDialog().