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

◆ EqualStartingCharacterCount()

static unsafe int System.IO.PathInternal.EqualStartingCharacterCount ( string first,
string second,
bool ignoreCase )
inlinestaticpackage

Definition at line 74 of file PathInternal.cs.

75 {
76 //The blocks IL_0037, IL_005c, IL_006c, IL_0072, IL_0078, IL_0080, IL_0083 are reachable both inside and outside the pinned region starting at IL_0032. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement.
77 if (string.IsNullOrEmpty(first) || string.IsNullOrEmpty(second))
78 {
79 return 0;
80 }
81 int num = 0;
82 fixed (char* ptr2 = first)
83 {
84 char* intPtr;
85 if (second == null)
86 {
87 char* ptr;
88 intPtr = (ptr = null);
89 char* ptr3 = ptr2;
90 char* ptr4 = ptr;
91 char* ptr5 = ptr3 + first.Length;
92 char* ptr6 = ptr4 + second.Length;
93 while (ptr3 != ptr5 && ptr4 != ptr6 && (*ptr3 == *ptr4 || (ignoreCase && char.ToUpperInvariant(*ptr3) == char.ToUpperInvariant(*ptr4))))
94 {
95 num++;
96 ptr3++;
97 ptr4++;
98 }
99 }
100 else
101 {
102 fixed (char* ptr7 = &second.GetPinnableReference())
103 {
104 char* ptr;
105 intPtr = (ptr = ptr7);
106 char* ptr3 = ptr2;
107 char* ptr4 = ptr;
108 char* ptr5 = ptr3 + first.Length;
109 char* ptr6 = ptr4 + second.Length;
110 while (ptr3 != ptr5 && ptr4 != ptr6 && (*ptr3 == *ptr4 || (ignoreCase && char.ToUpperInvariant(*ptr3) == char.ToUpperInvariant(*ptr4))))
111 {
112 num++;
113 ptr3++;
114 ptr4++;
115 }
116 }
117 }
118 }
119 return num;
120 }

Referenced by System.IO.PathInternal.GetCommonPathLength().