Esempio n. 1
0
            public void 更新正在直播数据()
            {
                JObject jo = (JObject)JsonConvert.DeserializeObject(MMPU.返回网页内容("https://hiyoko.sonoj.net/f/avtapi/live/fetch_current_v2"));

                foreach (var item in jo["current_live"])
                {
                    try
                    {
                        直播数据.Add(new 直播信息()
                        {
                            实际开始时间     = long.Parse(item["actual_start_time"].ToString()),
                            频道ID       = item["ch_id"].ToString(),
                            频道类型       = int.Parse(item["ch_type"].ToString()),
                            头像URL      = item["channel_thumbnail_url"].ToString(),
                            最大观众       = int.Parse(item["max_viewers"].ToString()),
                            称          = item["name"].ToString(),
                            已直播时长_秒    = int.Parse(item["seconds"].ToString()),
                            已直播时长_日本时间 = item["start_time_str"].ToString(),
                            主播名称       = item["streamer_name"].ToString(),
                            封面URL      = item["thumbnail_url"].ToString(),
                            封面图高度      = int.Parse(item["thumbnail_height"].ToString()),
                            封面图宽度      = int.Parse(item["thumbnail_width"].ToString()),
                            标题         = item["title"].ToString(),
                            当前观众       = item["viewers"].ToString(),
                            频道相关信息     = item["channel_misc"].ToString(),
                            阿B房间号      = item["desc"].ToString()
                        });
                        直播数据[直播数据.Count() - 1].直播连接 = 根据频道类型返回直播地址(直播数据[直播数据.Count() - 1]);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
Esempio n. 2
0
        public static string  载完成合并FLV(DownIofoData downIofo, bool 是否直播结束)
        {
            string        filename    = string.Empty;
            List <string> DelFileList = new List <string>();

            if (downIofo.继承.待合并文件列表.Count > 1)
            {
                filename = downIofo.继承.待合并文件列表[0];

                for (int i = 0; i < downIofo.继承.待合并文件列表.Count - 1; i++)
                {
                    DelFileList.Add(downIofo.继承.待合并文件列表[i + 1]);
                    FlvMethod.Flv A = new FlvMethod.Flv()
                    {
                        File1Url = filename,
                        File2Url = downIofo.继承.待合并文件列表[i + 1]
                    };
                    DelFileList.Add(filename);
                    string BB = FlvMethod.FlvSum(A, 是否直播结束);
                    if (string.IsNullOrEmpty(BB))
                    {
                        InfoLog.InfoPrintf($"{downIofo.房间_频道号}:{downIofo.主播名称}因为网络连接不稳定,无法获取文件头,放弃合并该flv", InfoLog.InfoClass.载必要提示);
                        return(filename);
                    }
                    filename = BB;
                }
            }
            foreach (var item in DelFileList)
            {
                MMPU.文件删除委托(item, "FLV合并任务");
            }
            return(filename);
        }
Esempio n. 3
0
 public static void 轮询检查下载任务()
 {
     new Task(() => {
         while (true)
         {
             while (轮询检查下载任务开关)
             {
                 try
                 {
                     if (!string.IsNullOrEmpty(MMPU.TcpSend(Server.RequestCode.GET_IP, "{}", true, 50, 5000)))
                     {
                         载任务状态检测();
                     }
                     else
                     {
                     }
                 }
                 catch (Exception)
                 { }
                 Thread.Sleep(30 * 1000);
             }
             Thread.Sleep(500);
         }
     }).Start();
 }
Esempio n. 4
0
            public static string 发送弹幕(string roomid, string mess)
            {
                if (string.IsNullOrEmpty(MMPU.Cookie))
                {
                    return("未登录,发送失败");
                }
                string cookie = MMPU.Cookie;

                try
                {
                    int.Parse(roomid);
                }
                catch (Exception)
                {
                    return("发送失败,未选择房间或者房间异常");
                }
                Dictionary <string, string> POST表单 = new Dictionary <string, string>
                {
                    { "color", "16777215" },
                    { "fontsize", "25" },
                    { "mode", "1" },
                    { "msg", mess },
                    { "rnd", (DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1))).TotalSeconds.ToString() },
                    { "roomid", roomid },
                    { "csrf_token", MMPU.csrf },
                    { "csrf", MMPU.csrf }
                };
                CookieContainer CK = new CookieContainer
                {
                    MaxCookieSize     = 4096,
                    PerDomainCapacity = 50
                };

                string[] cook = cookie.Replace(" ", "").Split(';');
                for (int i = 0; i < cook.Length; i++)
                {
                    try
                    {
                        CK.Add(new Cookie(cook[i].Split('=')[0], cook[i].Split('=')[1].Replace(",", "%2C"))
                        {
                            Domain = "live.bilibili.com"
                        });
                    }
                    catch (Exception)
                    {
                    }
                }

                JObject JO = (JObject)JsonConvert.DeserializeObject(MMPU.返回网页内容("https://api.live.bilibili.com/msg/send", POST表单, CK));

                if (JO["code"].ToString() == "0")
                {
                    return("发送成功");
                }
                else
                {
                    return("发送失败,接口返回消息:" + JO["message"].ToString());
                }
            }
Esempio n. 5
0
        public static Downloader 新建下载对象(string 平台, string 唯一码, string 标题, string GUID, string 载地址, string 备注, bool 是否保存)
        {
            Downloader 载对象 = new Downloader();
            string     保存路径;

            if (MMPU.载储存目录 == "./tmp/")
            {
                保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\" + 平台 + "_" + 唯一码 + "\\";
                if (Directory.Exists(保存路径))//如果不存在就创建文件夹
                {
                    Directory.CreateDirectory(保存路径);
                }
                保存路径 = 保存路径 + 标题 + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".flv";
            }
            else
            {
                保存路径 = MMPU.载储存目录 + "\\" + 平台 + "_" + 唯一码 + "\\";
                if (!Directory.Exists(保存路径))//如果不存在就创建file文件夹
                {
                    try
                    {
                        Directory.CreateDirectory(保存路径);
                    }
                    catch (Exception)
                    {
                        MMPU.载储存目录 = "./tmp/";
                        MMPU.setFiles("file", MMPU.载储存目录);
                        保存路径 = MMPU.载储存目录 + "\\" + 平台 + "_" + 唯一码 + "\\";
                    }
                }
                保存路径 = 保存路径 + 标题 + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".flv";
            }
            载对象.DownIofo = new Downloader.DownIofoData
            {
                平台     = 平台,
                房间_频道号 = 唯一码,
                文件保存路径 = 保存路径,
                事件GUID = GUID,
                载地址    = 载地址,
                是否保存   = 是否保存,
                标题     = 标题,
                备注     = 备注
            };
            if (!是否保存)
            {
                int 随机值 = new Random().Next(1000, 9999);
                载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + 随机值 + ".flv";
                if (File.Exists(载对象.DownIofo.文件保存路径))
                {
                    载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + (随机值) + 1 + ".flv";
                }
            }
            MMPU.DownList.Add(载对象);
            载对象.Start(备注);

            return(载对象);
        }
Esempio n. 6
0
        private static void Process_Exited(object sender, EventArgs e)
        {
            ProcessPuls P = (ProcessPuls)sender;

            InfoLog.InfoPrintf("转码任务完成:" + P.StartInfo.Arguments, InfoLog.InfoClass.载必要提示);
            if (MMPU.转码后自动删除文件)
            {
                MMPU.文件删除委托(P.OriginalVideoFilename, "转码完成自动,删除原始文件");
            }
        }
Esempio n. 7
0
            /// <summary>
            /// 获取BILIBILI直播流下载地址
            /// </summary>
            /// <param name="roomid">房间号</param>
            /// <param name="R">是否为重试</param>
            /// <returns></returns>
            public static string  载地址(string roomid)
            {
                roomid = 获取真实房间号(roomid);
                if (roomid == null)
                {
                    InfoLog.InfoPrintf("房间号获取错误", InfoLog.InfoClass.Debug);
                    return(null);
                }
                string resultString;

                try
                {
                    resultString = MMPU.使用WC获取网络内容("https://api.live.bilibili.com/room/v1/Room/playUrl?cid=" + roomid + "&otype=json&qn=10000&platform=web");
                }
                catch (Exception e)
                {
                    InfoLog.InfoPrintf("发送解析请求失败:" + e.Message, InfoLog.InfoClass.Debug);
                    return("");
                }

                //解析结果使用最高清晰度
                try
                {
                    MMPU.判断网络路径是否存在 判断文件是否存在 = new MMPU.判断网络路径是否存在();
                    string          BBBC     = "";
                    BBBC = (JObject.Parse(resultString)["data"]["durl"][0]["url"].ToString());
                    //BBBC = (JObject.Parse(resultString)["data"]["durl"][0]["url"].ToString() + "&platform=web").Replace("&pt=", "&pt=web") + "&pSession=" + Guid.NewGuid();
                    if (!判断文件是否存在.判断(BBBC, "bilibili", roomid))
                    {
                        InfoLog.InfoPrintf("请求的开播房间当前推流数据为空,推测还未开播,等待数据流...:", InfoLog.InfoClass.Debug);
                        try
                        {
                            if ((JObject.Parse(resultString)["message"].ToString() == "房间已加密"))
                            {
                                InfoLog.InfoPrintf("房间已加密", InfoLog.InfoClass.载必要提示);
                                return("");
                            }
                        }
                        catch (Exception)
                        {
                        }
                        BBBC = (JObject.Parse(resultString)["data"]["durl"][1]["url"].ToString());
                    }
                    DataCache.BilibiliApiCount++;
                    return(BBBC);
                }
                catch (Exception e)
                {
                    InfoLog.InfoPrintf("视频流地址解析失败:" + e.Message, InfoLog.InfoClass.系统错误信息);
                    return("");
                }
            }
Esempio n. 8
0
 public static void DokiDoki(int 模式)
 {
     new Thread(new ThreadStart(delegate {
         while (true)
         {
             try
             {
                 MMPU.TcpSend(模式 == 0 ? Server.RequestCode.SET_DokiDoki_DDTV : Server.RequestCode.SET_DokiDoki_DDTVLiveRec, "{}", true, 50);
             }
             catch (Exception) { }
             Thread.Sleep(3600 * 1000);
         }
     })).Start();
 }
Esempio n. 9
0
        public static void 更新VTBS房间数据()
        {
            while (true)
            {
                int 完整错误次数 = 0;
                try
                {
                    if (完整错误次数 >= 5)
                    {
                        InfoLog.InfoPrintf($"----------【重要】----------\r\n多次尝试获取服务器RoomList缓存失败,切换为纯WSS连接模式,该模式下初始化连接速度较慢,大约20连接一个房间\r\n----------【重要】----------", InfoLog.InfoClass.载必要提示);
                        wss连接初始化准备已完成 = true;
                        return;
                    }
                    string vtbs房间数据 = string.Empty;
                    try
                    {
                        vtbs房间数据 = MMPU.返回网页内容_GET(VTBS.API.VTBS服务器CDN.VTBS_Url + "/v1/short", 5000);
                    }
                    catch (Exception)
                    {
                        InfoLog.InfoPrintf($"通过原始数据源更新VTBS房间数据失败,切换到备用DDTV服务器获取", InfoLog.InfoClass.Debug);
                        vtbs房间数据 = MMPU.TcpSend(Server.RequestCode.GET_VTBSROOMLIST, "{}", true, 1500);
                    }

                    JArray JO = (JArray)JsonConvert.DeserializeObject(vtbs房间数据);
                    //InfoLog.InfoPrintf($"获取VTBS房间数据完成:{JO}", InfoLog.InfoClass.Debug);
                    foreach (var item in JO)
                    {
                        if (int.Parse(item["roomid"].ToString()) != 0)
                        {
                            VtbsRoomList.Add(new VtbsRoom()
                            {
                                mid = int.Parse(item["mid"].ToString()), room = int.Parse(item["roomid"].ToString()), name = item["uname"].ToString()
                            });
                        }
                    }
                    InfoLog.InfoPrintf($"VTBS数据数据准备完成", InfoLog.InfoClass.Debug);
                    wss连接初始化准备已完成 = true;
                    break;
                }
                catch (Exception)
                {
                    完整错误次数++;
                    InfoLog.InfoPrintf($"VTBS获取RoomList失败,再次重试,已重试次数{完整错误次数}/5", InfoLog.InfoClass.Debug);
                }

                Thread.Sleep(5000);
            }
        }
Esempio n. 10
0
        public static RoomInit.RoomInfo GetRoomInfo(string originalRoomId)
        {
            string roomHtml;

            try
            {
                roomHtml = MMPU.使用WC获取网络内容("https://api.live.bilibili.com/room/v1/Room/get_info?id=" + originalRoomId);
            }
            catch (Exception e)
            {
                InfoLog.InfoPrintf(originalRoomId + "获取房间信息失败:" + e.Message, InfoLog.InfoClass.Debug);
                return(null);
            }
            //解析返回结果
            try
            {
                JObject result = JObject.Parse(roomHtml);
                string  uid    = result["data"]["uid"].ToString();
                if (result["data"]["room_id"].ToString() != originalRoomId)
                {
                    for (int i = 0; i < RoomList.Count(); i++)
                    {
                        if (RoomList[i].房间号 == originalRoomId)
                        {
                            RoomList[i].房间号 = result["data"]["room_id"].ToString();
                            break;
                        }
                    }
                }
                var roominfo = new RoomInit.RoomInfo
                {
                    房间号    = result["data"]["room_id"].ToString(),
                    标题     = result["data"]["title"].ToString().Replace(" ", "").Replace("/", "").Replace("\\", "").Replace("\"", "").Replace(":", "").Replace("*", "").Replace("?", "").Replace("<", "").Replace(">", "").Replace("|", ""),
                    直播状态   = result["data"]["live_status"].ToString() == "1" ? true : false,
                    UID    = result["data"]["uid"].ToString(),
                    直播开始时间 = result["data"]["live_time"].ToString(),
                    平台     = "bilibili"
                };
                InfoLog.InfoPrintf("获取到房间信息:" + roominfo.UID + " " + (roominfo.直播状态 ? "已开播" : "未开播") + " " + (roominfo.直播状态 ? "开播时间:" + roominfo.直播开始时间 : ""), InfoLog.InfoClass.Debug);
                DataCache.BilibiliApiCount++;
                return(roominfo);
            }
            catch (Exception e)
            {
                InfoLog.InfoPrintf(originalRoomId + "房间信息解析失败:" + e.Message, InfoLog.InfoClass.Debug);
                return(null);
            }
        }
Esempio n. 11
0
 public static void 使用vtbsAPI更新房间状态()
 {
     try
     {
         JArray JO = (JArray)JsonConvert.DeserializeObject(MMPU.返回网页内容_GET("https://api.vtbs.moe/v1/living", 8000));
         foreach (var roomtask in RoomList)
         {
             roomtask.直播状态 = false;
             if (JO.ToString().Contains(roomtask.房间号))
             {
                 roomtask.直播状态 = true;
             }
             else
             {
                 roomtask.直播状态 = false;
             }
         }
         InfoLog.InfoPrintf("Vtbs数据加载成功", InfoLog.InfoClass.Debug);
     }
     catch (Exception e)
     {
         InfoLog.InfoPrintf("Vtbs数据加载失败,使用备用数据源开始获取", InfoLog.InfoClass.Debug);
         try
         {
             JArray JO = (JArray)JsonConvert.DeserializeObject(MMPU.TcpSend(Server.RequestCode.GET_LIVELSIT, "{}", true));
             foreach (var roomtask in RoomList)
             {
                 roomtask.直播状态 = false;
                 if (JO.ToString().Contains(roomtask.房间号))
                 {
                     roomtask.直播状态 = true;
                 }
                 else
                 {
                     roomtask.直播状态 = false;
                 }
             }
             InfoLog.InfoPrintf("备用数据源加载成功", InfoLog.InfoClass.Debug);
         }
         catch (Exception)
         {
             InfoLog.InfoPrintf("备用缓存数据加载失败,使用原生阿Bapi开始获取开始获取", InfoLog.InfoClass.Debug);
             使用B站API更新房间状态();
         }
     }
 }
Esempio n. 12
0
            public static string 获取真实房间号(string roomID)
            {
                string CacheStr = "byROOMIDgetTRUEroomid";

                if (DataCache.读缓存(CacheStr + roomID, 0, out string CacheData))
                {
                    return(CacheData);
                }
                try
                {
                    if (int.Parse(roomID) > 10000)
                    {
                        DataCache.写缓存(CacheStr + roomID, roomID);
                        return(roomID);
                    }
                }
                catch (Exception) { }
                string roomHtml;

                try
                {
                    roomHtml = MMPU.使用WC获取网络内容("https://api.live.bilibili.com/room/v1/Room/get_info?id=" + roomID);
                }
                catch (Exception e)
                {
                    InfoLog.InfoPrintf(roomID + "获取房间信息失败:" + e.Message, InfoLog.InfoClass.Debug);
                    return(null);
                }
                //从返回结果中提取真实房间号
                try
                {
                    JObject result = JObject.Parse(roomHtml);
                    //string live_status = result["data"]["live_status"].ToString();
                    //if (live_status != "1")
                    //{
                    //    return "-1";
                    //}
                    string roomid = result["data"]["room_id"].ToString();
                    DataCache.写缓存(CacheStr + roomID, roomid);
                    return(roomid);
                }
                catch
                {
                    return(roomID);
                }
            }
Esempio n. 13
0
            public static string 获取标题(string roomID)
            {
                string CacheStr = "byRoomIdgetRoomTitle";

                if (DataCache.读缓存(CacheStr + roomID, 20, out string CacheData))
                {
                    return(CacheData);
                }
                roomID = 获取真实房间号(roomID);
                if (roomID == null)
                {
                    InfoLog.InfoPrintf("房间号获取错误", InfoLog.InfoClass.Debug);
                    return(null);
                }

                string roomHtml;

                try
                {
                    roomHtml = MMPU.使用WC获取网络内容("https://api.live.bilibili.com/room/v1/Room/get_info?id=" + roomID);
                }
                catch (Exception e)
                {
                    InfoLog.InfoPrintf(roomID + "获取房间信息失败:" + e.Message, InfoLog.InfoClass.载必要提示);
                    return(null);
                }
                //解析结果
                try
                {
                    JObject result   = JObject.Parse(roomHtml);
                    string  roomName = result["data"]["title"].ToString().Replace(" ", "").Replace("/", "").Replace("\\", "").Replace("\"", "").Replace(":", "").Replace("*", "").Replace("?", "").Replace("<", "").Replace(">", "").Replace("|", "").ToString();
                    InfoLog.InfoPrintf("根据RoomId获取到标题:" + roomName, InfoLog.InfoClass.Debug);
                    DataCache.写缓存(CacheStr + roomID, roomName);
                    return(roomName);
                }
                catch (Exception e)
                {
                    InfoLog.InfoPrintf("视频标题解析失败:" + e.Message, InfoLog.InfoClass.Debug);
                    return("");
                }
            }
Esempio n. 14
0
 public static void ByQRCode_QrCodeStatus_Changed(ByQRCode.QrCodeStatus status, Account account = null)
 {
     if (status == ByQRCode.QrCodeStatus.Success)
     {
         BiliUser.account = account;
         InfoLog.InfoPrintf("UID:" + account.Uid + ",登陆成功", InfoLog.InfoClass.杂项提示);
         //MessageBox.Show("UID:"+account.Uid+",登陆成功");
         MMPU.UID = account.Uid;
         MMPU.写ini配置文件("User", "UID", MMPU.UID, MMPU.BiliUserFile);
         foreach (var item in account.Cookies)
         {
             MMPU.Cookie = MMPU.Cookie + item + ";";
         }
         MMPU.CookieEX = account.Expires_Cookies;
         MMPU.csrf     = account.CsrfToken;
         ;
         MMPU.写ini配置文件("User", "csrf", MMPU.csrf, MMPU.BiliUserFile);
         MMPU.写ini配置文件("User", "Cookie", Encryption.AesStr(MMPU.Cookie, MMPU.AESKey, MMPU.AESVal), MMPU.BiliUserFile);
         MMPU.写ini配置文件("User", "CookieEX", MMPU.CookieEX.ToString("yyyy-MM-dd HH:mm:ss"), MMPU.BiliUserFile);
     }
 }
Esempio n. 15
0
        public static void 更新VTBS房间数据()
        {
            while (true)
            {
                try
                {
                    string vtbs房间数据 = string.Empty;
                    try
                    {
                        vtbs房间数据 = MMPU.返回网页内容_GET(VTBS.API.VTBS服务器CDN.VTBS_Url + "/v1/short", 5000);
                    }
                    catch (Exception)
                    {
                        vtbs房间数据 = MMPU.TcpSend(Server.RequestCode.GET_VTBSROOMLIST, "{}", true);
                    }

                    JArray JO = (JArray)JsonConvert.DeserializeObject(vtbs房间数据);
                    foreach (var item in JO)
                    {
                        if (int.Parse(item["roomid"].ToString()) != 0)
                        {
                            VtbsRoomList.Add(new VtbsRoom()
                            {
                                mid = int.Parse(item["mid"].ToString()), room = int.Parse(item["roomid"].ToString()), name = item["uname"].ToString()
                            });
                        }
                    }
                    wss连接初始化准备已完成 = true;
                    break;
                }
                catch (Exception)
                {
                }

                Thread.Sleep(5000);
            }
        }
Esempio n. 16
0
 public void  载结束提醒(bool 是否结束弹幕录制, string 提醒标题, DownIofoData DOL)
 {
     try
     {
         if (是否结束弹幕录制 && MMPU.录制弹幕 && MMPU.弹幕录制种类 == 2)
         {
             try
             {
                 DOL.弹幕储存流.WriteLine("</i>");
                 DOL.弹幕储存流.Flush();//写入弹幕数据
             }
             catch (Exception)
             { }
             if (DOL != DownIofo)
             {
                 Clear(false, DownIofo);
             }
             Clear(false, DOL);
         }
         else
         {
             Clear(true, DOL);
         }
     }
     catch (Exception) { }
     InfoLog.InfoPrintf($"\r\n=============={提醒标题}================\r\n" +
                        $"主播名:{DOL.主播名称}" +
                        $"\r\n房间号:{DOL.房间_频道号}" +
                        $"\r\n标题:{DOL.标题}" +
                        $"\r\n开播时间:{MMPU.Unix转换为DateTime(DOL.开始时间.ToString())}" +
                        $"\r\n结束时间:{MMPU.Unix转换为DateTime(DOL.结束时间.ToString())}" +
                        $"\r\n保存路径:{DOL.文件保存路径}" +
                        $"\r\n下载任务类型:{(DOL.继承.是否为继承对象 ? "续下任务" : "新建下载任务")}" +
                        $"\r\n结束原因:{DOL.备注}" +
                        $"\r\n==============={提醒标题}===============\r\n", InfoLog.InfoClass.载必要提示);
 }
Esempio n. 17
0
            public void 更新正在直播数据()
            {
                string UURL = MMPU.TcpSend(30002, "{}", true);
                string URL  = string.IsNullOrEmpty(UURL)?"https://hiyoko.sonoj.net/dy-st/30s/6c6cb639-1d2f-4151-81c7-fd877700cf98.json": UURL;
                JArray jo   = (JArray)JsonConvert.DeserializeObject(MMPU.返回网页内容(URL));

                for (int i = 0; i < jo.Count; i++)
                {
                    JToken item = jo[i];
                    try
                    {
                        直播数据.Add(new 直播信息());
                        #region 实际开始时间
                        try
                        {
                            直播数据[直播数据.Count - 1].实际开始时间 = long.Parse(item["actual_start_time"].ToString());
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].实际开始时间 = 0;
                        }
                        #endregion
                        #region 频道ID
                        try
                        {
                            直播数据[直播数据.Count - 1].频道ID = item["ch_id"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].频道ID = "0";
                        }
                        #endregion
                        #region 频道类型
                        try
                        {
                            直播数据[直播数据.Count - 1].频道类型 = int.Parse(item["ch_type"].ToString());
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].频道类型 = 0;
                        }
                        #endregion
                        #region  称
                        try
                        {
                            直播数据[直播数据.Count - 1].称 = item["name"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].称 = "获取失败";
                        }
                        #endregion
                        #region 已直播时长_秒
                        try
                        {
                            直播数据[直播数据.Count - 1].已直播时长_秒 = int.Parse(item["seconds"].ToString());
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].已直播时长_秒 = 0;
                        }
                        #endregion
                        #region 已直播时长_日本时间
                        try
                        {
                            直播数据[直播数据.Count - 1].已直播时长_日本时间 = item["start_time_str"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].已直播时长_日本时间 = "null";
                        }
                        #endregion
                        #region 主播名称
                        try
                        {
                            直播数据[直播数据.Count - 1].主播名称 = item["streamer_name"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].主播名称 = "null";
                        }
                        #endregion
                        #region 标题
                        try
                        {
                            直播数据[直播数据.Count - 1].标题 = item["title"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].标题 = "null";
                        }
                        #endregion
                        #region 当前观众
                        try
                        {
                            直播数据[直播数据.Count - 1].当前观众 = item["viewers"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].当前观众 = "null";
                        }
                        #endregion
                        #region 频道相关信息
                        try
                        {
                            直播数据[直播数据.Count - 1].频道相关信息 = item["channel_misc"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].频道相关信息 = "null";
                        }
                        #endregion
                        #region 阿B房间号
                        try
                        {
                            直播数据[直播数据.Count - 1].阿B房间号 = item["desc"].ToString();
                        }
                        catch (Exception)
                        {
                            直播数据[直播数据.Count - 1].阿B房间号 = "null";
                        }
                        #endregion

                        直播数据[直播数据.Count() - 1].直播连接 = 根据频道类型返回直播地址(直播数据[直播数据.Count() - 1]);
                    }
                    catch (Exception ex)
                    {
                        InfoLog.InfoPrintf("外部API:正在直播的列表更新出现错误" + ex.ToString(), InfoLog.InfoClass.系统错误信息);
                    }
                }
            }
