Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PasteArguments.cs
Go to the documentation of this file.
1using System.Text;
2
3namespace System;
4
5internal static class PasteArguments
6{
8 {
9 if (stringBuilder.Length != 0)
10 {
11 stringBuilder.Append(' ');
12 }
14 {
15 stringBuilder.Append(argument);
16 return;
17 }
18 stringBuilder.Append('"');
19 int num = 0;
20 while (num < argument.Length)
21 {
22 char c = argument[num++];
23 switch (c)
24 {
25 case '\\':
26 {
27 int num2 = 1;
28 while (num < argument.Length && argument[num] == '\\')
29 {
30 num++;
31 num2++;
32 }
33 if (num == argument.Length)
34 {
35 stringBuilder.Append('\\', num2 * 2);
36 }
37 else if (argument[num] == '"')
38 {
39 stringBuilder.Append('\\', num2 * 2 + 1);
40 stringBuilder.Append('"');
41 num++;
42 }
43 else
44 {
45 stringBuilder.Append('\\', num2);
46 }
47 break;
48 }
49 case '"':
50 stringBuilder.Append('\\');
51 stringBuilder.Append('"');
52 break;
53 default:
54 stringBuilder.Append(c);
55 break;
56 }
57 }
58 stringBuilder.Append('"');
59 }
60
61 private static bool ContainsNoWhitespaceOrQuotes(string s)
62 {
63 foreach (char c in s)
64 {
65 if (char.IsWhiteSpace(c) || c == '"')
66 {
67 return false;
68 }
69 }
70 return true;
71 }
72}
static void AppendArgument(ref System.Text.ValueStringBuilder stringBuilder, string argument)
static bool ContainsNoWhitespaceOrQuotes(string s)