diff --git a/BarrageGrab/Modles/BusinessExecption.cs b/BarrageGrab/Modles/BusinessExecption.cs
new file mode 100644
index 0000000..6771c41
--- /dev/null
+++ b/BarrageGrab/Modles/BusinessExecption.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BarrageGrab.Modles
+{
+ ///
+ /// 业务异常
+ ///
+ public class BusinessExecption : Exception
+ {
+ ///
+ /// 错误码
+ ///
+ public int Code { get; set; } = -1;
+
+ ///
+ /// 异常附加数据
+ ///
+ public object ErrorTarget { get; set; } = null;
+
+ public BusinessExecption()
+ {
+
+ }
+
+ public BusinessExecption(string msg) : base(msg)
+ {
+ this.Code = -1;
+ }
+
+ public BusinessExecption(string msg,object data) : base(msg)
+ {
+ this.ErrorTarget = data;
+ }
+
+ public BusinessExecption(string msg, int code) : this(msg)
+ {
+ this.Code = code;
+ }
+ }
+}
diff --git a/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs b/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs
new file mode 100644
index 0000000..9960ec7
--- /dev/null
+++ b/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs
@@ -0,0 +1,306 @@
+namespace BarrageGrab.Modles.JsonEntity
+{
+ ///
+ /// 弹幕消息类型
+ ///
+ public enum BarrageMsgType
+ {
+ 无 = 0,
+ 弹幕消息 = 1,
+ 点赞消息 = 2,
+ 进直播间 = 3,
+ 关注消息 = 4,
+ 礼物消息 = 5,
+ 直播间统计 = 6,
+ 粉丝团消息 = 7,
+ 直播间分享 = 8,
+ 下播 = 9
+ }
+
+ ///
+ /// 粉丝团消息类型
+ ///
+ public enum FansclubType
+ {
+ 无 = 0,
+ 粉丝团升级 = 1,
+ 加入粉丝团 = 2
+ }
+
+ ///
+ /// 直播间分享目标
+ ///
+ public enum ShareType
+ {
+ 未知 = 0,
+ 微信 = 1,
+ 朋友圈 = 2,
+ 微博 = 3,
+ QQ空间 = 4,
+ QQ = 5,
+ 抖音好友 = 112
+ }
+
+
+ ///
+ /// 数据包装器
+ ///
+ public class BarrageMsgPack
+ {
+ ///
+ /// 消息类型
+ ///
+ public BarrageMsgType Type { get; set; }
+
+ ///
+ /// 消息对象
+ ///
+ public string Data { get; set; }
+
+ public BarrageMsgPack()
+ {
+
+ }
+
+ public BarrageMsgPack(string data, BarrageMsgType type)
+ {
+ Data = data;
+ Type = type;
+ }
+ }
+
+ ///
+ /// 消息
+ ///
+ public class Msg
+ {
+ ///
+ /// 弹幕ID
+ ///
+ public long MsgId { get; set; }
+
+ ///
+ /// 用户数据
+ ///
+ public MsgUser User { get; set; }
+
+ ///
+ /// 消息内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 房间号
+ ///
+ public long RoomId { get; set; }
+ }
+
+ ///
+ /// 粉丝团信息
+ ///
+ public class FansClubInfo
+ {
+ ///
+ /// 粉丝团名称
+ ///
+ public string ClubName { get; set; }
+
+ ///
+ /// 粉丝团等级,没加入则0
+ ///
+ public int Level { get; set; }
+ }
+
+ ///
+ /// 用户弹幕信息
+ ///
+ public class MsgUser
+ {
+ ///
+ /// 真实ID
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// ShortId
+ ///
+ public long ShortId { get; set; }
+
+ ///
+ /// 自定义ID
+ ///
+ public string DisplayId { get; set; }
+
+ ///
+ /// 昵称
+ ///
+ public string Nickname { get; set; }
+
+ ///
+ /// 未知
+ ///
+ public int Level { get; set; }
+
+ ///
+ /// 支付等级
+ ///
+ public int PayLevel { get; set; }
+
+ ///
+ /// 性别 1男 2女
+ ///
+ public int Gender { get; set; }
+
+ ///
+ /// 头像地址
+ ///
+ public string HeadImgUrl { get; set; }
+
+ ///
+ /// 用户主页地址
+ ///
+ public string SecUid { get; set; }
+
+ ///
+ /// 粉丝团信息
+ ///
+ public FansClubInfo FansClub { get; set; }
+
+ ///
+ /// 粉丝数
+ ///
+ public long FollowerCount { get; set; }
+
+ ///
+ /// 关注状态 0 未关注 1 已关注 2,不明
+ ///
+ public long FollowStatus { get; set; }
+
+ ///
+ /// 关注数
+ ///
+ public long FollowingCount;
+
+
+ public string GenderToString()
+ {
+ return Gender == 1 ? "男" : Gender == 2 ? "女" : "妖";
+ }
+ }
+
+ ///
+ /// 礼物消息
+ ///
+ public class GiftMsg : Msg
+ {
+ ///
+ /// 礼物ID
+ ///
+ public long GiftId { get; set; }
+
+ ///
+ /// 礼物名称
+ ///
+ public string GiftName { get; set; }
+
+ ///
+ /// 礼物分组ID
+ ///
+ public long GroupId { get; set; }
+
+ ///
+ /// 本次(增量)礼物数量
+ ///
+ public long GiftCount { get; set; }
+
+ ///
+ /// 礼物数量(连续的)
+ ///
+ public long RepeatCount { get; set; }
+
+ ///
+ /// 抖币价格
+ ///
+ public int DiamondCount { get; set; }
+ }
+
+ ///
+ /// 点赞消息
+ ///
+ public class LikeMsg : Msg
+ {
+ ///
+ /// 点赞数量
+ ///
+ public long Count { get; set; }
+
+ ///
+ /// 总共点赞数量
+ ///
+ public long Total { get; set; }
+ }
+
+ ///
+ /// 直播间统计消息
+ ///
+ public class UserSeqMsg : Msg
+ {
+ ///
+ /// 当前直播间用户数量
+ ///
+ public long OnlineUserCount { get; set; }
+
+ ///
+ /// 累计直播间用户数量
+ ///
+ public long TotalUserCount { get; set; }
+
+ ///
+ /// 累计直播间用户数量 显示文本
+ ///
+ public string TotalUserCountStr { get; set; }
+
+ ///
+ /// 当前直播间用户数量 显示文本
+ ///
+ public string OnlineUserCountStr { get; set; }
+ }
+
+ ///
+ /// 粉丝团消息
+ ///
+ public class FansclubMsg : Msg
+ {
+ ///
+ /// 粉丝团消息类型,升级1,加入2
+ ///
+ public int Type { get; set; }
+
+ ///
+ /// 粉丝团等级
+ ///
+ public int Level { get; set; }
+ }
+
+ ///
+ /// 来了消息
+ ///
+ public class MemberMessage : Msg
+ {
+ ///
+ /// 当前直播间人数
+ ///
+ public long CurrentCount { get; set; }
+ }
+
+ ///
+ /// 直播间分享
+ ///
+ public class ShareMessage : Msg
+ {
+ ///
+ /// 分享目标
+ ///
+ public ShareType ShareType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BarrageGrab/Modles/JsonEntity/Command.cs b/BarrageGrab/Modles/JsonEntity/Command.cs
new file mode 100644
index 0000000..124fb2d
--- /dev/null
+++ b/BarrageGrab/Modles/JsonEntity/Command.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BarrageGrab.Modles.JsonEntity
+{
+ public enum CommandCode
+ {
+ ///
+ /// 空指令
+ ///
+ None = 0,
+
+ ///
+ /// 安全关闭程序
+ ///
+ Close = 1,
+ }
+
+ public class Command
+ {
+ ///
+ /// 指令标识
+ ///
+ public CommandCode Cmd { get; set; }
+
+ ///
+ /// 附加数据
+ ///
+ public object Data { get; set; }
+ }
+}
diff --git a/BarrageGrab/ProtoEntity/Messages.cs b/BarrageGrab/Modles/ProtoEntity/Messages.cs
similarity index 99%
rename from BarrageGrab/ProtoEntity/Messages.cs
rename to BarrageGrab/Modles/ProtoEntity/Messages.cs
index 5a2c69d..cbfa7a2 100644
--- a/BarrageGrab/ProtoEntity/Messages.cs
+++ b/BarrageGrab/Modles/ProtoEntity/Messages.cs
@@ -7,8 +7,9 @@
using System.Collections.Generic;
+using Newtonsoft.Json;
-namespace BarrageGrab.ProtoEntity
+namespace BarrageGrab.Modles.ProtoEntity
{
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
[global::ProtoBuf.ProtoContract()]
@@ -892,8 +893,9 @@ namespace BarrageGrab.ProtoEntity
}
[global::ProtoBuf.ProtoContract()]
+ // 使用自定义的JsonConverter
public partial class User : global::ProtoBuf.IExtensible
- {
+ {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -1358,7 +1360,7 @@ namespace BarrageGrab.ProtoEntity
}
- [global::ProtoBuf.ProtoContract()]
+ [global::ProtoBuf.ProtoContract()]
public partial class Image : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
diff --git a/BarrageGrab/ProtoEntity/Wss.cs b/BarrageGrab/Modles/ProtoEntity/Wss.cs
similarity index 97%
rename from BarrageGrab/ProtoEntity/Wss.cs
rename to BarrageGrab/Modles/ProtoEntity/Wss.cs
index e08b473..e1cdcb6 100644
--- a/BarrageGrab/ProtoEntity/Wss.cs
+++ b/BarrageGrab/Modles/ProtoEntity/Wss.cs
@@ -4,7 +4,7 @@
// Input: my.proto
//
-namespace BarrageGrab.ProtoEntity
+namespace BarrageGrab.Modles.ProtoEntity
{
#region Designer generated code
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192