rename Irc to IRC
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
304df7805b
commit
21f1e95fb8
|
@ -2,8 +2,8 @@ using System;
|
|||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using IrcStates;
|
||||
using IrcTokens;
|
||||
using IRCStates;
|
||||
using IRCTokens;
|
||||
|
||||
namespace StatesSample
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\IrcStates\IrcStates.csproj" />
|
||||
<ProjectReference Include="..\..\IRCStates\IRCStates.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
|
||||
namespace TokensSample
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
|
||||
namespace TokensSample
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\IrcTokens\IrcTokens.csproj" />
|
||||
<ProjectReference Include="..\..\IRCTokens\IRCTokens.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30011.22
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IrcTokens", "IrcTokens\IrcTokens.csproj", "{9E812F45-B2CD-42D2-8378-EBEBF8697905}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRCTokens", "IRCTokens\IRCTokens.csproj", "{9E812F45-B2CD-42D2-8378-EBEBF8697905}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TokensSample", "Examples\Tokens\TokensSample.csproj", "{A45DA39B-6B47-4713-8049-3B36E0235B67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IrcStates", "IrcStates\IrcStates.csproj", "{233E3CB4-61F1-4368-9139-7E9F4A58ED2D}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRCStates", "IRCStates\IRCStates.csproj", "{233E3CB4-61F1-4368-9139-7E9F4A58ED2D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StatesSample", "Examples\States\StatesSample.csproj", "{BC9F6696-9D83-4F7A-9E15-CE4D3626C1AF}"
|
||||
EndProject
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public static class Casemap
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class Channel
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ChannelUser
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public static class Commands
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class Emit
|
||||
{
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRCStates
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static void UpdateWith<TKey, TValue>(this Dictionary<TKey, TValue> dict, Dictionary<TKey, TValue> other)
|
||||
{
|
||||
if (dict == null || other == null || !other.Any()) return;
|
||||
|
||||
foreach (var (key, value) in other) dict[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IrcTokens\IrcTokens.csproj" />
|
||||
<ProjectReference Include="..\IRCTokens\IRCTokens.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ISupport
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ISupportChanModes
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ISupportPrefix
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public static class Numeric
|
||||
{
|
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel.Design;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class Server
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ServerDisconnectedException : Exception
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class ServerException : Exception
|
||||
{
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Cap
|
|
@ -1,7 +1,7 @@
|
|||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Casemap
|
||||
|
@ -9,14 +9,14 @@ namespace IrcStates.Tests
|
|||
[TestMethod]
|
||||
public void Rfc1459()
|
||||
{
|
||||
var lower = IrcStates.Casemap.CaseFold(IrcStates.Casemap.CaseMapping.Rfc1459, @"ÀTEST[]~\");
|
||||
var lower = IRCStates.Casemap.CaseFold(IRCStates.Casemap.CaseMapping.Rfc1459, @"ÀTEST[]~\");
|
||||
Assert.AreEqual("Àtest{}^|", lower);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Ascii()
|
||||
{
|
||||
var lower = IrcStates.Casemap.CaseFold(IrcStates.Casemap.CaseMapping.Ascii, @"ÀTEST[]~\");
|
||||
var lower = IRCStates.Casemap.CaseFold(IRCStates.Casemap.CaseMapping.Ascii, @"ÀTEST[]~\");
|
||||
Assert.AreEqual(@"Àtest[]~\", lower);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Channel
|
||||
|
@ -69,8 +69,8 @@ namespace IrcStates.Tests
|
|||
var chanUser = channel.Users[user.NickNameLower];
|
||||
|
||||
Assert.AreEqual(channel.NameLower, user.Channels.Single());
|
||||
CollectionAssert.AreEqual(new Dictionary<string, IrcStates.User> {{"nickname", user}}, _server.Users);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, IrcStates.Channel> {{"#chan", channel}}, _server.Channels);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, IRCStates.User> {{"nickname", user}}, _server.Users);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, IRCStates.Channel> {{"#chan", channel}}, _server.Channels);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, ChannelUser> {{"nickname", chanUser}}, channel.Users);
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Emit
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class ISupport
|
||||
|
@ -97,9 +97,9 @@ namespace IrcStates.Tests
|
|||
[TestMethod]
|
||||
public void Rfc1459()
|
||||
{
|
||||
Assert.AreEqual(IrcStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
Assert.AreEqual(IRCStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
_server.Parse(new Line("005 * CASEMAPPING=rfc1459 *"));
|
||||
Assert.AreEqual(IrcStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
Assert.AreEqual(IRCStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
var lower = _server.CaseFold(@"ÀTEST[]~\");
|
||||
Assert.AreEqual("Àtest{}^|", lower);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace IrcStates.Tests
|
|||
public void Ascii()
|
||||
{
|
||||
_server.Parse(new Line("005 * CASEMAPPING=ascii *"));
|
||||
Assert.AreEqual(IrcStates.Casemap.CaseMapping.Ascii, _server.ISupport.CaseMapping);
|
||||
Assert.AreEqual(IRCStates.Casemap.CaseMapping.Ascii, _server.ISupport.CaseMapping);
|
||||
var lower = _server.CaseFold(@"ÀTEST[]~\");
|
||||
Assert.AreEqual(@"Àtest[]~\", lower);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace IrcStates.Tests
|
|||
public void FallbackToRfc1459()
|
||||
{
|
||||
_server.Parse(new Line("005 * CASEMAPPING=nonexistent *"));
|
||||
Assert.AreEqual(IrcStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
Assert.AreEqual(IRCStates.Casemap.CaseMapping.Rfc1459, _server.ISupport.CaseMapping);
|
||||
var lower = _server.CaseFold(@"ÀTEST[]~\");
|
||||
Assert.AreEqual("Àtest{}^|", lower);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Mode
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Motd
|
|
@ -1,7 +1,7 @@
|
|||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Sasl
|
|
@ -1,7 +1,7 @@
|
|||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class User
|
|
@ -1,7 +1,7 @@
|
|||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcStates.Tests
|
||||
namespace IRCStates.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Who
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace IrcStates
|
||||
namespace IRCStates
|
||||
{
|
||||
public class User
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace IrcTokens
|
||||
namespace IRCTokens
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace IrcTokens
|
||||
namespace IRCTokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the three parts of a hostmask. Parse with the constructor.
|
|
@ -4,7 +4,7 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IrcTokens
|
||||
namespace IRCTokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Tools to represent, parse, and format IRC lines
|
|
@ -1,4 +1,4 @@
|
|||
# irctokens
|
||||
# IRCTokens
|
||||
|
||||
this is a c\# port of jesopo's [irctokens](
|
||||
https://github.com/jesopo/irctokens)
|
||||
|
@ -7,7 +7,7 @@ https://github.com/jesopo/irctokens)
|
|||
|
||||
### tokenization
|
||||
|
||||
using IrcTokens;
|
||||
using IRCTokens;
|
||||
|
||||
...
|
||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IrcTokens
|
||||
namespace IRCTokens
|
||||
{
|
||||
public class StatefulDecoder
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IrcTokens
|
||||
namespace IRCTokens
|
||||
{
|
||||
public class StatefulEncoder
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace IrcTokens.Tests.Data
|
||||
namespace IRCTokens.Tests.Data
|
||||
{
|
||||
public class JoinModel
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace IrcTokens.Tests.Data
|
||||
namespace IRCTokens.Tests.Data
|
||||
{
|
||||
public class SplitModel
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Format
|
|
@ -1,6 +1,6 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Hostmask
|
||||
|
@ -8,7 +8,7 @@ namespace IrcTokens.Tests
|
|||
[TestMethod]
|
||||
public void TestHostmask()
|
||||
{
|
||||
var hostmask = new IrcTokens.Hostmask("nick!user@host");
|
||||
var hostmask = new IRCTokens.Hostmask("nick!user@host");
|
||||
Assert.AreEqual("nick", hostmask.NickName);
|
||||
Assert.AreEqual("user", hostmask.UserName);
|
||||
Assert.AreEqual("host", hostmask.HostName);
|
||||
|
@ -17,7 +17,7 @@ namespace IrcTokens.Tests
|
|||
[TestMethod]
|
||||
public void TestNoHostName()
|
||||
{
|
||||
var hostmask = new IrcTokens.Hostmask("nick!user");
|
||||
var hostmask = new IRCTokens.Hostmask("nick!user");
|
||||
Assert.AreEqual("nick", hostmask.NickName);
|
||||
Assert.AreEqual("user", hostmask.UserName);
|
||||
Assert.IsNull(hostmask.HostName);
|
||||
|
@ -26,7 +26,7 @@ namespace IrcTokens.Tests
|
|||
[TestMethod]
|
||||
public void TestNoUserName()
|
||||
{
|
||||
var hostmask = new IrcTokens.Hostmask("nick@host");
|
||||
var hostmask = new IRCTokens.Hostmask("nick@host");
|
||||
Assert.AreEqual("nick", hostmask.NickName);
|
||||
Assert.IsNull(hostmask.UserName);
|
||||
Assert.AreEqual("host", hostmask.HostName);
|
||||
|
@ -35,7 +35,7 @@ namespace IrcTokens.Tests
|
|||
[TestMethod]
|
||||
public void TestOnlyNickName()
|
||||
{
|
||||
var hostmask = new IrcTokens.Hostmask("nick");
|
||||
var hostmask = new IRCTokens.Hostmask("nick");
|
||||
Assert.AreEqual("nick", hostmask.NickName);
|
||||
Assert.IsNull(hostmask.UserName);
|
||||
Assert.IsNull(hostmask.HostName);
|
||||
|
@ -45,7 +45,7 @@ namespace IrcTokens.Tests
|
|||
public void TestHostmaskFromLine()
|
||||
{
|
||||
var line = new Line(":nick!user@host PRIVMSG #channel hello");
|
||||
var hostmask = new IrcTokens.Hostmask("nick!user@host");
|
||||
var hostmask = new IRCTokens.Hostmask("nick!user@host");
|
||||
Assert.AreEqual(hostmask.ToString(), line.Hostmask.ToString());
|
||||
Assert.AreEqual("nick", line.Hostmask.NickName);
|
||||
Assert.AreEqual("user", line.Hostmask.UserName);
|
|
@ -1,12 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using IrcTokens.Tests.Data;
|
||||
using IRCTokens.Tests.Data;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Parser
|
|
@ -2,17 +2,17 @@
|
|||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class StatefulDecoder
|
||||
{
|
||||
private IrcTokens.StatefulDecoder _decoder;
|
||||
private IRCTokens.StatefulDecoder _decoder;
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
_decoder = new IrcTokens.StatefulDecoder();
|
||||
_decoder = new IRCTokens.StatefulDecoder();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -44,7 +44,7 @@ namespace IrcTokens.Tests
|
|||
public void TestEncoding()
|
||||
{
|
||||
var iso8859 = Encoding.GetEncoding("iso-8859-1");
|
||||
_decoder = new IrcTokens.StatefulDecoder {Encoding = iso8859};
|
||||
_decoder = new IRCTokens.StatefulDecoder {Encoding = iso8859};
|
||||
var bytes = iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n");
|
||||
var lines = _decoder.Push(bytes, bytes.Length);
|
||||
var line = new Line("PRIVMSG #channel :hello Ç");
|
||||
|
@ -55,7 +55,7 @@ namespace IrcTokens.Tests
|
|||
public void TestEncodingFallback()
|
||||
{
|
||||
var latin1 = Encoding.GetEncoding("iso-8859-1");
|
||||
_decoder = new IrcTokens.StatefulDecoder {Encoding = null, Fallback = latin1};
|
||||
_decoder = new IRCTokens.StatefulDecoder {Encoding = null, Fallback = latin1};
|
||||
var bytes = latin1.GetBytes("PRIVMSG #channel hélló\r\n");
|
||||
var lines = _decoder.Push(bytes, bytes.Length);
|
||||
Assert.AreEqual(1, lines.Count);
|
|
@ -1,17 +1,17 @@
|
|||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class StatefulEncoder
|
||||
{
|
||||
private IrcTokens.StatefulEncoder _encoder;
|
||||
private IRCTokens.StatefulEncoder _encoder;
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
_encoder = new IrcTokens.StatefulEncoder();
|
||||
_encoder = new IRCTokens.StatefulEncoder();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -76,7 +76,7 @@ namespace IrcTokens.Tests
|
|||
public void TestEncoding()
|
||||
{
|
||||
var iso8859 = Encoding.GetEncoding("iso-8859-1");
|
||||
_encoder = new IrcTokens.StatefulEncoder {Encoding = iso8859};
|
||||
_encoder = new IRCTokens.StatefulEncoder {Encoding = iso8859};
|
||||
_encoder.Push(new Line("PRIVMSG #channel :hello Ç"));
|
||||
CollectionAssert.AreEqual(iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n"), _encoder.PendingBytes);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace IrcTokens.Tests
|
||||
namespace IRCTokens.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class Tokenization
|
|
@ -1,40 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace IrcStates
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static Delegate CreateDelegate(this MethodInfo methodInfo, object target)
|
||||
{
|
||||
if (methodInfo == null) return null;
|
||||
|
||||
var types = methodInfo.GetParameters().Select(p => p.ParameterType);
|
||||
|
||||
Func<Type[], Type> getType;
|
||||
if (methodInfo.ReturnType == typeof(void))
|
||||
{
|
||||
getType = Expression.GetActionType;
|
||||
}
|
||||
else
|
||||
{
|
||||
getType = Expression.GetFuncType;
|
||||
types = types.Concat(new[] {methodInfo.ReturnType});
|
||||
}
|
||||
|
||||
return methodInfo.IsStatic
|
||||
? Delegate.CreateDelegate(getType(types.ToArray()), methodInfo)
|
||||
: Delegate.CreateDelegate(getType(types.ToArray()), target, methodInfo);
|
||||
}
|
||||
|
||||
public static void UpdateWith<TKey, TValue>(this Dictionary<TKey, TValue> dict, Dictionary<TKey, TValue> other)
|
||||
{
|
||||
if (dict == null || other == null || !other.Any()) return;
|
||||
|
||||
foreach (var (key, value) in other) dict[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue