tangled
alpha
login
or
join now
benharri.org
/
ircsharp
1
fork
atom
IRC parsing, tokenization, and state handling in C#
1
fork
atom
overview
issues
pulls
pipelines
all tests pass
benharri.org
5 years ago
43aec959
aef26a40
+13
-4
2 changed files
expand all
collapse all
unified
split
IrcStates
ISupport.cs
Tests
ISupport.cs
+12
-3
IrcStates/ISupport.cs
···
71
71
StatusMsg.AddRange(value.Select(c => c.ToString(CultureInfo.InvariantCulture)));
72
72
break;
73
73
case "MODES":
74
74
-
Modes = int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);
74
74
+
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var modes))
75
75
+
Modes = modes;
76
76
+
else
77
77
+
Modes = -1;
75
78
break;
76
79
case "MONITOR":
77
77
-
Monitor = int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);
80
80
+
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var monitor))
81
81
+
Monitor = monitor;
82
82
+
else
83
83
+
Monitor = -1;
78
84
break;
79
85
case "WATCH":
80
80
-
Watch = int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);
86
86
+
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var watch))
87
87
+
Watch = watch;
88
88
+
else
89
89
+
Watch = -1;
81
90
break;
82
91
case "CASEMAPPING":
83
92
if (Enum.TryParse(value, true, out Casemap.CaseMapping caseMapping)) CaseMapping = caseMapping;
+1
-1
IrcStates/Tests/ISupport.cs
···
53
53
Assert.AreEqual("o", _server.ISupport.Prefix.FromPrefix("@"));
54
54
Assert.IsNull(_server.ISupport.Prefix.FromPrefix("&"));
55
55
56
56
-
_server.Parse(new Line("005 * PREFIX=(qaohv)~&#%+ *"));
56
56
+
_server.Parse(new Line("005 * PREFIX=(qaohv)~&@%+ *"));
57
57
CollectionAssert.AreEqual(new List<string>
58
58
{
59
59
"q",