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

◆ ReplaceNewLines() [2/2]

string System.Xml.XmlCharCheckingWriter.ReplaceNewLines ( string str)
inlineprivate

Definition at line 328 of file XmlCharCheckingWriter.cs.

329 {
330 if (str == null)
331 {
332 return null;
333 }
335 int num = 0;
336 int i;
337 for (i = 0; i < str.Length; i++)
338 {
339 char c;
340 if ((c = str[i]) >= ' ')
341 {
342 continue;
343 }
344 if (c == '\n')
345 {
346 if (_newLineChars == "\n")
347 {
348 continue;
349 }
350 if (stringBuilder == null)
351 {
352 stringBuilder = new StringBuilder(str.Length + 5);
353 }
354 stringBuilder.Append(str, num, i - num);
355 }
356 else
357 {
358 if (c != '\r')
359 {
360 continue;
361 }
362 if (i + 1 < str.Length && str[i + 1] == '\n')
363 {
364 if (_newLineChars == "\r\n")
365 {
366 i++;
367 continue;
368 }
369 if (stringBuilder == null)
370 {
371 stringBuilder = new StringBuilder(str.Length + 5);
372 }
373 stringBuilder.Append(str, num, i - num);
374 i++;
375 }
376 else
377 {
378 if (_newLineChars == "\r")
379 {
380 continue;
381 }
382 if (stringBuilder == null)
383 {
384 stringBuilder = new StringBuilder(str.Length + 5);
385 }
386 stringBuilder.Append(str, num, i - num);
387 }
388 }
390 num = i + 1;
391 }
392 if (stringBuilder == null)
393 {
394 return str;
395 }
396 stringBuilder.Append(str, num, i - num);
397 return stringBuilder.ToString();
398 }

References System.Xml.XmlCharCheckingWriter._newLineChars, System.Xml.Dictionary, and System.str.

Referenced by System.Xml.XmlCharCheckingWriter.WriteCData(), System.Xml.XmlCharCheckingWriter.WriteCDataAsync(), System.Xml.XmlCharCheckingWriter.WriteChars(), System.Xml.XmlCharCheckingWriter.WriteCharsAsync(), System.Xml.XmlCharCheckingWriter.WriteComment(), System.Xml.XmlCharCheckingWriter.WriteCommentAsync(), System.Xml.XmlCharCheckingWriter.WriteDocType(), System.Xml.XmlCharCheckingWriter.WriteDocTypeAsync(), System.Xml.XmlCharCheckingWriter.WriteProcessingInstruction(), System.Xml.XmlCharCheckingWriter.WriteProcessingInstructionAsync(), System.Xml.XmlCharCheckingWriter.WriteString(), System.Xml.XmlCharCheckingWriter.WriteStringAsync(), System.Xml.XmlCharCheckingWriter.WriteWhitespace(), and System.Xml.XmlCharCheckingWriter.WriteWhitespaceAsync().