Esempio n. 18
0
        private void Listener_MessageReceived(object sender, MessageEventArgs e)
        {
            try
            {
                switch (e)
                {
                case DanmuMessageEventArgs danmu:
                    DateTime DT       = DateTime.Now;
                    TimeSpan interval = DT - DownIofo.弹幕录制基准时间;
                    switch (MMPU.弹幕录制种类)
                    {
                    case 1:
                    {
                        DownIofo.弹幕储存流.WriteLine("Dialogue: 0,{0},{1},Fix,{2},20,20,2,,{3}", interval.ToString(), (interval.Seconds).ToString(), danmu.UserName + "[" + danmu.UserId + "]", danmu.Message);
                        break;
                    }

                    case 2:
                    {
                        string 弹幕 = danmu.Message.Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;").Replace("&", "&amp;");
                        弹幕 = Regex.Replace(弹幕, @"[\x00-\x08\x0B\x0C\x0E-\x1F]", "");
                        DownIofo.弹幕储存流.WriteLine($"<d p=\"{interval.TotalSeconds},{danmu.MessageType},{danmu.MessageFontSize},16777215,{(MMPU.获取时间戳() / 1000)},0,{danmu.UserId},0\">" +
                                                 $"{弹幕}</d>");
                        break;
                    }
                    }
                    DownIofo.弹幕储存流.Flush();    //写入弹幕数据
                    break;

                case SendGiftEventArgs gift:
                    DownIofo.礼物储存流.WriteLine("收到来自{0}[{1}]的{2}个{3}礼物", gift.UserName, gift.UserId, gift.Amount, gift.GiftName);
                    DownIofo.礼物储存流.Flush();    //写入礼物数据
                    break;

                case GuardBuyEventArgs guard:
                    DownIofo.礼物储存流.WriteLine("增加舰队:{0}当上了{1}", guard.GuardLevel == 3 ? "舰长" : guard.GuardLevel == 2 ? "提督" : "总督");
                    DownIofo.礼物储存流.Flush();    //写入舰队数据
                    break;

                case WarningEventArg Warning:
                    DownIofo.礼物储存流.WriteLine("{0}:被超管警告了,警告内容:{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Warning.msg);
                    DownIofo.礼物储存流.Flush();    //写入超管警告内容
                    break;
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 19
0
        public static Downloader 新建下载对象(string 平台, string 唯一码, string 标题, string GUID, string 载地址, string 备注, bool 是否保存, string 主播名称, bool 是否为继承项目, string 继承项目的原始文件, DownIofoData 继承的项目 = null)
        {
            foreach (var item in MMPU.DownList)
            {
                if (item.DownIofo.房间_频道号 == 唯一码)
                {
                    if (item.DownIofo.载状态 && item.DownIofo.是否保存 && 是否保存)
                    {
                        InfoLog.InfoPrintf($"新建任务冲突,放弃新建任务,任务内容:\r\n房间号:{唯一码}\r\n主播名称:{主播名称}\r\n标题:{标题}", InfoLog.InfoClass.载必要提示);
                        return(null);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            if (string.IsNullOrEmpty(标题))
            {
                标题 = $"V{new Random().Next(10000,99999)}";
            }
            Downloader 载对象 = new Downloader();

            载对象.DownIofo.继承 = new 继承();
            string 缓存路径 = MMPU.缓存路径;
            string 保存路径;

            if (MMPU.载储存目录 == 缓存路径)
            {
                保存路径 = 缓存路径 + 平台 + "_" + 主播名称 + "_" + 唯一码 + "/";
                if (!Directory.Exists(保存路径))//如果不存在就创建文件夹
                {
                    Directory.CreateDirectory(保存路径);
                }
                保存路径 = 保存路径 + 标题 + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".flv";
            }
            else
            {
                保存路径 = MMPU.载储存目录 + "/" + 平台 + "_" + 主播名称 + "_" + 唯一码 + "/";
                if (!Directory.Exists(保存路径))//如果不存在就创建file文件夹
                {
                    try
                    {
                        Directory.CreateDirectory(保存路径);
                    }
                    catch (Exception)
                    {
                        MMPU.载储存目录 = 缓存路径;
                        MMPU.setFiles("file", MMPU.载储存目录);
                        保存路径 = MMPU.载储存目录 + "/" + 平台 + "_" + 主播名称 + "_" + 唯一码 + "/";
                    }
                }
                保存路径 = 保存路径 + 标题 + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".flv";
                if (File.Exists(保存路径))
                {
                    Thread.Sleep(1);
                    保存路径 = MMPU.载储存目录 + "/" + 平台 + "_" + 主播名称 + "_" + 唯一码 + "/" + 标题 + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".flv";
                }
            }
            switch (平台)
            {
            case "bilibili":
            {
                载地址 = 载地址;
                break;
            }

            case "youtube":
            {
                break;
            }
            }
            载对象.DownIofo = new Downloader.DownIofoData
            {
                平台     = 平台,
                载状态    = true,
                房间_频道号 = 唯一码,
                文件保存路径 = 保存路径,
                事件GUID = GUID,
                载地址    = 载地址,
                是否保存   = 是否保存,
                标题     = 标题,
                备注     = 备注,
                主播名称   = 主播名称,
                继承     = new 继承()
                {
                    是否为继承对象   = 是否为继承项目,
                    继承的下载文件路径 = 继承项目的原始文件,
                }
            };
            if (继承的项目 != null)
            {
                载对象.DownIofo.继承.待合并文件列表 = 继承的项目.继承.待合并文件列表;
            }
            if (!是否保存)
            {
                int 随机值 = new Random().Next(1000, 9999);
                载对象.DownIofo.文件保存路径 = 缓存路径 + "LiveCache/" + 载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + 随机值 + ".flv";
                if (File.Exists(载对象.DownIofo.文件保存路径))
                {
                    载对象.DownIofo.文件保存路径 = 缓存路径 + "LiveCache/" + 载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + (随机值) + 1 + ".flv";
                }
            }

            载对象.Start(备注);

            return(载对象);
        }
Esempio n. 20
0
 public static void 修改默认音量设置(int A)
 {
     默认音量 = A;
     MMPU.setFiles("DefaultVolume", A.ToString());
 }
Esempio n. 21
0
        public string Start(string 开始后显示的备注)
        {
            DownIofo.开始时间 = Gettime();
            MMPU.DownList.Add(this);
            int a = 0;

            DownIofo.WC = new WebClient();
            DownIofo.WC.Headers.Add("Accept: */*");
            DownIofo.WC.Headers.Add("User-Agent: " + MMPU.UA.Ver.UA());
            DownIofo.WC.Headers.Add("Accept-Language: zh-CN,zh;q=0.8,en;q=0.6,ja;q=0.4");
            DownIofo.WC.DownloadFileCompleted   += 载完成事件;
            DownIofo.WC.DownloadProgressChanged += 载过程中事件;
            DownIofo.WC.Headers.Add("Accept-Encoding: gzip, deflate, br");
            DownIofo.WC.Headers.Add("Cache-Control: max-age=0");
            DownIofo.WC.Headers.Add("Sec-Fetch-Mode: navigate");
            DownIofo.WC.Headers.Add("Sec-Fetch-Site: none");
            DownIofo.WC.Headers.Add("Sec-Fetch-User: ?1");
            DownIofo.WC.Headers.Add("Upgrade-Insecure-Requests: 1");
            DownIofo.WC.Headers.Add("Cache-Control: max-age=0");
            DownIofo.WC.Headers.Add("Referer: https://www.bilibili.com/");
            if (!string.IsNullOrEmpty(MMPU.Cookie))
            {
                DownIofo.WC.Headers.Add("Cookie", MMPU.Cookie);
            }
            if (!Directory.Exists(GetDirectoryName(DownIofo.文件保存路径)))
            {
                Directory.CreateDirectory(GetDirectoryName(DownIofo.文件保存路径));
            }
            // ReSharper restore AssignNullToNotNullAttribute
            DownIofo.备注  = "等待接收直播数据流";
            DownIofo.载状态 = true;
            MMPU.判断网络路径是否存在 判断文件是否存在 = new MMPU.判断网络路径是否存在();
            while (true)
            {
                Thread.Sleep(5000);
                switch (DownIofo.平台)
                {
                case "bilibili":
                    if (!bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号, true))
                    {
                        InfoLog.InfoPrintf(DownIofo.房间_频道号 + "房间:" + DownIofo.主播名称 + " 房间直播状态为False,取消建立新的下载任务", InfoLog.InfoClass.载必要提示);
                        DownIofo.载状态 = false;
                        DownIofo.备注  = "该房间未直播";

                        DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
                        MMPU.DownList.Remove(this);
                        return(null);
                    }
                    break;

                case "主站视频":
                    break;

                default:
                    DownIofo.载状态  = false;
                    DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
                    DownIofo.备注   = "不支持的平台";
                    MMPU.DownList.Remove(this);
                    return(null);
                }

                if (判断文件是否存在.判断(DownIofo.载地址, DownIofo.平台, DownIofo.房间_频道号))
                {
                    break;
                }
                else
                {
                    Thread.Sleep(5000);
                    switch (DownIofo.平台)
                    {
                    case "bilibili":
                    {
                        if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号, true))
                        {
                            a++;
                            if (判断文件是否存在.判断(DownIofo.载地址, DownIofo.平台, DownIofo.房间_频道号))
                            {
                                //DownIofo.下载地址 = bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号);
                                break;
                            }
                            else
                            {
                                DownIofo.载地址 = bilibili.根据房间号获取房间信息.载地址(DownIofo.房间_频道号);
                                if (判断文件是否存在.判断(DownIofo.载地址, DownIofo.平台, DownIofo.房间_频道号))
                                {
                                    break;
                                }
                                else
                                {
                                    DownIofo.备注 = "等待房间推流...";
                                    Thread.Sleep(30000);
                                    //return null;
                                }
                            }
                        }
                        else
                        {
                            InfoLog.InfoPrintf(DownIofo.房间_频道号 + "房间:" + DownIofo.主播名称 + " 房间未直播,下载任务取消", InfoLog.InfoClass.载必要提示);
                            DownIofo.载状态  = false;
                            DownIofo.备注   = "该房间未直播";
                            DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
                            MMPU.DownList.Remove(this);
                            if (DownIofo.继承.是否为继承对象)
                            {
                                //MMPU.弹窗.Add(3000, "重连任务取消", DownIofo.房间_频道号 + ",该房间未直播");
                            }
                            else
                            {
                                MMPU.弹窗.Add(3000, "下载任务取消", DownIofo.房间_频道号 + ",该房间未直播");
                            }

                            return(null);
                        }
                        break;
                    }

                    case "主站视频":
                    {
                        break;
                    }
                    }
                }
            }
            DownIofo.开始时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
            try
            {
                DownIofo.WC.DownloadFileTaskAsync(new Uri(DownIofo.载地址), DownIofo.文件保存路径);
                InfoLog.InfoPrintf(DownIofo.主播名称 + "开始直播,建立下载任务\r\n==============建立下载任务================\r\n主播名:" + DownIofo.主播名称 + "\r\n房间号:" + DownIofo.房间_频道号 + "\r\n标题:" + DownIofo.标题 + "\r\n开播时间:" + MMPU.Unix转换为DateTime(DownIofo.开始时间.ToString()) + "\r\n保存路径:" + DownIofo.文件保存路径 + "\r\n下载任务类型:" + (DownIofo.继承.是否为继承对象 ? "续下任务" : "新建下载任务") + "\r\n===============建立下载任务===============\r\n", InfoLog.InfoClass.载必要提示);

                if (MMPU.录制弹幕 && !DownIofo.继承.是否为继承对象)
                {
                    DownIofo.弹幕储存流 = new StreamWriter(DownIofo.文件保存路径.Substring(0, DownIofo.文件保存路径.Length - 4) + (MMPU.弹幕录制种类 == 1 ? ".ass" : ".xml"));
                    DownIofo.礼物储存流 = new StreamWriter(DownIofo.文件保存路径 + ".txt");
                    DownIofo.阿B直播流对象.Connect(int.Parse(DownIofo.房间_频道号));
                    DownIofo.阿B直播流对象.MessageReceived += Listener_MessageReceived;
                    DownIofo.弹幕储存流.WriteLine(danmu.返回ASS字幕文件头(DownIofo.标题, DownIofo.房间_频道号, DownIofo.主播名称));
                }
            }
            catch (WebException) {
                DownIofo.备注  = "主播未推流,已结束直播";
                DownIofo.载状态 = false;
                return(null);
            }
            DownIofo.备注  = 开始后显示的备注;
            DownIofo.载状态 = true;

            return(DownIofo.文件保存路径);
        }
Esempio n. 22
0
        /// <summary>
        /// 返回下载列表HTML字符串
        /// </summary>
        /// <returns></returns>
        public static string DownloaderInfoPrintf()
        {
            string        返回字符串  = "<html><head><title>%title%</title><meta charset=\"utf-8\"></head><body><table border=\"5\">";
            List <string> 载任务    = new List <string>();
            int           计数     = 1;
            int           完成数量   = 0;
            int           正在下载数量 = 0;

            载任务.Add(string.Format("<tr><td>序号</td><td>房间号</td><td>下载状态</td><td>已下载大小</td><td>备注</td><td>主播名称</td><td>开始时间</td><td>结束时间</td></td>"));
            foreach (var item in MMPU.DownList)
            {
                载任务.Add(string.Format("<tr><td>" + 计数 + "</td><td>" + item.DownIofo.房间_频道号 + "</td><td>" + (item.DownIofo.备注.Contains("断开")? "■下载完成" : (item.DownIofo.载状态 ? "□正在下载" : "■下载完成")) + "</td><td> " + item.DownIofo.已下载大小str + "</td><td>" + item.DownIofo.备注 + "</td><td>" + item.DownIofo.主播名称 + "</td><td>" + MMPU.Unix转换为DateTime(item.DownIofo.开始时间.ToString()) + "</td><td>" + MMPU.Unix转换为DateTime(item.DownIofo.结束时间.ToString()) + "</td></td>"));
                计数++;
                if (item.DownIofo.载状态)
                {
                    正在下载数量++;
                }
                else
                {
                    完成数量++;
                }
            }

            for (int i = 0; i < 载任务.Count; i++)
            {
                返回字符串 += 载任务[i];
            }
            返回字符串 = (返回字符串 + "</table></body></html>").Replace("%title%", "正在下载:" + 正在下载数量 + " 已经完成:" + 完成数量);
            return(返回字符串);
        }
Esempio n. 23
0
        public static RoomInit.RoomInfo GetRoomInfo(string originalRoomId)
        {
            //发送HTTP请求
            string roomHtml;

            try
            {
                roomHtml = MMPU.返回网页内容_GET("https://www.youtube.com/channel/" + originalRoomId + "/live");
            }
            catch (Exception e)
            {
                InfoLog.InfoPrintf(originalRoomId + "获取房间信息失败:" + e.Message, InfoLog.InfoClass.Debug);
                return(null);
            }

            //解析返回结果
            try
            {
                string tltie = "";
                try
                {
                    tltie = roomHtml.Replace("\\\"title\\\":\\\"", "⒆").Split('⒆')[1].Replace("\\\",\\\"", "⒆").Split('⒆')[0];
                }
                catch (Exception)
                {
                }
                RoomInit.RoomInfo roominfo = new RoomInit.RoomInfo()
                {
                    房间号            = originalRoomId,
                    标题             = tltie,
                    直播状态           = false,
                    UID            = originalRoomId,
                    直播开始时间         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    平台             = "youtube",
                    youtubeVideoId = roomHtml.Replace(":{\\\"videoId\\\":\\\"", "⒆").Split('⒆')[1].Replace("\\\",", "⒆").Split('⒆')[0]
                };

                try
                {
                    // Console.WriteLine(roomHtml);
                    string BC = roomHtml.Replace("(window.ytcsi) {window.ytcsi.tick(\"cfg\", null, '')", "⒆").Split('⒆')[1].Replace("</div>", "⒆").Split('⒆')[0];
                    if (BC.Contains("\\\"isLive\\\":true"))
                    {
                        roominfo.直播状态 = true;
                    }
                    else
                    {
                        roominfo.直播状态 = false;
                    }
                }
                catch (Exception)
                {
                    roominfo.直播状态 = false;
                }

                InfoLog.InfoPrintf("获取到房间信息:" + roominfo.UID + " " + (roominfo.直播状态 ? "已开播" : "未开播") + " " + (roominfo.直播状态 ? "开播时间:" + roominfo.直播开始时间 : ""), InfoLog.InfoClass.Debug);
                return(roominfo);
            }
            catch (Exception e)
            {
                InfoLog.InfoPrintf(originalRoomId + "房间信息解析失败:" + e.Message, InfoLog.InfoClass.Debug);
                return(null);
            }
        }
Esempio n. 24
0
        public static int 启动模式 = 0;//0:DDTV,1:DDTVLive

        /// <summary>
        /// 配置文件初始化
        /// </summary>
        /// <param name="模式">//0:DDTV,1:DDTVLive</param>
        public static bool 配置文件初始化(int 模式)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //加上这一句
            if (模式 == 0)
            {
                InfoLog.InfoInit("./DDTVLog.out", new InfoLog.InfoClasslBool()
                {
                    Debug  = false,
                    载必要提示  = true,
                    杂项提示   = true,
                    系统错误信息 = true,
                    输出到文件  = false
                });
                启动模式 = 0;
            }
            else if (模式 == 1)
            {
                InfoLog.InfoInit("./DDTVLiveRecLog.out", new InfoLog.InfoClasslBool()
                {
                    Debug  = false,
                    载必要提示  = true,
                    杂项提示   = false,
                    系统错误信息 = true,
                    输出到文件  = true
                });
                启动模式 = 1;
            }
            InfoLog.InfoPrintf("消息系统初始化完成", InfoLog.InfoClass.Debug);
            #region 配置文件设置
            if (模式 == 0)
            {
                //默认音量
                MMPU.默认音量 = int.Parse(MMPU.读取exe默认配置文件("DefaultVolume", "50"));
                //缩小功能
                MMPU.缩小功能 = int.Parse(MMPU.读取exe默认配置文件("Zoom", "1"));
                //最大直播并行数量
                MMPU.最大直播并行数量 = int.Parse(MMPU.读取exe默认配置文件("PlayNum", "5"));
                //默认弹幕颜色
                MMPU.默认弹幕颜色 = MMPU.读取exe默认配置文件("DanMuColor", "0xFF,0x00,0x00,0x00");
                //默认字幕颜色
                MMPU.默认字幕颜色 = MMPU.读取exe默认配置文件("ZiMuColor", "0xFF,0x00,0x00,0x00");
                //默认字幕大小
                MMPU.默认字幕大小 = int.Parse(MMPU.读取exe默认配置文件("ZiMuSize", "24"));
                //默认弹幕大小
                MMPU.默认弹幕大小 = int.Parse(MMPU.读取exe默认配置文件("DanMuSize", "20"));
                //默认弹幕大小
                MMPU.播放缓冲时长 = int.Parse(MMPU.读取exe默认配置文件("BufferDuration", "3"));
                //直播缓存目录
                MMPU.直播缓存目录 = MMPU.读取exe默认配置文件("Livefile", "./tmp/LiveCache/");
                //播放窗口默认高度
                MMPU.播放器默认高度 = int.Parse(MMPU.读取exe默认配置文件("PlayWindowH", "450"));
                //播放窗口默认宽度
                MMPU.播放器默认宽度 = int.Parse(MMPU.读取exe默认配置文件("PlayWindowW", "800"));
                //剪切板监听
                MMPU.剪贴板监听 = MMPU.读取exe默认配置文件("ClipboardMonitoring", "0") == "0" ? false : true;
                //数据源
                MMPU.数据源 = int.Parse(MMPU.读取exe默认配置文件("DataSource", "0"));
                //第一次使用DDTV
                MMPU.是否第一次使用DDTV = MMPU.读取exe默认配置文件("IsFirstTimeUsing", "1") == "0" ? false :true;
            }
            else if (模式 == 1)
            {
            }
            //转码功能使能
            MMPU.转码功能使能 = MMPU.读取exe默认配置文件("AutoTranscoding", "0") == "1" ? true : false;
            //检查配置文件
            bilibili.BiliUser.CheckPath(MMPU.BiliUserFile);

            //房间配置文件
            RoomInit.RoomConfigFile = MMPU.读取exe默认配置文件("RoomConfiguration", "./RoomListConfig.json");
            //房间配置文件
            MMPU.载储存目录 = MMPU.读取exe默认配置文件("file", "./tmp/");
            //直播表刷新默认间隔
            MMPU.直播列表刷新间隔 = int.Parse(MMPU.读取exe默认配置文件("LiveListTime", "5"));


            //直播更新时间
            MMPU.直播更新时间 = int.Parse(MMPU.读取exe默认配置文件("RoomTime", "40"));


            #endregion
            InfoLog.InfoPrintf("通用配置加载完成", InfoLog.InfoClass.Debug);

            BiliUser配置文件初始化(模式);
            InfoLog.InfoPrintf("Bilibili账号信息加载完成", InfoLog.InfoClass.Debug);
            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

            if (MMPU.数据源 == 0)
            {
                DDcenter.DdcClient.Connect();
            }
            RoomInit.start();
            return(true);
        }
Esempio n. 25
0
        public static int 启动模式 = 0;//0:DDTV,1:DDTVLive

        /// <summary>
        /// 配置文件初始化
        /// </summary>
        /// <param name="模式">//0:DDTV,1:DDTVLive</param>
        public static bool 配置文件初始化(int 模式)
        {
            if (模式 == 0)
            {
                InfoLog.InfoInit("./DDTVLog.out", new InfoLog.InfoClasslBool()
                {
                    Debug  = false,
                    载必要提示  = true,
                    杂项提示   = false,
                    系统错误信息 = true,
                    输出到文件  = false
                });
                启动模式 = 0;
            }
            else if (模式 == 1)
            {
                InfoLog.InfoInit("./DDTVLiveRecLog.out", new InfoLog.InfoClasslBool()
                {
                    Debug  = false,
                    载必要提示  = true,
                    杂项提示   = false,
                    系统错误信息 = true,
                    输出到文件  = true
                });
                启动模式 = 1;
            }
            InfoLog.InfoPrintf("消息系统初始化完成", InfoLog.InfoClass.Debug);
            #region 配置文件设置
            if (模式 == 0)
            {
                //默认音量
                MMPU.默认音量 = int.Parse(MMPU.读取exe默认配置文件("DefaultVolume", "50"));
                //缩小功能
                MMPU.缩小功能 = int.Parse(MMPU.读取exe默认配置文件("Zoom", "1"));
                //最大直播并行数量
                MMPU.最大直播并行数量 = int.Parse(MMPU.读取exe默认配置文件("PlayNum", "5"));
                //默认弹幕颜色
                MMPU.默认弹幕颜色 = MMPU.读取exe默认配置文件("DanMuColor", "0xFF, 0x00, 0x00, 0x00");
                //默认字幕颜色
                MMPU.默认字幕颜色 = MMPU.读取exe默认配置文件("ZiMuColor", "0xFF, 0x00, 0x00, 0x00");
                //默认字幕大小
                MMPU.默认字幕大小 = int.Parse(MMPU.读取exe默认配置文件("ZiMuSize", "24"));
                //默认弹幕大小
                MMPU.默认弹幕大小 = int.Parse(MMPU.读取exe默认配置文件("DanMuSize", "20"));
                //默认弹幕大小
                MMPU.播放缓冲时长 = int.Parse(MMPU.读取exe默认配置文件("BufferDuration", "3"));
                //直播缓存目录
                MMPU.直播缓存目录 = MMPU.读取exe默认配置文件("Livefile", "./tmp/LiveCache/");
                //播放窗口默认高度
                MMPU.播放器默认高度 = int.Parse(MMPU.读取exe默认配置文件("PlayWindowH", "450"));
                //播放窗口默认宽度
                MMPU.播放器默认宽度 = int.Parse(MMPU.读取exe默认配置文件("PlayWindowW", "800"));
                //剪切板监听
                MMPU.剪贴板监听 = MMPU.读取exe默认配置文件("ClipboardMonitoring", "0") == "0" ? false : true;
            }
            else if (模式 == 1)
            {
            }
            //检查配置文件
            bilibili.BiliUser.CheckPath(MMPU.BiliUserFile);

            //房间配置文件
            RoomInit.RoomConfigFile = MMPU.读取exe默认配置文件("RoomConfiguration", "./RoomListConfig.json");
            //房间配置文件
            MMPU.载储存目录 = MMPU.读取exe默认配置文件("file", "./tmp/");
            //直播表刷新默认间隔
            MMPU.直播列表刷新间隔 = int.Parse(MMPU.读取exe默认配置文件("LiveListTime", "5"));


            //直播更新时间
            MMPU.直播更新时间 = int.Parse(MMPU.读取exe默认配置文件("RoomTime", "40"));

            //转码功能使能
            MMPU.转码功能使能 = MMPU.读取exe默认配置文件("AutoTranscoding", "0") == "1" ? true : false;
            #endregion
            InfoLog.InfoPrintf("通用配置加载完成", InfoLog.InfoClass.Debug);
            #region BiliUser配置文件初始化
            //账号登陆cookie

            try
            {
                MMPU.Cookie = string.IsNullOrEmpty(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile)) ? "" : Encryption.UnAesStr(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile), MMPU.AESKey, MMPU.AESVal);
            }
            catch (Exception)
            {
                MMPU.Cookie = "";
            }
            //账号UID
            MMPU.UID = MMPU.读ini配置文件("User", "UID", MMPU.BiliUserFile); //string.IsNullOrEmpty(MMPU.读取exe默认配置文件("UID", "")) ? null : MMPU.读取exe默认配置文件("UID", "");
            //账号登陆cookie的有效期
            try
            {
                if (!string.IsNullOrEmpty(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile)))
                {
                    MMPU.CookieEX = DateTime.Parse(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile));
                    if (DateTime.Compare(DateTime.Now, MMPU.CookieEX) > 0)
                    {
                        MMPU.Cookie = "";

                        if (模式 == 0)
                        {
                            //MessageBox.Show("BILIBILI账号登陆已过期");
                            MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                            MMPU.csrf = null;
                            MMPU.写ini配置文件("User", "csrf", "", MMPU.BiliUserFile);
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (模式 == 0)
                {
                    MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                }
                MMPU.Cookie = null;
            }
            //账号csrf
            if (string.IsNullOrEmpty(MMPU.Cookie))
            {
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                if (模式 == 1)
                {
                    bilibili.BiliUser.登陆();
                    InfoLog.InfoPrintf("\r\nB站账号登陆信息过期或无效,启动失败,请自行打开目录中的[BiliQR.png]或访问[http://本机IP:11419/login]使用B站客户端扫描二维码登陆", InfoLog.InfoClass.载必要提示);

                    while (string.IsNullOrEmpty(MMPU.Cookie))
                    {
                        // break;
                    }
                }
            }
            MMPU.csrf = MMPU.读ini配置文件("User", "csrf", MMPU.BiliUserFile);
            #endregion
            InfoLog.InfoPrintf("Bilibili账号信息加载完成", InfoLog.InfoClass.Debug);
            //初始化房间
            RoomInit.start();
            return(true);
        }
Esempio n. 26
0
        public static void BiliUser配置文件初始化(int 模式)
        {
            //账号登陆cookie
            try
            {
                MMPU.Cookie = string.IsNullOrEmpty(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile)) ? "" : Encryption.UnAesStr(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile), MMPU.AESKey, MMPU.AESVal);
            }
            catch (Exception)
            {
                MMPU.Cookie = "";
            }
            //账号UID
            MMPU.UID = MMPU.读ini配置文件("User", "UID", MMPU.BiliUserFile); //string.IsNullOrEmpty(MMPU.读取exe默认配置文件("UID", "")) ? null : MMPU.读取exe默认配置文件("UID", "");
            //账号登陆cookie的有效期
            try
            {
                if (!string.IsNullOrEmpty(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile)))
                {
                    MMPU.CookieEX = DateTime.Parse(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile));
                    if (DateTime.Compare(DateTime.Now, MMPU.CookieEX) > 0)
                    {
                        MMPU.Cookie = "";

                        if (模式 == 0)
                        {
                            //MessageBox.Show("BILIBILI账号登陆已过期");
                            MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                            MMPU.csrf = null;
                            MMPU.写ini配置文件("User", "csrf", "", MMPU.BiliUserFile);
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (模式 == 0)
                {
                    MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                }
                MMPU.Cookie = null;
            }
            //账号csrf
            if (string.IsNullOrEmpty(MMPU.Cookie))
            {
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==========================================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n==========================================", InfoLog.InfoClass.载必要提示);
                if (模式 == 1)
                {
                    bilibili.BiliUser.登陆();
                    InfoLog.InfoPrintf("\r\nB站账号登陆信息过期或无效,启动失败,请自行打开目录中的[BiliQR.png]或访问[http://本机IP:11419/login]使用B站客户端扫描二维码登陆", InfoLog.InfoClass.载必要提示);

                    while (string.IsNullOrEmpty(MMPU.Cookie))
                    {
                        // break;
                    }
                }
            }
            MMPU.csrf = MMPU.读ini配置文件("User", "csrf", MMPU.BiliUserFile);
        }
Esempio n. 27
0
        /// <summary>
        /// 初始化房间列表
        /// </summary>
        /// <param name="roomId">有变动的房间号</param>
        /// <param name="R">是否是删除操作</param>
        public static void InitializeRoomList(int roomId, bool Rem, bool Rst)
        {
            //if(Rst)
            //{
            //    首次启动 = true;
            //    foreach (var BWSitem in biliWebSocket)
            //    {
            //        BWSitem.listener.Close();
            //        BWSitem.listener.Dispose();
            //        biliWebSocket.Remove(BWSitem);
            //    }
            //}
            //if (roomId > 0)
            //{
            //    if(!Rem)
            //    {
            //        BiliWebSocket BWS = new BiliWebSocket();
            //        BWS.WebSocket(roomId);
            //        biliWebSocket.Add(BWS);
            //    }
            //    else
            //    {
            //        foreach (var item in biliWebSocket)
            //        {
            //            if(item.room_id==roomId)
            //            {
            //                item.listener.Close();
            //                item.listener.Dispose();
            //                biliWebSocket.Remove(item);
            //                break;
            //            }
            //        }
            //    }
            //}
            InfoLog.InfoPrintf("开始刷新本地房间列表", InfoLog.InfoClass.Debug);
            var rlc = new RoomBox();

            try
            {
                rlc = JsonConvert.DeserializeObject <RoomBox>(ReadConfigFile(RoomConfigFile));
            }
            catch (Exception)
            {
                rlc = JsonConvert.DeserializeObject <RoomBox>("{}");
                InfoLog.InfoPrintf("房间json配置文件格式错误!请检测核对!", InfoLog.InfoClass.系统错误信息);
                InfoLog.InfoPrintf("房间json配置文件格式错误!请检测核对!", InfoLog.InfoClass.系统错误信息);
                InfoLog.InfoPrintf("房间json配置文件格式错误!请检测核对!", InfoLog.InfoClass.系统错误信息);
                return;
            }
            List <RoomCadr> RoomConfigList = new List <RoomCadr>();//房间信息1List

            RoomConfigList = rlc?.data;
            if (RoomConfigList == null)
            {
                RoomConfigList = new List <RoomCadr>();
            }
            bilibili.RoomList.Clear();
            youtube.RoomList.Clear();
            if (初始化储存房间储存一次)
            {
                string JOO = JsonConvert.SerializeObject(rlc);
                MMPU.储存文本(JOO, RoomConfigFile);
                初始化储存房间储存一次 = false;
            }

            foreach (var item in RoomConfigList)
            {
                if (item.Types == "bilibili")
                {
                    //if(首次启动)
                    //{

                    //    BiliWebSocket BWS = new BiliWebSocket();
                    //    BWS.WebSocket(int.Parse(item.RoomNumber));
                    //    biliWebSocket.Add(BWS);
                    //}
                    bilibili.RoomList.Add(new RoomInfo
                    {
                        房间号    = item.RoomNumber,
                        标题     = "",
                        是否录制弹幕 = item.VideoStatus,
                        是否录制视频 = item.VideoStatus,
                        UID    = "",
                        直播开始时间 = "",
                        称      = item.Name,
                        直播状态   = item.LiveStatus,
                        原名     = item.OfficialName,
                        是否提醒   = item.RemindStatus,
                        平台     = "bilibili"
                    });
                    if (首次启动)
                    {
                        bilibili.RoomList[bilibili.RoomList.Count - 1].直播状态 = false;
                    }
                }
                else if (item.Types == "youtube")
                {
                    youtube.RoomList.Add(new RoomInfo
                    {
                        房间号    = item.RoomNumber,
                        标题     = "",
                        是否录制弹幕 = item.VideoStatus,
                        是否录制视频 = item.VideoStatus,
                        UID    = "",
                        直播开始时间 = "",
                        称      = item.Name,
                        直播状态   = item.LiveStatus,
                        原名     = item.OfficialName,
                        是否提醒   = item.RemindStatus,
                        平台     = "youtube"
                    });
                    if (首次启动)
                    {
                        youtube.RoomList[youtube.RoomList.Count - 1].直播状态 = false;
                    }
                }
            }
            if (首次启动)
            {
                InfoLog.InfoPrintf("监控列表中有" + (bilibili.RoomList.Count() + youtube.RoomList.Count()) + "个单推对象,开始监控", InfoLog.InfoClass.载必要提示);
            }
            首次启动 = false;
            InfoLog.InfoPrintf("刷新本地房间列表完成", InfoLog.InfoClass.Debug);
        }
Esempio n. 28
0
        public static void BiliUser配置文件初始化(int 模式)
        {
            //账号登陆cookie
            try
            {
                MMPU.Cookie = string.IsNullOrEmpty(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile)) ? "" : Encryption.UnAesStr(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile), MMPU.AESKey, MMPU.AESVal);
            }
            catch (Exception)
            {
                MMPU.Cookie = "";
            }
            //账号UID
            MMPU.UID = MMPU.读ini配置文件("User", "UID", MMPU.BiliUserFile); //string.IsNullOrEmpty(MMPU.读取exe默认配置文件("UID", "")) ? null : MMPU.读取exe默认配置文件("UID", "");
            //账号登陆cookie的有效期
            try
            {
                if (!string.IsNullOrEmpty(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile)))
                {
                    MMPU.CookieEX = DateTime.Parse(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile));
                    if (DateTime.Compare(DateTime.Now, MMPU.CookieEX) > 0)
                    {
                        MMPU.Cookie = "";

                        if (模式 == 0)
                        {
                            //MessageBox.Show("BILIBILI账号登陆已过期");
                            MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                            MMPU.csrf = null;
                            MMPU.写ini配置文件("User", "csrf", "", MMPU.BiliUserFile);
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (模式 == 0)
                {
                    MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                }
                MMPU.Cookie = null;
            }
            //账号csrf
            if (string.IsNullOrEmpty(MMPU.Cookie))
            {
                InfoLog.InfoPrintf("\r\n===============================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n===============================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==============\r\nBiliUser.ini文件无效,请使用DDTV本体登陆成功后把DDTV本体里的BiliUser.ini文件覆盖无效的文件\r\n==============", InfoLog.InfoClass.载必要提示);
                if (模式 == 1)
                {
                    bilibili.BiliUser.登陆();
                    InfoLog.InfoPrintf("\r\nB站账号登陆信息过期或无效,启动失败,请自行打开目录中的[BiliQR.png]使用B站客户端扫描二维码登陆,或复制DDTV2的有效BiliUser.ini覆盖本地文件\r\n[======如果是linux系统,请检查几个文件的权限======]", InfoLog.InfoClass.载必要提示);

                    while (string.IsNullOrEmpty(MMPU.Cookie))
                    {
                        // break;
                    }
                }
            }
            else
            {
                if (模式 == 0)
                {
                    if (!MMPU.加载网络房间方法.是否正在缓存)
                    {
                        new Task(() =>
                        {
                            加载网络房间方法.更新网络房间缓存();
                        }).Start();
                    }
                }
            }
            MMPU.csrf = MMPU.读ini配置文件("User", "csrf", MMPU.BiliUserFile);
        }
