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

◆ DocumentNameEquals()

bool System.Reflection.Metadata.Ecma335.BlobHeap.DocumentNameEquals ( DocumentNameBlobHandle handle,
string other,
bool ignoreCase )
inlinepackage

Definition at line 161 of file BlobHeap.cs.

162 {
163 BlobReader blobReader = GetBlobReader(handle);
164 int num = blobReader.ReadByte();
165 if (num > 127)
166 {
167 return false;
168 }
169 int ignoreCaseMask = StringUtils.IgnoreCaseMask(ignoreCase);
170 int num2 = 0;
171 int firstDifferenceIndex;
172 for (bool flag = true; blobReader.RemainingBytes > 0; num2 = firstDifferenceIndex, flag = false)
173 {
174 if (num != 0 && !flag)
175 {
176 if (num2 == other.Length || !StringUtils.IsEqualAscii(other[num2], num, ignoreCaseMask))
177 {
178 return false;
179 }
180 num2++;
181 }
182 MemoryBlock memoryBlock = GetMemoryBlock(blobReader.ReadBlobHandle());
183 switch (memoryBlock.Utf8NullTerminatedFastCompare(0, other, num2, out firstDifferenceIndex, '\0', ignoreCase))
184 {
185 case MemoryBlock.FastComparisonResult.Inconclusive:
186 return GetDocumentName(handle).Equals(other, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
187 default:
188 if (firstDifferenceIndex - num2 == memoryBlock.Length)
189 {
190 continue;
191 }
192 break;
194 break;
195 }
196 return false;
197 }
198 return num2 == other.Length;
199 }
unsafe FastComparisonResult Utf8NullTerminatedFastCompare(int offset, string text, int textStart, out int firstDifferenceIndex, char terminator, bool ignoreCase)
BlobReader GetBlobReader(BlobHandle handle)
Definition BlobHeap.cs:98
MemoryBlock GetMemoryBlock(BlobHandle handle)
Definition BlobHeap.cs:75
string GetDocumentName(DocumentNameBlobHandle handle)
Definition BlobHeap.cs:137

References System.Reflection.Metadata.Ecma335.BlobHeap.GetBlobReader(), System.Reflection.Metadata.Ecma335.BlobHeap.GetDocumentName(), System.Reflection.Metadata.Ecma335.BlobHeap.GetMemoryBlock(), System.handle, System.Reflection.Metadata.StringUtils.IgnoreCaseMask(), System.Reflection.Metadata.StringUtils.IsEqualAscii(), System.Reflection.Internal.MemoryBlock.Length, System.other, System.Reflection.Metadata.BlobReader.ReadBlobHandle(), System.Reflection.Metadata.BlobReader.ReadByte(), and System.Reflection.Internal.MemoryBlock.Utf8NullTerminatedFastCompare().