-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathCefEncoder.cs
47 lines (43 loc) · 910 Bytes
/
CefEncoder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Linq;
namespace ViennaNET.ArcSight
{
internal static class CefEncoder
{
public static string EncodeHeader(string value)
{
return new(value.Trim().SelectMany(EncodeHeader).ToArray());
}
private static string EncodeHeader(char c)
{
switch (c)
{
case '|':
return "\\|";
case '\\':
return "\\\\";
default:
return c.ToString();
}
}
public static string EncodeExtension(string value)
{
return new(value.Trim().SelectMany(EncodeExtension).ToArray());
}
private static string EncodeExtension(char c)
{
switch (c)
{
case '\\':
return "\\\\";
case '=':
return "\\=";
case '\r':
return "\\r";
case '\n':
return "\\n";
default:
return c.ToString();
}
}
}
}