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

◆ GetLogicalDrives() [2/2]

static string[] System.IO.DriveInfoInternal.GetLogicalDrives ( )
inlinestatic

Definition at line 5 of file DriveInfoInternal.cs.

6 {
7 int logicalDrives = Interop.Kernel32.GetLogicalDrives();
8 if (logicalDrives == 0)
9 {
10 throw Win32Marshal.GetExceptionForLastWin32Error();
11 }
12 uint num = (uint)logicalDrives;
13 int num2 = 0;
14 while (num != 0)
15 {
16 if ((num & (true ? 1u : 0u)) != 0)
17 {
18 num2++;
19 }
20 num >>= 1;
21 }
22 string[] array = new string[num2];
23 Span<char> span = stackalloc char[3] { 'A', ':', '\\' };
24 num = (uint)logicalDrives;
25 num2 = 0;
26 while (num != 0)
27 {
28 if ((num & (true ? 1u : 0u)) != 0)
29 {
30 array[num2++] = span.ToString();
31 }
32 num >>= 1;
33 span[0] += '\u0001';
34 }
35 return array;
36 }
static int GetLogicalDrives()

References System.array, System.IO.Win32Marshal.GetExceptionForLastWin32Error(), Interop.Kernel32.GetLogicalDrives(), and System.Span< T >.ToString().