Esempio n. 29
0
        public static void 使用vtbsAPI更新房间状态()
        {
            int C1 = 0;
            int C2 = RoomList.Count;

            try
            {
                while (!wss连接初始化准备已完成)
                {
                    Thread.Sleep(1000);
                }
                JArray JO = (JArray)JsonConvert.DeserializeObject(MMPU.返回网页内容_GET(VTBS.API.VTBS服务器CDN.VTBS_Url + "/v1/living", 8000));

                List <int> MTPlist = new List <int>();
                foreach (var item in VtbsRoomList)
                {
                    MTPlist.Add(item.room);
                }
                List <RoomInit.RoomInfo> Vtbs存在的直播间  = new List <RoomInit.RoomInfo>();
                List <RoomInit.RoomInfo> Vtbs不存在的直播间 = new List <RoomInit.RoomInfo>();
                foreach (var item in RoomList)
                {
                    if (MTPlist.Contains(int.Parse(item.房间号)))
                    {
                        Vtbs存在的直播间.Add(item);
                    }
                    else
                    {
                        Vtbs不存在的直播间.Add(item);
                    }
                }

                foreach (var roomtask in Vtbs存在的直播间)
                {
                    if (!WSokRoomList.Contains(roomtask.房间号))
                    {
                        C1++;
                        roomtask.直播状态 = false;
                        if (JO.ToString().Contains(roomtask.房间号))
                        {
                            roomtask.直播状态 = true;
                        }
                        else
                        {
                            roomtask.直播状态 = false;
                        }
                    }
                    else
                    {
                        ;
                    }
                }
                InfoLog.InfoPrintf("Vtbs数据加载成功", InfoLog.InfoClass.Debug);
            }
            catch (Exception e)
            {
                InfoLog.InfoPrintf("Vtbs数据加载失败,使用备用数据源开始获取", InfoLog.InfoClass.Debug);
                try
                {
                    JArray JO = (JArray)JsonConvert.DeserializeObject(MMPU.TcpSend(Server.RequestCode.GET_LIVELSIT, "{}", true));
                    foreach (var roomtask in RoomList)
                    {
                        if (!roomtask.称.Contains("-NV"))
                        {
                            roomtask.直播状态 = false;
                            if (JO.ToString().Contains(roomtask.房间号))
                            {
                                roomtask.直播状态 = true;
                            }
                            else
                            {
                                roomtask.直播状态 = false;
                            }
                        }
                        else
                        {
                            ;
                        }
                    }
                    InfoLog.InfoPrintf("备用数据源加载成功", InfoLog.InfoClass.Debug);
                }
                catch (Exception)
                {
                    InfoLog.InfoPrintf("备用缓存数据加载失败,使用原生阿Bapi开始获取开始获取", InfoLog.InfoClass.Debug);
                    使用B站API更新房间状态();
                }
            }
            InfoLog.InfoPrintf("使用VTBS数据库加载数据量:" + C1.ToString() + "/" + C2.ToString(), InfoLog.InfoClass.Debug);
        }
Esempio n. 30
0
        public static void BiliUser配置文件初始化(int 模式)
        {
            //账号登陆cookie
            try
            {
                MMPU.Cookie = Encryption.UnAesStr(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile), MMPU.AESKey, MMPU.AESVal);
                if (!MMPU.Cookie.Contains("=") || !MMPU.Cookie.Contains(";"))
                {
                    MMPU.Cookie = "";
                    MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                    MMPU.csrf = null;
                    MMPU.写ini配置文件("User", "csrf", "", MMPU.BiliUserFile);
                }
            }
            catch (Exception)
            {
                Console.WriteLine("读取cookie缓存错误");
                MMPU.Cookie = "";
                MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
            }
            //账号UID
            MMPU.UID = MMPU.读ini配置文件("User", "UID", MMPU.BiliUserFile); //string.IsNullOrEmpty(MMPU.读取exe默认配置文件("UID", "")) ? null : MMPU.读取exe默认配置文件("UID", "");
            //账号登陆cookie的有效期
            try
            {
                if (!string.IsNullOrEmpty(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile)))
                {
                    MMPU.CookieEX = DateTime.Parse(MMPU.读ini配置文件("User", "CookieEX", MMPU.BiliUserFile));
                    if (DateTime.Compare(DateTime.Now, MMPU.CookieEX) > 0)
                    {
                        MMPU.Cookie = "";

                        if (模式 == 0)
                        {
                            //MessageBox.Show("BILIBILI账号登陆已过期");
                            MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                            MMPU.csrf = null;
                            MMPU.写ini配置文件("User", "csrf", "", MMPU.BiliUserFile);
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (模式 == 0)
                {
                    MMPU.写ini配置文件("User", "Cookie", "", MMPU.BiliUserFile);
                }
                MMPU.Cookie = null;
            }
            //账号csrf
            if (string.IsNullOrEmpty(MMPU.Cookie))
            {
                InfoLog.InfoPrintf("\r\n===============================\r\nbilibili账号cookie为空或已过期,请更新BiliUser.ini信息\r\n===============================", InfoLog.InfoClass.载必要提示);
                InfoLog.InfoPrintf("\r\n==============\r\nBiliUser.ini文件无效,请使用DDTV本体登陆成功后把DDTV本体里的BiliUser.ini文件覆盖无效的文件\r\n==============", InfoLog.InfoClass.载必要提示);
                if (模式 == 1)
                {
                    InfoLog.InfoPrintf("\r\n如果短信验证方式验证启动失败,请复制DDTV2本体中有效BiliUser.ini覆盖本地文件后重启DDTVLiveRec\r\n[======如果是非windows系统,请检查文件权限======]", InfoLog.InfoClass.载必要提示);
                    try
                    {
                        bilibili.BiliUser.登陆();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.ToString());
                    }
                    while (string.IsNullOrEmpty(MMPU.Cookie))
                    {
                        InfoLog.InfoPrintf("\r\n请根据登陆验证提示操作", InfoLog.InfoClass.系统错误信息);
                        //InfoLog.InfoPrintf("\r\n阿B登陆验证失败!!!请重启DDTVLiveRec进行登陆验证", InfoLog.InfoClass.下载必要提示);
                        Thread.Sleep(10000);
                    }
                }
            }
            else
            {
                if (模式 == 0)
                {
                    if (!MMPU.加载网络房间方法.是否正在缓存)
                    {
                        new Task(() =>
                        {
                            加载网络房间方法.更新网络房间缓存();
                        }).Start();
                    }
                }
            }
            MMPU.csrf = MMPU.读ini配置文件("User", "csrf", MMPU.BiliUserFile);
        }