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

◆ AppendArgument() [1/2]

static void System.PasteArguments.AppendArgument ( ref System::Text::ValueStringBuilder stringBuilder,
string argument )
inlinestaticpackage

Definition at line 7 of file PasteArguments.cs.

8 {
9 if (stringBuilder.Length != 0)
10 {
11 stringBuilder.Append(' ');
12 }
13 if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument))
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 }
static bool ContainsNoWhitespaceOrQuotes(string s)

References System.PasteArguments.ContainsNoWhitespaceOrQuotes().

Referenced by System.Diagnostics.ProcessStartInfo.AppendArgumentsTo(), and System.PasteArguments.Paste().