65 {
66 int rootLength = PathInternal.GetRootLength(outputBuilder.AsSpan());
67 bool flag = PathInternal.IsDevice(outputBuilder.AsSpan());
69 bool flag2 = false;
70 int num = 0;
71 bool flag3 = false;
72 if (flag)
73 {
75 if (outputBuilder[2] == '.')
76 {
77 flag3 = true;
79 }
80 }
81 else
82 {
83 flag2 = !PathInternal.IsDevice(outputBuilder.AsSpan()) && outputBuilder.Length > 1 && outputBuilder[0] == '\\' && outputBuilder[1] == '\\';
85 }
86 rootLength += num;
88 bool flag4 = false;
89 int num2 = buffer.Length - 1;
90 while (!flag4)
91 {
94 {
96 }
97 if (longPathNameW == 0)
98 {
100 if (lastWin32Error != 2 && lastWin32Error != 3)
101 {
102 break;
103 }
104 num2--;
105 while (num2 > rootLength &&
buffer[num2] !=
'\\')
106 {
107 num2--;
108 }
109 if (num2 == rootLength)
110 {
111 break;
112 }
114 }
115 else if (longPathNameW > outputBuilder.Capacity)
116 {
117 outputBuilder.EnsureCapacity(checked((int)longPathNameW));
118 }
119 else
120 {
121 flag4 = true;
122 outputBuilder.Length = checked((int)longPathNameW);
124 {
125 outputBuilder.Append(
buffer.AsSpan(num2,
buffer.Length - num2));
126 }
127 }
128 }
130 if (flag3)
131 {
132 reference[2] = '.';
133 }
134 if (flag2)
135 {
136 reference[6] = '\\';
137 }
138 ReadOnlySpan<char> span = reference.AsSpan(num);
139 string result = ((originalPath !=
null && MemoryExtensions.Equals(span, originalPath.AsSpan(),
StringComparison.Ordinal)) ? originalPath : span.
ToString());
141 return result;
142 }
static uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer)
static int PrependDevicePathChars(ref ValueStringBuilder content, bool isDosUnc, ref ValueStringBuilder buffer)
static int GetLastWin32Error()