mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +08:00
Core: Fix danmaku user id greater than int32.max causing overflow
This commit is contained in:
parent
dbfbce12ca
commit
c3b5ab4ab2
|
@ -101,7 +101,7 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
|||
/// <item><see cref="DanmakuMsgType.GuardBuy"/></item>
|
||||
/// </list></para>
|
||||
/// </summary>
|
||||
public int UserID { get; set; }
|
||||
public long UserID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户舰队等级
|
||||
|
@ -192,7 +192,7 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
|||
case "DANMU_MSG":
|
||||
this.MsgType = DanmakuMsgType.Comment;
|
||||
this.CommentText = obj["info"]?[1]?.ToObject<string>();
|
||||
this.UserID = obj["info"]?[2]?[0]?.ToObject<int>() ?? 0;
|
||||
this.UserID = obj["info"]?[2]?[0]?.ToObject<long>() ?? 0;
|
||||
this.UserName = obj["info"]?[2]?[1]?.ToObject<string>();
|
||||
this.IsAdmin = obj["info"]?[2]?[2]?.ToObject<string>() == "1";
|
||||
this.IsVIP = obj["info"]?[2]?[3]?.ToObject<string>() == "1";
|
||||
|
@ -202,13 +202,13 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
|||
this.MsgType = DanmakuMsgType.GiftSend;
|
||||
this.GiftName = obj["data"]?["giftName"]?.ToObject<string>();
|
||||
this.UserName = obj["data"]?["uname"]?.ToObject<string>();
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<int>() ?? 0;
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
||||
this.GiftCount = obj["data"]?["num"]?.ToObject<int>() ?? 0;
|
||||
break;
|
||||
case "GUARD_BUY":
|
||||
{
|
||||
this.MsgType = DanmakuMsgType.GuardBuy;
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<int>() ?? 0;
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
||||
this.UserName = obj["data"]?["username"]?.ToObject<string>();
|
||||
this.UserGuardLevel = obj["data"]?["guard_level"]?.ToObject<int>() ?? 0;
|
||||
this.GiftName = this.UserGuardLevel == 3 ? "舰长" : this.UserGuardLevel == 2 ? "提督" : this.UserGuardLevel == 1 ? "总督" : "";
|
||||
|
@ -219,7 +219,7 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
|||
{
|
||||
this.MsgType = DanmakuMsgType.SuperChat;
|
||||
this.CommentText = obj["data"]?["message"]?.ToString();
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<int>() ?? 0;
|
||||
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
||||
this.UserName = obj["data"]?["user_info"]?["uname"]?.ToString();
|
||||
this.Price = obj["data"]?["price"]?.ToObject<double>() ?? 0;
|
||||
this.SCKeepTime = obj["data"]?["time"]?.ToObject<int>() ?? 0;
|
||||
|
|
|
@ -155,6 +155,7 @@ namespace BililiveRecorder.Core.Danmaku
|
|||
var ts = Math.Max((DateTimeOffset.UtcNow - this.offset).TotalSeconds, 0d);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "ts", null, ts.ToString("F3")).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "user", null, RemoveInvalidXMLChars(danmakuModel.UserName)).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "uid", null, danmakuModel.UserID.ToString()).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "price", null, danmakuModel.Price.ToString()).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "time", null, danmakuModel.SCKeepTime.ToString()).ConfigureAwait(false);
|
||||
if (recordDanmakuRaw)
|
||||
|
@ -170,6 +171,7 @@ namespace BililiveRecorder.Core.Danmaku
|
|||
var ts = Math.Max((DateTimeOffset.UtcNow - this.offset).TotalSeconds, 0d);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "ts", null, ts.ToString("F3")).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "user", null, RemoveInvalidXMLChars(danmakuModel.UserName)).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "uid", null, danmakuModel.UserID.ToString()).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "giftname", null, RemoveInvalidXMLChars(danmakuModel.GiftName)).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "giftcount", null, danmakuModel.GiftCount.ToString()).ConfigureAwait(false);
|
||||
if (recordDanmakuRaw)
|
||||
|
@ -184,6 +186,7 @@ namespace BililiveRecorder.Core.Danmaku
|
|||
var ts = Math.Max((DateTimeOffset.UtcNow - this.offset).TotalSeconds, 0d);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "ts", null, ts.ToString("F3")).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "user", null, RemoveInvalidXMLChars(danmakuModel.UserName)).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "uid", null, danmakuModel.UserID.ToString()).ConfigureAwait(false);
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "level", null, danmakuModel.UserGuardLevel.ToString()).ConfigureAwait(false); ;
|
||||
await this.xmlWriter.WriteAttributeStringAsync(null, "count", null, danmakuModel.GiftCount.ToString()).ConfigureAwait(false);
|
||||
if (recordDanmakuRaw)
|
||||
|
|
Loading…
Reference in New Issue
Block a user