コード例 #1
0
        private void GotDanmakuEvent(LiveCommentInfo info)
        {
            var danmaku = new BiliBiliCommentInfo()
            {
                Id       = ObjectId.GenerateNewId(DateTime.Now),
                Type     = DanmakuType.Comment,
                Username = info.Username,
                Userid   = info.Userid,
                Content  = info.Message,
                IsVip    = info.IsVip,
                IsAdmin  = info.IsAdmin,
                LiveId   = LiveId
            };

            try
            {
                _danmakuCollection.InsertOne(danmaku);
            }
            catch (MongoBulkWriteException ex)
            {
                LogHelper.Error("Insert object error.", true, ex);
            }
        }
コード例 #2
0
        private void GotGiftEvent(LiveGiftInfo info)
        {
            var danmaku = new BiliBiliCommentInfo()
            {
                Id        = ObjectId.GenerateNewId(DateTime.Now),
                Type      = DanmakuType.Gift,
                Username  = info.Username,
                Userid    = info.Userid,
                GiftName  = info.GiftName,
                GiftCount = info.Count,
                CostType  = info.CoinType,
                Cost      = info.CostCoin,
                LiveId    = LiveId
            };

            try
            {
                _danmakuCollection.InsertOne(danmaku);
            }
            catch (MongoBulkWriteException ex)
            {
                LogHelper.Error("Insert object error.", true, ex);
            }
        }