Split various components into sublibraries to avoid things depending on things they should not depend on.
This commit is contained in:
parent
980ec5b855
commit
e0f83ca259
12
SharpChat.Misuzu/SharpChat.Misuzu.csproj
Normal file
12
SharpChat.Misuzu/SharpChat.Misuzu.csproj
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SharpChatCommon\SharpChatCommon.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -1,10 +1,10 @@
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class BanListCommand : ISockChatClientCommand {
|
public class BanListCommand : ISockChatClientCommand {
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ChannelCreateCommand : ISockChatClientCommand {
|
public class ChannelCreateCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("create");
|
return ctx.NameEquals("create");
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ChannelDeleteCommand : ISockChatClientCommand {
|
public class ChannelDeleteCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("delchan") || (
|
return ctx.NameEquals("delchan") || (
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ChannelJoinCommand : ISockChatClientCommand {
|
public class ChannelJoinCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("join");
|
return ctx.NameEquals("join");
|
|
@ -1,6 +1,6 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ChannelPasswordCommand : ISockChatClientCommand {
|
public class ChannelPasswordCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("pwd")
|
return ctx.NameEquals("pwd")
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ChannelRankCommand : ISockChatClientCommand {
|
public class ChannelRankCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("rank")
|
return ctx.NameEquals("rank")
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public interface ISockChatClientCommand {
|
public interface ISockChatClientCommand {
|
||||||
bool IsMatch(SockChatClientCommandContext ctx);
|
bool IsMatch(SockChatClientCommandContext ctx);
|
||||||
void Dispatch(SockChatClientCommandContext ctx);
|
void Dispatch(SockChatClientCommandContext ctx);
|
|
@ -1,10 +1,10 @@
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class KickBanCommand : ISockChatClientCommand {
|
public class KickBanCommand : ISockChatClientCommand {
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class MessageActionCommand : ISockChatClientCommand {
|
public class MessageActionCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("action")
|
return ctx.NameEquals("action")
|
|
@ -1,8 +1,8 @@
|
||||||
using SharpChat.Events;
|
using SharpChat.Events;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class MessageBroadcastCommand : ISockChatClientCommand {
|
public class MessageBroadcastCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("say")
|
return ctx.NameEquals("say")
|
|
@ -1,8 +1,8 @@
|
||||||
using SharpChat.EventStorage;
|
using SharpChat.EventStorage;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class MessageDeleteCommand : ISockChatClientCommand {
|
public class MessageDeleteCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("delmsg") || (
|
return ctx.NameEquals("delmsg") || (
|
|
@ -1,9 +1,9 @@
|
||||||
using SharpChat.Events;
|
using SharpChat.Events;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class MessageWhisperCommand : ISockChatClientCommand {
|
public class MessageWhisperCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("whisper")
|
return ctx.NameEquals("whisper")
|
|
@ -1,10 +1,10 @@
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class PardonAddressCommand : ISockChatClientCommand {
|
public class PardonAddressCommand : ISockChatClientCommand {
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class PardonUserCommand : ISockChatClientCommand {
|
public class PardonUserCommand : ISockChatClientCommand {
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class ShutdownRestartCommand : ISockChatClientCommand {
|
public class ShutdownRestartCommand : ISockChatClientCommand {
|
||||||
private readonly ManualResetEvent WaitHandle;
|
private readonly ManualResetEvent WaitHandle;
|
||||||
private readonly Func<bool> ShuttingDown;
|
private readonly Func<bool> ShuttingDown;
|
|
@ -1,20 +1,20 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class SockChatClientCommandContext {
|
public class SockChatClientCommandContext {
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public string[] Args { get; }
|
public string[] Args { get; }
|
||||||
public ChatContext Chat { get; }
|
public SockChatContext Chat { get; }
|
||||||
public UserInfo User { get; }
|
public UserInfo User { get; }
|
||||||
public ConnectionInfo Connection { get; }
|
public SockChatConnectionInfo Connection { get; }
|
||||||
public ChannelInfo Channel { get; }
|
public ChannelInfo Channel { get; }
|
||||||
|
|
||||||
public SockChatClientCommandContext(
|
public SockChatClientCommandContext(
|
||||||
string text,
|
string text,
|
||||||
ChatContext chat,
|
SockChatContext chat,
|
||||||
UserInfo user,
|
UserInfo user,
|
||||||
ConnectionInfo connection,
|
SockChatConnectionInfo connection,
|
||||||
ChannelInfo channel
|
ChannelInfo channel
|
||||||
) {
|
) {
|
||||||
Chat = chat;
|
Chat = chat;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class UserAFKCommand : ISockChatClientCommand {
|
public class UserAFKCommand : ISockChatClientCommand {
|
||||||
private const string DEFAULT = "AFK";
|
private const string DEFAULT = "AFK";
|
||||||
private const int MAX_LENGTH = 5;
|
private const int MAX_LENGTH = 5;
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class UserNickCommand : ISockChatClientCommand {
|
public class UserNickCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("nick");
|
return ctx.NameEquals("nick");
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class WhoCommand : ISockChatClientCommand {
|
public class WhoCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("who");
|
return ctx.NameEquals("who");
|
|
@ -1,7 +1,7 @@
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.Commands {
|
namespace SharpChat.SockChat.Commands {
|
||||||
public class WhoisCommand : ISockChatClientCommand {
|
public class WhoisCommand : ISockChatClientCommand {
|
||||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||||
return ctx.NameEquals("ip")
|
return ctx.NameEquals("ip")
|
|
@ -1,13 +1,13 @@
|
||||||
using SharpChat.Config;
|
using SharpChat.Config;
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.PacketsC2S {
|
namespace SharpChat.SockChat.PacketsC2S {
|
||||||
public class AuthC2SPacketHandler : IC2SPacketHandler {
|
public class AuthC2SPacketHandler : IC2SPacketHandler {
|
||||||
public const string MOTD_FILE = @"welcome.txt";
|
public const string MOTD_FILE = @"welcome.txt";
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
namespace SharpChat.PacketsC2S {
|
namespace SharpChat.SockChat.PacketsC2S {
|
||||||
public class C2SPacketHandlerContext {
|
public class C2SPacketHandlerContext {
|
||||||
public string Text { get; }
|
public string Text { get; }
|
||||||
public ChatContext Chat { get; }
|
public SockChatContext Chat { get; }
|
||||||
public ConnectionInfo Connection { get; }
|
public SockChatConnectionInfo Connection { get; }
|
||||||
|
|
||||||
public C2SPacketHandlerContext(string text, ChatContext chat, ConnectionInfo connection) {
|
public C2SPacketHandlerContext(string text, SockChatContext chat, SockChatConnectionInfo connection) {
|
||||||
Text = text;
|
Text = text;
|
||||||
Chat = chat;
|
Chat = chat;
|
||||||
Connection = connection;
|
Connection = connection;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsC2S {
|
namespace SharpChat.SockChat.PacketsC2S {
|
||||||
public interface IC2SPacketHandler {
|
public interface IC2SPacketHandler {
|
||||||
bool IsMatch(C2SPacketHandlerContext ctx);
|
bool IsMatch(C2SPacketHandlerContext ctx);
|
||||||
void Handle(C2SPacketHandlerContext ctx);
|
void Handle(C2SPacketHandlerContext ctx);
|
|
@ -1,11 +1,11 @@
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SharpChat.PacketsC2S {
|
namespace SharpChat.SockChat.PacketsC2S {
|
||||||
public class PingC2SPacketHandler : IC2SPacketHandler {
|
public class PingC2SPacketHandler : IC2SPacketHandler {
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
using SharpChat.Commands;
|
using SharpChat.Config;
|
||||||
using SharpChat.Config;
|
|
||||||
using SharpChat.Events;
|
using SharpChat.Events;
|
||||||
|
using SharpChat.SockChat.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat.PacketsC2S {
|
namespace SharpChat.SockChat.PacketsC2S {
|
||||||
public class SendMessageC2SPacketHandler : IC2SPacketHandler {
|
public class SendMessageC2SPacketHandler : IC2SPacketHandler {
|
||||||
private readonly CachedValue<int> MaxMessageLength;
|
private readonly CachedValue<int> MaxMessageLength;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class AuthFailS2CPacket : SockChatS2CPacket {
|
public class AuthFailS2CPacket : SockChatS2CPacket {
|
||||||
public enum FailReason {
|
public enum FailReason {
|
||||||
AuthInvalid,
|
AuthInvalid,
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class AuthSuccessS2CPacket : SockChatS2CPacket {
|
public class AuthSuccessS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class BanListResponseS2CPacket : SockChatTimedS2CPacket {
|
public class BanListResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string[] Bans;
|
private readonly string[] Bans;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelCreateResponseS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelCreateResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelCreateS2CPacket : SockChatS2CPacket {
|
public class ChannelCreateS2CPacket : SockChatS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
private readonly bool ChannelHasPassword;
|
private readonly bool ChannelHasPassword;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelDeleteResponseS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelDeleteResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelDeleteS2CPacket : SockChatS2CPacket {
|
public class ChannelDeleteS2CPacket : SockChatS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelNameFormatErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelNameFormatErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelPasswordChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelPasswordChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelPasswordWrongErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelPasswordWrongErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelRankChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelRankChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelRankTooHighErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelRankTooHighErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelRankTooLowErrorS2CPacket : SockChatTimedS2CPacket {
|
public class ChannelRankTooLowErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelUpdateS2CPacket : SockChatS2CPacket {
|
public class ChannelUpdateS2CPacket : SockChatS2CPacket {
|
||||||
private readonly string ChannelNamePrevious;
|
private readonly string ChannelNamePrevious;
|
||||||
private readonly string ChannelNameNew;
|
private readonly string ChannelNameNew;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ChannelsPopulateS2CPacket : SockChatS2CPacket {
|
public class ChannelsPopulateS2CPacket : SockChatS2CPacket {
|
||||||
public record ListEntry(string Name, bool HasPassword, bool IsTemporary);
|
public record ListEntry(string Name, bool HasPassword, bool IsTemporary);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class CommandFormatErrorS2CPacket : SockChatTimedS2CPacket {
|
public class CommandFormatErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class CommandNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
public class CommandNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string CommandName;
|
private readonly string CommandName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ContextClearS2CPacket : SockChatS2CPacket {
|
public class ContextClearS2CPacket : SockChatS2CPacket {
|
||||||
public enum ClearMode {
|
public enum ClearMode {
|
||||||
Messages = 0,
|
Messages = 0,
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class FloodWarningS2CPacket : SockChatTimedS2CPacket {
|
public class FloodWarningS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class ForceDisconnectS2CPacket : SockChatS2CPacket {
|
public class ForceDisconnectS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long Expires;
|
private readonly long Expires;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class KickBanNoRecordErrorS2CPacket : SockChatTimedS2CPacket {
|
public class KickBanNoRecordErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string TargetName;
|
private readonly string TargetName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class KickBanNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
public class KickBanNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MOTDS2CPacket : SockChatTimedS2CPacket {
|
public class MOTDS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string Body;
|
private readonly string Body;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MessageAddLogS2CPacket : SockChatTimedS2CPacket {
|
public class MessageAddLogS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MessageAddS2CPacket : SockChatTimedS2CPacket {
|
public class MessageAddS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string Body;
|
private readonly string Body;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MessageBroadcastS2CPacket : SockChatTimedS2CPacket {
|
public class MessageBroadcastS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string Body;
|
private readonly string Body;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MessageDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
public class MessageDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return string.Format(
|
return string.Format(
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class MessageDeleteS2CPacket : SockChatS2CPacket {
|
public class MessageDeleteS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long DeletedMessageId;
|
private readonly long DeletedMessageId;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class PardonResponseS2CPacket : SockChatTimedS2CPacket {
|
public class PardonResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string Subject;
|
private readonly string Subject;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class PongS2CPacket : SockChatS2CPacket {
|
public class PongS2CPacket : SockChatS2CPacket {
|
||||||
public override string Pack() {
|
public override string Pack() {
|
||||||
return "0\tpong";
|
return "0\tpong";
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public abstract class SockChatS2CPacket {
|
public abstract class SockChatS2CPacket {
|
||||||
protected readonly long MessageId;
|
protected readonly long MessageId;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public abstract class SockChatTimedS2CPacket : SockChatS2CPacket {
|
public abstract class SockChatTimedS2CPacket : SockChatS2CPacket {
|
||||||
protected readonly DateTimeOffset TimeStamp;
|
protected readonly DateTimeOffset TimeStamp;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserChannelForceJoinS2CPacket : SockChatS2CPacket {
|
public class UserChannelForceJoinS2CPacket : SockChatS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserChannelJoinLogS2CPacket : SockChatTimedS2CPacket {
|
public class UserChannelJoinLogS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserChannelJoinS2CPacket : SockChatS2CPacket {
|
public class UserChannelJoinS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserChannelLeaveLogS2CPacket : SockChatTimedS2CPacket {
|
public class UserChannelLeaveLogS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserChannelLeaveS2CPacket : SockChatS2CPacket {
|
public class UserChannelLeaveS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserConnectLogS2CPacket : SockChatTimedS2CPacket {
|
public class UserConnectLogS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserConnectS2CPacket : SockChatTimedS2CPacket {
|
public class UserConnectS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserDisconnectLogS2CPacket : SockChatTimedS2CPacket {
|
public class UserDisconnectLogS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
private readonly UserDisconnectReason Reason;
|
private readonly UserDisconnectReason Reason;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserDisconnectS2CPacket : SockChatTimedS2CPacket {
|
public class UserDisconnectS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
public class UserNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
public class UserNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserUpdateNotificationS2CPacket : SockChatTimedS2CPacket {
|
public class UserUpdateNotificationS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string PreviousName;
|
private readonly string PreviousName;
|
||||||
private readonly string NewName;
|
private readonly string NewName;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UserUpdateS2CPacket : SockChatS2CPacket {
|
public class UserUpdateS2CPacket : SockChatS2CPacket {
|
||||||
private readonly long UserId;
|
private readonly long UserId;
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class UsersPopulateS2CPacket : SockChatS2CPacket {
|
public class UsersPopulateS2CPacket : SockChatS2CPacket {
|
||||||
public record ListEntry(long Id, string Name, Colour Colour, int Rank, UserPermissions Perms, bool Visible);
|
public record ListEntry(long Id, string Name, Colour Colour, int Rank, UserPermissions Perms, bool Visible);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class WhoChannelNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
public class WhoChannelNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class WhoChannelResponseS2CPacket : SockChatTimedS2CPacket {
|
public class WhoChannelResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string ChannelName;
|
private readonly string ChannelName;
|
||||||
private readonly string[] Users;
|
private readonly string[] Users;
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class WhoServerResponseS2CPacket : SockChatTimedS2CPacket {
|
public class WhoServerResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string[] Users;
|
private readonly string[] Users;
|
||||||
private readonly string SelfName;
|
private readonly string SelfName;
|
|
@ -1,4 +1,4 @@
|
||||||
namespace SharpChat.PacketsS2C {
|
namespace SharpChat.SockChat.PacketsS2C {
|
||||||
public class WhoisResponseS2CPacket : SockChatTimedS2CPacket {
|
public class WhoisResponseS2CPacket : SockChatTimedS2CPacket {
|
||||||
private readonly string UserName;
|
private readonly string UserName;
|
||||||
private readonly string RemoteAddress;
|
private readonly string RemoteAddress;
|
17
SharpChat.SockChat/SharpChat.SockChat.csproj
Normal file
17
SharpChat.SockChat/SharpChat.SockChat.csproj
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Fleck" Version="1.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SharpChat.Misuzu\SharpChat.Misuzu.csproj" />
|
||||||
|
<ProjectReference Include="..\SharpChatCommon\SharpChatCommon.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -1,10 +1,10 @@
|
||||||
using Fleck;
|
using Fleck;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat.SockChat {
|
||||||
public class ConnectionInfo {
|
public class SockChatConnectionInfo {
|
||||||
public IWebSocketConnection Socket { get; }
|
public IWebSocketConnection Socket { get; }
|
||||||
public DateTimeOffset LastPing { get; private set; }
|
public DateTimeOffset LastPing { get; private set; }
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace SharpChat {
|
||||||
public ushort RemotePort { get; }
|
public ushort RemotePort { get; }
|
||||||
public string RemoteEndPoint { get; }
|
public string RemoteEndPoint { get; }
|
||||||
|
|
||||||
public ConnectionInfo(IWebSocketConnection sock) {
|
public SockChatConnectionInfo(IWebSocketConnection sock) {
|
||||||
Socket = sock;
|
Socket = sock;
|
||||||
|
|
||||||
BumpPing();
|
BumpPing();
|
|
@ -2,31 +2,31 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat.SockChat {
|
||||||
public class ConnectionsContext {
|
public class SockChatConnectionsContext {
|
||||||
public static readonly TimeSpan TimeOut = TimeSpan.FromMinutes(5);
|
public static readonly TimeSpan TimeOut = TimeSpan.FromMinutes(5);
|
||||||
|
|
||||||
private readonly HashSet<ConnectionInfo> Connections = new();
|
private readonly HashSet<SockChatConnectionInfo> Connections = new();
|
||||||
private readonly HashSet<ConnectionInfo> AuthedConnections = new();
|
private readonly HashSet<SockChatConnectionInfo> AuthedConnections = new();
|
||||||
private readonly Dictionary<long, HashSet<ConnectionInfo>> UserConnections = new();
|
private readonly Dictionary<long, HashSet<SockChatConnectionInfo>> UserConnections = new();
|
||||||
|
|
||||||
public ConnectionInfo[] All => Connections.ToArray();
|
public SockChatConnectionInfo[] All => Connections.ToArray();
|
||||||
public ConnectionInfo[] Authed => AuthedConnections.ToArray();
|
public SockChatConnectionInfo[] Authed => AuthedConnections.ToArray();
|
||||||
|
|
||||||
public void WithAll(Action<ConnectionInfo> body) {
|
public void WithAll(Action<SockChatConnectionInfo> body) {
|
||||||
foreach(ConnectionInfo conn in Connections)
|
foreach(SockChatConnectionInfo conn in Connections)
|
||||||
body(conn);
|
body(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WithAuthed(Action<ConnectionInfo> body) {
|
public void WithAuthed(Action<SockChatConnectionInfo> body) {
|
||||||
foreach(ConnectionInfo conn in AuthedConnections)
|
foreach(SockChatConnectionInfo conn in AuthedConnections)
|
||||||
body(conn);
|
body(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectionInfo[] GetTimedOut() {
|
public SockChatConnectionInfo[] GetTimedOut() {
|
||||||
List<ConnectionInfo> conns = new();
|
List<SockChatConnectionInfo> conns = new();
|
||||||
|
|
||||||
foreach(ConnectionInfo conn in Connections)
|
foreach(SockChatConnectionInfo conn in Connections)
|
||||||
if(DateTimeOffset.UtcNow - conn.LastPing > TimeOut)
|
if(DateTimeOffset.UtcNow - conn.LastPing > TimeOut)
|
||||||
conns.Add(conn);
|
conns.Add(conn);
|
||||||
|
|
||||||
|
@ -49,33 +49,33 @@ namespace SharpChat {
|
||||||
return HasUser(userInfo.UserId);
|
return HasUser(userInfo.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectionInfo[] GetUser(long userId) {
|
public SockChatConnectionInfo[] GetUser(long userId) {
|
||||||
if(!UserConnections.ContainsKey(userId))
|
if(!UserConnections.ContainsKey(userId))
|
||||||
return Array.Empty<ConnectionInfo>();
|
return Array.Empty<SockChatConnectionInfo>();
|
||||||
|
|
||||||
return UserConnections[userId].ToArray();
|
return UserConnections[userId].ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectionInfo[] GetUser(UserInfo userInfo) {
|
public SockChatConnectionInfo[] GetUser(UserInfo userInfo) {
|
||||||
return GetUser(userInfo.UserId);
|
return GetUser(userInfo.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WithUser(long userId, Action<ConnectionInfo> body) {
|
public void WithUser(long userId, Action<SockChatConnectionInfo> body) {
|
||||||
if(!UserConnections.ContainsKey(userId))
|
if(!UserConnections.ContainsKey(userId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach(ConnectionInfo conn in UserConnections[userId])
|
foreach(SockChatConnectionInfo conn in UserConnections[userId])
|
||||||
body(conn);
|
body(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WithUser(UserInfo userInfo, Action<ConnectionInfo> body) {
|
public void WithUser(UserInfo userInfo, Action<SockChatConnectionInfo> body) {
|
||||||
WithUser(userInfo.UserId, body);
|
WithUser(userInfo.UserId, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetAllRemoteAddresses() {
|
public string[] GetAllRemoteAddresses() {
|
||||||
HashSet<string> addrs = new();
|
HashSet<string> addrs = new();
|
||||||
|
|
||||||
foreach(ConnectionInfo conn in Connections)
|
foreach(SockChatConnectionInfo conn in Connections)
|
||||||
addrs.Add(conn.RemoteAddress);
|
addrs.Add(conn.RemoteAddress);
|
||||||
|
|
||||||
return addrs.ToArray();
|
return addrs.ToArray();
|
||||||
|
@ -84,7 +84,7 @@ namespace SharpChat {
|
||||||
public string[] GetAuthedRemoteAddresses() {
|
public string[] GetAuthedRemoteAddresses() {
|
||||||
HashSet<string> addrs = new();
|
HashSet<string> addrs = new();
|
||||||
|
|
||||||
foreach(ConnectionInfo conn in AuthedConnections)
|
foreach(SockChatConnectionInfo conn in AuthedConnections)
|
||||||
addrs.Add(conn.RemoteAddress);
|
addrs.Add(conn.RemoteAddress);
|
||||||
|
|
||||||
return addrs.ToArray();
|
return addrs.ToArray();
|
||||||
|
@ -96,7 +96,7 @@ namespace SharpChat {
|
||||||
|
|
||||||
HashSet<string> addrs = new();
|
HashSet<string> addrs = new();
|
||||||
|
|
||||||
foreach(ConnectionInfo conn in UserConnections[userId])
|
foreach(SockChatConnectionInfo conn in UserConnections[userId])
|
||||||
addrs.Add(conn.RemoteAddress);
|
addrs.Add(conn.RemoteAddress);
|
||||||
|
|
||||||
return addrs.ToArray();
|
return addrs.ToArray();
|
||||||
|
@ -106,7 +106,7 @@ namespace SharpChat {
|
||||||
return GetUserRemoteAddresses(userInfo.UserId);
|
return GetUserRemoteAddresses(userInfo.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(ConnectionInfo conn) {
|
public void Add(SockChatConnectionInfo conn) {
|
||||||
if(Connections.Contains(conn))
|
if(Connections.Contains(conn))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace SharpChat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(ConnectionInfo conn) {
|
public void Remove(SockChatConnectionInfo conn) {
|
||||||
if(Connections.Contains(conn))
|
if(Connections.Contains(conn))
|
||||||
Connections.Remove(conn);
|
Connections.Remove(conn);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace SharpChat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetUser(ConnectionInfo conn, long userId) {
|
public void SetUser(SockChatConnectionInfo conn, long userId) {
|
||||||
if(!Connections.Contains(conn))
|
if(!Connections.Contains(conn))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ namespace SharpChat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetUser(ConnectionInfo conn, UserInfo userInfo) {
|
public void SetUser(SockChatConnectionInfo conn, UserInfo userInfo) {
|
||||||
SetUser(conn, userInfo.UserId);
|
SetUser(conn, userInfo.UserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,23 +1,24 @@
|
||||||
using SharpChat.Events;
|
using SharpChat.Events;
|
||||||
using SharpChat.EventStorage;
|
using SharpChat.EventStorage;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat;
|
||||||
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat {
|
||||||
public class ChatContext {
|
public class SockChatContext {
|
||||||
public readonly SemaphoreSlim ContextAccess = new(1, 1);
|
public readonly SemaphoreSlim ContextAccess = new(1, 1);
|
||||||
|
|
||||||
public ChannelsContext Channels { get; } = new();
|
public ChannelsContext Channels { get; } = new();
|
||||||
public ConnectionsContext Connections { get; } = new();
|
public SockChatConnectionsContext Connections { get; } = new();
|
||||||
public UsersContext Users { get; } = new();
|
public UsersContext Users { get; } = new();
|
||||||
public IEventStorage Events { get; }
|
public IEventStorage Events { get; }
|
||||||
public ChannelsUsersContext ChannelsUsers { get; } = new();
|
public ChannelsUsersContext ChannelsUsers { get; } = new();
|
||||||
public Dictionary<long, RateLimiter> UserRateLimiters { get; } = new();
|
public Dictionary<long, RateLimiter> UserRateLimiters { get; } = new();
|
||||||
|
|
||||||
public ChatContext(IEventStorage evtStore) {
|
public SockChatContext(IEventStorage evtStore) {
|
||||||
Events = evtStore;
|
Events = evtStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +79,8 @@ namespace SharpChat {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update() {
|
public void Update() {
|
||||||
ConnectionInfo[] timedOut = Connections.GetTimedOut();
|
SockChatConnectionInfo[] timedOut = Connections.GetTimedOut();
|
||||||
foreach(ConnectionInfo conn in timedOut) {
|
foreach(SockChatConnectionInfo conn in timedOut) {
|
||||||
Connections.Remove(conn);
|
Connections.Remove(conn);
|
||||||
conn.Close(1002);
|
conn.Close(1002);
|
||||||
|
|
||||||
|
@ -189,8 +190,8 @@ namespace SharpChat {
|
||||||
} else
|
} else
|
||||||
SendTo(user, new ForceDisconnectS2CPacket());
|
SendTo(user, new ForceDisconnectS2CPacket());
|
||||||
|
|
||||||
ConnectionInfo[] conns = Connections.GetUser(user);
|
SockChatConnectionInfo[] conns = Connections.GetUser(user);
|
||||||
foreach(ConnectionInfo conn in conns) {
|
foreach(SockChatConnectionInfo conn in conns) {
|
||||||
Connections.Remove(conn);
|
Connections.Remove(conn);
|
||||||
conn.Close(1000);
|
conn.Close(1000);
|
||||||
|
|
||||||
|
@ -242,7 +243,7 @@ namespace SharpChat {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleJoin(UserInfo user, ChannelInfo chan, ConnectionInfo conn, int maxMsgLength) {
|
public void HandleJoin(UserInfo user, ChannelInfo chan, SockChatConnectionInfo conn, int maxMsgLength) {
|
||||||
if(!ChannelsUsers.Has(chan, user)) {
|
if(!ChannelsUsers.Has(chan, user)) {
|
||||||
SendTo(chan, new UserConnectS2CPacket(
|
SendTo(chan, new UserConnectS2CPacket(
|
||||||
user.UserId,
|
user.UserId,
|
|
@ -1,17 +1,17 @@
|
||||||
using Fleck;
|
using Fleck;
|
||||||
using SharpChat.Commands;
|
|
||||||
using SharpChat.Config;
|
using SharpChat.Config;
|
||||||
using SharpChat.EventStorage;
|
using SharpChat.EventStorage;
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
using SharpChat.PacketsS2C;
|
using SharpChat.SockChat.Commands;
|
||||||
using SharpChat.PacketsC2S;
|
using SharpChat.SockChat.PacketsC2S;
|
||||||
|
using SharpChat.SockChat.PacketsS2C;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat.SockChat {
|
||||||
public class SockChatServer : IDisposable {
|
public class SockChatServer : IDisposable {
|
||||||
public const ushort DEFAULT_PORT = 6770;
|
public const ushort DEFAULT_PORT = 6770;
|
||||||
public const int DEFAULT_MSG_LENGTH_MAX = 5000;
|
public const int DEFAULT_MSG_LENGTH_MAX = 5000;
|
||||||
|
@ -19,7 +19,7 @@ namespace SharpChat {
|
||||||
public const int DEFAULT_FLOOD_KICK_LENGTH = 30;
|
public const int DEFAULT_FLOOD_KICK_LENGTH = 30;
|
||||||
|
|
||||||
public IWebSocketServer Server { get; }
|
public IWebSocketServer Server { get; }
|
||||||
public ChatContext Context { get; }
|
public SockChatContext Context { get; }
|
||||||
|
|
||||||
private readonly HttpClient HttpClient;
|
private readonly HttpClient HttpClient;
|
||||||
private readonly MisuzuClient Misuzu;
|
private readonly MisuzuClient Misuzu;
|
||||||
|
@ -46,7 +46,7 @@ namespace SharpChat {
|
||||||
MaxConnections = config.ReadCached("connMaxCount", DEFAULT_MAX_CONNECTIONS);
|
MaxConnections = config.ReadCached("connMaxCount", DEFAULT_MAX_CONNECTIONS);
|
||||||
FloodKickLength = config.ReadCached("floodKickLength", DEFAULT_FLOOD_KICK_LENGTH);
|
FloodKickLength = config.ReadCached("floodKickLength", DEFAULT_FLOOD_KICK_LENGTH);
|
||||||
|
|
||||||
Context = new ChatContext(evtStore);
|
Context = new SockChatContext(evtStore);
|
||||||
|
|
||||||
string[]? channelNames = config.ReadValue("channels", new[] { "lounge" });
|
string[]? channelNames = config.ReadValue("channels", new[] { "lounge" });
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ namespace SharpChat {
|
||||||
});
|
});
|
||||||
|
|
||||||
ushort port = config.SafeReadValue("port", DEFAULT_PORT);
|
ushort port = config.SafeReadValue("port", DEFAULT_PORT);
|
||||||
Server = new SharpChatWebSocketServer($"ws://0.0.0.0:{port}");
|
Server = new SockChatWebSocketServer($"ws://0.0.0.0:{port}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Listen(ManualResetEvent waitHandle) {
|
public void Listen(ManualResetEvent waitHandle) {
|
||||||
|
@ -124,7 +124,7 @@ namespace SharpChat {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionInfo conn = new(sock);
|
SockChatConnectionInfo conn = new(sock);
|
||||||
Context.Connections.Add(conn);
|
Context.Connections.Add(conn);
|
||||||
|
|
||||||
sock.OnOpen = () => OnOpen(conn);
|
sock.OnOpen = () => OnOpen(conn);
|
||||||
|
@ -136,17 +136,17 @@ namespace SharpChat {
|
||||||
Logger.Write("Listening...");
|
Logger.Write("Listening...");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnOpen(ConnectionInfo conn) {
|
private void OnOpen(SockChatConnectionInfo conn) {
|
||||||
Logger.Write($"Connection opened from {conn.RemoteEndPoint}");
|
Logger.Write($"Connection opened from {conn.RemoteEndPoint}");
|
||||||
Context.SafeUpdate();
|
Context.SafeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnError(ConnectionInfo conn, Exception ex) {
|
private void OnError(SockChatConnectionInfo conn, Exception ex) {
|
||||||
Logger.Write($"<{conn.RemoteEndPoint}> {ex}");
|
Logger.Write($"<{conn.RemoteEndPoint}> {ex}");
|
||||||
Context.SafeUpdate();
|
Context.SafeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClose(ConnectionInfo conn) {
|
private void OnClose(SockChatConnectionInfo conn) {
|
||||||
Logger.Write($"Connection closed from {conn.RemoteEndPoint}");
|
Logger.Write($"Connection closed from {conn.RemoteEndPoint}");
|
||||||
|
|
||||||
Context.ContextAccess.Wait();
|
Context.ContextAccess.Wait();
|
||||||
|
@ -165,7 +165,7 @@ namespace SharpChat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMessage(ConnectionInfo conn, string msg) {
|
private void OnMessage(SockChatConnectionInfo conn, string msg) {
|
||||||
Context.SafeUpdate();
|
Context.SafeUpdate();
|
||||||
|
|
||||||
// this doesn't affect non-authed connections?????
|
// this doesn't affect non-authed connections?????
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat.SockChat {
|
||||||
public static class SockChatUtility {
|
public static class SockChatUtility {
|
||||||
private static readonly Regex ChannelName = new(@"[^A-Za-z0-9\-_]", RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
private static readonly Regex ChannelName = new(@"[^A-Za-z0-9\-_]", RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||||
|
|
|
@ -16,13 +16,13 @@ using System.Text;
|
||||||
// https://github.com/statianzo/Fleck/blob/1.1.0/src/Fleck/WebSocketServer.cs
|
// https://github.com/statianzo/Fleck/blob/1.1.0/src/Fleck/WebSocketServer.cs
|
||||||
|
|
||||||
namespace SharpChat {
|
namespace SharpChat {
|
||||||
public class SharpChatWebSocketServer : IWebSocketServer {
|
public class SockChatWebSocketServer : IWebSocketServer {
|
||||||
|
|
||||||
private readonly string _scheme;
|
private readonly string _scheme;
|
||||||
private readonly IPAddress _locationIP;
|
private readonly IPAddress _locationIP;
|
||||||
private Action<IWebSocketConnection> _config;
|
private Action<IWebSocketConnection> _config;
|
||||||
|
|
||||||
public SharpChatWebSocketServer(string location, bool supportDualStack = true) {
|
public SockChatWebSocketServer(string location, bool supportDualStack = true) {
|
||||||
Uri uri = new(location);
|
Uri uri = new(location);
|
||||||
|
|
||||||
Port = uri.Port;
|
Port = uri.Port;
|
|
@ -16,6 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
start.sh = start.sh
|
start.sh = start.sh
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpChatCommon", "SharpChatCommon\SharpChatCommon.csproj", "{B2228E3C-E0DB-4AAF-A603-2A822B531F76}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpChat.SockChat", "SharpChat.SockChat\SharpChat.SockChat.csproj", "{4D48CCFB-5D3B-4AB6-AF94-04377474078C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpChat.Misuzu", "SharpChat.Misuzu\SharpChat.Misuzu.csproj", "{08FD8B99-011A-43F9-A6C9-A3C1979604CF}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -26,6 +32,18 @@ Global
|
||||||
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DDB24C19-B802-4C96-AC15-0449C6FC77F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B2228E3C-E0DB-4AAF-A603-2A822B531F76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B2228E3C-E0DB-4AAF-A603-2A822B531F76}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B2228E3C-E0DB-4AAF-A603-2A822B531F76}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B2228E3C-E0DB-4AAF-A603-2A822B531F76}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4D48CCFB-5D3B-4AB6-AF94-04377474078C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4D48CCFB-5D3B-4AB6-AF94-04377474078C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4D48CCFB-5D3B-4AB6-AF94-04377474078C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4D48CCFB-5D3B-4AB6-AF94-04377474078C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{08FD8B99-011A-43F9-A6C9-A3C1979604CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{08FD8B99-011A-43F9-A6C9-A3C1979604CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{08FD8B99-011A-43F9-A6C9-A3C1979604CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{08FD8B99-011A-43F9-A6C9-A3C1979604CF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using SharpChat.Config;
|
using SharpChat.Config;
|
||||||
using SharpChat.EventStorage;
|
using SharpChat.EventStorage;
|
||||||
using SharpChat.Misuzu;
|
using SharpChat.Misuzu;
|
||||||
|
using SharpChat.SockChat;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Fleck" Version="1.2.0" />
|
|
||||||
<PackageReference Include="MySqlConnector" Version="2.3.7" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="git describe --tags --abbrev=0 --always > version.txt" />
|
<Exec Command="git describe --tags --abbrev=0 --always > version.txt" />
|
||||||
</Target>
|
</Target>
|
||||||
|
@ -23,4 +18,10 @@
|
||||||
<EmbeddedResource Include="version.txt" />
|
<EmbeddedResource Include="version.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SharpChat.Misuzu\SharpChat.Misuzu.csproj" />
|
||||||
|
<ProjectReference Include="..\SharpChat.SockChat\SharpChat.SockChat.csproj" />
|
||||||
|
<ProjectReference Include="..\SharpChatCommon\SharpChatCommon.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace SharpChat {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try {
|
try {
|
||||||
using Stream? s = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"SharpChat.version.txt");
|
using Stream? s = Assembly.GetEntryAssembly()?.GetManifestResourceStream(@"SharpChat.version.txt");
|
||||||
if(s != null) {
|
if(s != null) {
|
||||||
using StreamReader sr = new(s);
|
using StreamReader sr = new(s);
|
||||||
VersionString = sr.ReadLine()?.Trim() ?? string.Empty;
|
VersionString = sr.ReadLine()?.Trim() ?? string.Empty;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue