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
121 changed files with 229 additions and 166 deletions
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.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class BanListCommand : ISockChatClientCommand {
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class ChannelCreateCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("create");
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class ChannelDeleteCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("delchan") || (
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class ChannelJoinCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
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 bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("pwd")
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class ChannelRankCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("rank")
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public interface ISockChatClientCommand {
|
||||
bool IsMatch(SockChatClientCommandContext ctx);
|
||||
void Dispatch(SockChatClientCommandContext ctx);
|
|
@ -1,10 +1,10 @@
|
|||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class KickBanCommand : ISockChatClientCommand {
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class MessageActionCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("action")
|
|
@ -1,8 +1,8 @@
|
|||
using SharpChat.Events;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class MessageBroadcastCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("say")
|
|
@ -1,8 +1,8 @@
|
|||
using SharpChat.EventStorage;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class MessageDeleteCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("delmsg") || (
|
|
@ -1,9 +1,9 @@
|
|||
using SharpChat.Events;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class MessageWhisperCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("whisper")
|
|
@ -1,10 +1,10 @@
|
|||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class PardonAddressCommand : ISockChatClientCommand {
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class PardonUserCommand : ISockChatClientCommand {
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class ShutdownRestartCommand : ISockChatClientCommand {
|
||||
private readonly ManualResetEvent WaitHandle;
|
||||
private readonly Func<bool> ShuttingDown;
|
|
@ -1,20 +1,20 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class SockChatClientCommandContext {
|
||||
public string Name { get; }
|
||||
public string[] Args { get; }
|
||||
public ChatContext Chat { get; }
|
||||
public SockChatContext Chat { get; }
|
||||
public UserInfo User { get; }
|
||||
public ConnectionInfo Connection { get; }
|
||||
public SockChatConnectionInfo Connection { get; }
|
||||
public ChannelInfo Channel { get; }
|
||||
|
||||
public SockChatClientCommandContext(
|
||||
string text,
|
||||
ChatContext chat,
|
||||
SockChatContext chat,
|
||||
UserInfo user,
|
||||
ConnectionInfo connection,
|
||||
SockChatConnectionInfo connection,
|
||||
ChannelInfo channel
|
||||
) {
|
||||
Chat = chat;
|
|
@ -1,6 +1,6 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class UserAFKCommand : ISockChatClientCommand {
|
||||
private const string DEFAULT = "AFK";
|
||||
private const int MAX_LENGTH = 5;
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class UserNickCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("nick");
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class WhoCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("who");
|
|
@ -1,7 +1,7 @@
|
|||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.Commands {
|
||||
namespace SharpChat.SockChat.Commands {
|
||||
public class WhoisCommand : ISockChatClientCommand {
|
||||
public bool IsMatch(SockChatClientCommandContext ctx) {
|
||||
return ctx.NameEquals("ip")
|
|
@ -1,13 +1,13 @@
|
|||
using SharpChat.Config;
|
||||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.PacketsC2S {
|
||||
namespace SharpChat.SockChat.PacketsC2S {
|
||||
public class AuthC2SPacketHandler : IC2SPacketHandler {
|
||||
public const string MOTD_FILE = @"welcome.txt";
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
namespace SharpChat.PacketsC2S {
|
||||
namespace SharpChat.SockChat.PacketsC2S {
|
||||
public class C2SPacketHandlerContext {
|
||||
public string Text { get; }
|
||||
public ChatContext Chat { get; }
|
||||
public ConnectionInfo Connection { get; }
|
||||
public SockChatContext Chat { get; }
|
||||
public SockChatConnectionInfo Connection { get; }
|
||||
|
||||
public C2SPacketHandlerContext(string text, ChatContext chat, ConnectionInfo connection) {
|
||||
public C2SPacketHandlerContext(string text, SockChatContext chat, SockChatConnectionInfo connection) {
|
||||
Text = text;
|
||||
Chat = chat;
|
||||
Connection = connection;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsC2S {
|
||||
namespace SharpChat.SockChat.PacketsC2S {
|
||||
public interface IC2SPacketHandler {
|
||||
bool IsMatch(C2SPacketHandlerContext ctx);
|
||||
void Handle(C2SPacketHandlerContext ctx);
|
|
@ -1,11 +1,11 @@
|
|||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpChat.PacketsC2S {
|
||||
namespace SharpChat.SockChat.PacketsC2S {
|
||||
public class PingC2SPacketHandler : IC2SPacketHandler {
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using SharpChat.Commands;
|
||||
using SharpChat.Config;
|
||||
using SharpChat.Config;
|
||||
using SharpChat.Events;
|
||||
using SharpChat.SockChat.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat.PacketsC2S {
|
||||
namespace SharpChat.SockChat.PacketsC2S {
|
||||
public class SendMessageC2SPacketHandler : IC2SPacketHandler {
|
||||
private readonly CachedValue<int> MaxMessageLength;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class AuthFailS2CPacket : SockChatS2CPacket {
|
||||
public enum FailReason {
|
||||
AuthInvalid,
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class AuthSuccessS2CPacket : SockChatS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class BanListResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string[] Bans;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelCreateResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelCreateS2CPacket : SockChatS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
private readonly bool ChannelHasPassword;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelDeleteResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelDeleteS2CPacket : SockChatS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelNameFormatErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelPasswordChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelPasswordWrongErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelRankChangedResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelRankTooHighErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelRankTooLowErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelUpdateS2CPacket : SockChatS2CPacket {
|
||||
private readonly string ChannelNamePrevious;
|
||||
private readonly string ChannelNameNew;
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ChannelsPopulateS2CPacket : SockChatS2CPacket {
|
||||
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 override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class CommandNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string CommandName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ContextClearS2CPacket : SockChatS2CPacket {
|
||||
public enum ClearMode {
|
||||
Messages = 0,
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class FloodWarningS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class ForceDisconnectS2CPacket : SockChatS2CPacket {
|
||||
private readonly long Expires;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class KickBanNoRecordErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string TargetName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class KickBanNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MOTDS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string Body;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MessageAddLogS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MessageAddS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string Body;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MessageBroadcastS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string Body;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MessageDeleteNotAllowedErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
public override string Pack() {
|
||||
return string.Format(
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class MessageDeleteS2CPacket : SockChatS2CPacket {
|
||||
private readonly long DeletedMessageId;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class PardonResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string Subject;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class PongS2CPacket : SockChatS2CPacket {
|
||||
public override string Pack() {
|
||||
return "0\tpong";
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public abstract class SockChatS2CPacket {
|
||||
protected readonly long MessageId;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public abstract class SockChatTimedS2CPacket : SockChatS2CPacket {
|
||||
protected readonly DateTimeOffset TimeStamp;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserChannelForceJoinS2CPacket : SockChatS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserChannelJoinLogS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserChannelJoinS2CPacket : SockChatS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserChannelLeaveLogS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserChannelLeaveS2CPacket : SockChatS2CPacket {
|
||||
private readonly long UserId;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserConnectLogS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserConnectS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserDisconnectLogS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
private readonly UserDisconnectReason Reason;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserDisconnectS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserNameInUseErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserNotFoundErrorS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserUpdateNotificationS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string PreviousName;
|
||||
private readonly string NewName;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UserUpdateS2CPacket : SockChatS2CPacket {
|
||||
private readonly long UserId;
|
||||
private readonly string UserName;
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class UsersPopulateS2CPacket : SockChatS2CPacket {
|
||||
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 {
|
||||
private readonly string ChannelName;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class WhoChannelResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string ChannelName;
|
||||
private readonly string[] Users;
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class WhoServerResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string[] Users;
|
||||
private readonly string SelfName;
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpChat.PacketsS2C {
|
||||
namespace SharpChat.SockChat.PacketsS2C {
|
||||
public class WhoisResponseS2CPacket : SockChatTimedS2CPacket {
|
||||
private readonly string UserName;
|
||||
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 SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace SharpChat {
|
||||
public class ConnectionInfo {
|
||||
namespace SharpChat.SockChat {
|
||||
public class SockChatConnectionInfo {
|
||||
public IWebSocketConnection Socket { get; }
|
||||
public DateTimeOffset LastPing { get; private set; }
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace SharpChat {
|
|||
public ushort RemotePort { get; }
|
||||
public string RemoteEndPoint { get; }
|
||||
|
||||
public ConnectionInfo(IWebSocketConnection sock) {
|
||||
public SockChatConnectionInfo(IWebSocketConnection sock) {
|
||||
Socket = sock;
|
||||
|
||||
BumpPing();
|
|
@ -2,31 +2,31 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpChat {
|
||||
public class ConnectionsContext {
|
||||
namespace SharpChat.SockChat {
|
||||
public class SockChatConnectionsContext {
|
||||
public static readonly TimeSpan TimeOut = TimeSpan.FromMinutes(5);
|
||||
|
||||
private readonly HashSet<ConnectionInfo> Connections = new();
|
||||
private readonly HashSet<ConnectionInfo> AuthedConnections = new();
|
||||
private readonly Dictionary<long, HashSet<ConnectionInfo>> UserConnections = new();
|
||||
private readonly HashSet<SockChatConnectionInfo> Connections = new();
|
||||
private readonly HashSet<SockChatConnectionInfo> AuthedConnections = new();
|
||||
private readonly Dictionary<long, HashSet<SockChatConnectionInfo>> UserConnections = new();
|
||||
|
||||
public ConnectionInfo[] All => Connections.ToArray();
|
||||
public ConnectionInfo[] Authed => AuthedConnections.ToArray();
|
||||
public SockChatConnectionInfo[] All => Connections.ToArray();
|
||||
public SockChatConnectionInfo[] Authed => AuthedConnections.ToArray();
|
||||
|
||||
public void WithAll(Action<ConnectionInfo> body) {
|
||||
foreach(ConnectionInfo conn in Connections)
|
||||
public void WithAll(Action<SockChatConnectionInfo> body) {
|
||||
foreach(SockChatConnectionInfo conn in Connections)
|
||||
body(conn);
|
||||
}
|
||||
|
||||
public void WithAuthed(Action<ConnectionInfo> body) {
|
||||
foreach(ConnectionInfo conn in AuthedConnections)
|
||||
public void WithAuthed(Action<SockChatConnectionInfo> body) {
|
||||
foreach(SockChatConnectionInfo conn in AuthedConnections)
|
||||
body(conn);
|
||||
}
|
||||
|
||||
public ConnectionInfo[] GetTimedOut() {
|
||||
List<ConnectionInfo> conns = new();
|
||||
public SockChatConnectionInfo[] GetTimedOut() {
|
||||
List<SockChatConnectionInfo> conns = new();
|
||||
|
||||
foreach(ConnectionInfo conn in Connections)
|
||||
foreach(SockChatConnectionInfo conn in Connections)
|
||||
if(DateTimeOffset.UtcNow - conn.LastPing > TimeOut)
|
||||
conns.Add(conn);
|
||||
|
||||
|
@ -49,33 +49,33 @@ namespace SharpChat {
|
|||
return HasUser(userInfo.UserId);
|
||||
}
|
||||
|
||||
public ConnectionInfo[] GetUser(long userId) {
|
||||
public SockChatConnectionInfo[] GetUser(long userId) {
|
||||
if(!UserConnections.ContainsKey(userId))
|
||||
return Array.Empty<ConnectionInfo>();
|
||||
return Array.Empty<SockChatConnectionInfo>();
|
||||
|
||||
return UserConnections[userId].ToArray();
|
||||
}
|
||||
|
||||
public ConnectionInfo[] GetUser(UserInfo userInfo) {
|
||||
public SockChatConnectionInfo[] GetUser(UserInfo userInfo) {
|
||||
return GetUser(userInfo.UserId);
|
||||
}
|
||||
|
||||
public void WithUser(long userId, Action<ConnectionInfo> body) {
|
||||
public void WithUser(long userId, Action<SockChatConnectionInfo> body) {
|
||||
if(!UserConnections.ContainsKey(userId))
|
||||
return;
|
||||
|
||||
foreach(ConnectionInfo conn in UserConnections[userId])
|
||||
foreach(SockChatConnectionInfo conn in UserConnections[userId])
|
||||
body(conn);
|
||||
}
|
||||
|
||||
public void WithUser(UserInfo userInfo, Action<ConnectionInfo> body) {
|
||||
public void WithUser(UserInfo userInfo, Action<SockChatConnectionInfo> body) {
|
||||
WithUser(userInfo.UserId, body);
|
||||
}
|
||||
|
||||
public string[] GetAllRemoteAddresses() {
|
||||
HashSet<string> addrs = new();
|
||||
|
||||
foreach(ConnectionInfo conn in Connections)
|
||||
foreach(SockChatConnectionInfo conn in Connections)
|
||||
addrs.Add(conn.RemoteAddress);
|
||||
|
||||
return addrs.ToArray();
|
||||
|
@ -84,7 +84,7 @@ namespace SharpChat {
|
|||
public string[] GetAuthedRemoteAddresses() {
|
||||
HashSet<string> addrs = new();
|
||||
|
||||
foreach(ConnectionInfo conn in AuthedConnections)
|
||||
foreach(SockChatConnectionInfo conn in AuthedConnections)
|
||||
addrs.Add(conn.RemoteAddress);
|
||||
|
||||
return addrs.ToArray();
|
||||
|
@ -96,7 +96,7 @@ namespace SharpChat {
|
|||
|
||||
HashSet<string> addrs = new();
|
||||
|
||||
foreach(ConnectionInfo conn in UserConnections[userId])
|
||||
foreach(SockChatConnectionInfo conn in UserConnections[userId])
|
||||
addrs.Add(conn.RemoteAddress);
|
||||
|
||||
return addrs.ToArray();
|
||||
|
@ -106,7 +106,7 @@ namespace SharpChat {
|
|||
return GetUserRemoteAddresses(userInfo.UserId);
|
||||
}
|
||||
|
||||
public void Add(ConnectionInfo conn) {
|
||||
public void Add(SockChatConnectionInfo conn) {
|
||||
if(Connections.Contains(conn))
|
||||
return;
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace SharpChat {
|
|||
}
|
||||
}
|
||||
|
||||
public void Remove(ConnectionInfo conn) {
|
||||
public void Remove(SockChatConnectionInfo conn) {
|
||||
if(Connections.Contains(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))
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,23 +1,24 @@
|
|||
using SharpChat.Events;
|
||||
using SharpChat.EventStorage;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.SockChat;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace SharpChat {
|
||||
public class ChatContext {
|
||||
public class SockChatContext {
|
||||
public readonly SemaphoreSlim ContextAccess = new(1, 1);
|
||||
|
||||
public ChannelsContext Channels { get; } = new();
|
||||
public ConnectionsContext Connections { get; } = new();
|
||||
public SockChatConnectionsContext Connections { get; } = new();
|
||||
public UsersContext Users { get; } = new();
|
||||
public IEventStorage Events { get; }
|
||||
public ChannelsUsersContext ChannelsUsers { get; } = new();
|
||||
public Dictionary<long, RateLimiter> UserRateLimiters { get; } = new();
|
||||
|
||||
public ChatContext(IEventStorage evtStore) {
|
||||
public SockChatContext(IEventStorage evtStore) {
|
||||
Events = evtStore;
|
||||
}
|
||||
|
||||
|
@ -78,8 +79,8 @@ namespace SharpChat {
|
|||
}
|
||||
|
||||
public void Update() {
|
||||
ConnectionInfo[] timedOut = Connections.GetTimedOut();
|
||||
foreach(ConnectionInfo conn in timedOut) {
|
||||
SockChatConnectionInfo[] timedOut = Connections.GetTimedOut();
|
||||
foreach(SockChatConnectionInfo conn in timedOut) {
|
||||
Connections.Remove(conn);
|
||||
conn.Close(1002);
|
||||
|
||||
|
@ -189,8 +190,8 @@ namespace SharpChat {
|
|||
} else
|
||||
SendTo(user, new ForceDisconnectS2CPacket());
|
||||
|
||||
ConnectionInfo[] conns = Connections.GetUser(user);
|
||||
foreach(ConnectionInfo conn in conns) {
|
||||
SockChatConnectionInfo[] conns = Connections.GetUser(user);
|
||||
foreach(SockChatConnectionInfo conn in conns) {
|
||||
Connections.Remove(conn);
|
||||
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)) {
|
||||
SendTo(chan, new UserConnectS2CPacket(
|
||||
user.UserId,
|
|
@ -1,17 +1,17 @@
|
|||
using Fleck;
|
||||
using SharpChat.Commands;
|
||||
using SharpChat.Config;
|
||||
using SharpChat.EventStorage;
|
||||
using SharpChat.Misuzu;
|
||||
using SharpChat.PacketsS2C;
|
||||
using SharpChat.PacketsC2S;
|
||||
using SharpChat.SockChat.Commands;
|
||||
using SharpChat.SockChat.PacketsC2S;
|
||||
using SharpChat.SockChat.PacketsS2C;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
|
||||
namespace SharpChat {
|
||||
namespace SharpChat.SockChat {
|
||||
public class SockChatServer : IDisposable {
|
||||
public const ushort DEFAULT_PORT = 6770;
|
||||
public const int DEFAULT_MSG_LENGTH_MAX = 5000;
|
||||
|
@ -19,7 +19,7 @@ namespace SharpChat {
|
|||
public const int DEFAULT_FLOOD_KICK_LENGTH = 30;
|
||||
|
||||
public IWebSocketServer Server { get; }
|
||||
public ChatContext Context { get; }
|
||||
public SockChatContext Context { get; }
|
||||
|
||||
private readonly HttpClient HttpClient;
|
||||
private readonly MisuzuClient Misuzu;
|
||||
|
@ -46,7 +46,7 @@ namespace SharpChat {
|
|||
MaxConnections = config.ReadCached("connMaxCount", DEFAULT_MAX_CONNECTIONS);
|
||||
FloodKickLength = config.ReadCached("floodKickLength", DEFAULT_FLOOD_KICK_LENGTH);
|
||||
|
||||
Context = new ChatContext(evtStore);
|
||||
Context = new SockChatContext(evtStore);
|
||||
|
||||
string[]? channelNames = config.ReadValue("channels", new[] { "lounge" });
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace SharpChat {
|
|||
});
|
||||
|
||||
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) {
|
||||
|
@ -124,7 +124,7 @@ namespace SharpChat {
|
|||
return;
|
||||
}
|
||||
|
||||
ConnectionInfo conn = new(sock);
|
||||
SockChatConnectionInfo conn = new(sock);
|
||||
Context.Connections.Add(conn);
|
||||
|
||||
sock.OnOpen = () => OnOpen(conn);
|
||||
|
@ -136,17 +136,17 @@ namespace SharpChat {
|
|||
Logger.Write("Listening...");
|
||||
}
|
||||
|
||||
private void OnOpen(ConnectionInfo conn) {
|
||||
private void OnOpen(SockChatConnectionInfo conn) {
|
||||
Logger.Write($"Connection opened from {conn.RemoteEndPoint}");
|
||||
Context.SafeUpdate();
|
||||
}
|
||||
|
||||
private void OnError(ConnectionInfo conn, Exception ex) {
|
||||
private void OnError(SockChatConnectionInfo conn, Exception ex) {
|
||||
Logger.Write($"<{conn.RemoteEndPoint}> {ex}");
|
||||
Context.SafeUpdate();
|
||||
}
|
||||
|
||||
private void OnClose(ConnectionInfo conn) {
|
||||
private void OnClose(SockChatConnectionInfo conn) {
|
||||
Logger.Write($"Connection closed from {conn.RemoteEndPoint}");
|
||||
|
||||
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();
|
||||
|
||||
// this doesn't affect non-authed connections?????
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SharpChat {
|
||||
namespace SharpChat.SockChat {
|
||||
public static class SockChatUtility {
|
||||
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
|
||||
|
||||
namespace SharpChat {
|
||||
public class SharpChatWebSocketServer : IWebSocketServer {
|
||||
public class SockChatWebSocketServer : IWebSocketServer {
|
||||
|
||||
private readonly string _scheme;
|
||||
private readonly IPAddress _locationIP;
|
||||
private Action<IWebSocketConnection> _config;
|
||||
|
||||
public SharpChatWebSocketServer(string location, bool supportDualStack = true) {
|
||||
public SockChatWebSocketServer(string location, bool supportDualStack = true) {
|
||||
Uri uri = new(location);
|
||||
|
||||
Port = uri.Port;
|
|
@ -16,6 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
start.sh = start.sh
|
||||
EndProjectSection
|
||||
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
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
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}.Release|Any CPU.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using SharpChat.Config;
|
||||
using SharpChat.EventStorage;
|
||||
using SharpChat.Misuzu;
|
||||
using SharpChat.SockChat;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fleck" Version="1.2.0" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.3.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="git describe --tags --abbrev=0 --always > version.txt" />
|
||||
</Target>
|
||||
|
@ -23,4 +18,10 @@
|
|||
<EmbeddedResource Include="version.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpChat.Misuzu\SharpChat.Misuzu.csproj" />
|
||||
<ProjectReference Include="..\SharpChat.SockChat\SharpChat.SockChat.csproj" />
|
||||
<ProjectReference Include="..\SharpChatCommon\SharpChatCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace SharpChat {
|
|||
#endif
|
||||
|
||||
try {
|
||||
using Stream? s = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"SharpChat.version.txt");
|
||||
using Stream? s = Assembly.GetEntryAssembly()?.GetManifestResourceStream(@"SharpChat.version.txt");
|
||||
if(s != null) {
|
||||
using StreamReader sr = new(s);
|
||||
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