Esempio n. 1
0
        public void login(ulong roomid)
        {
            string logintext = "type@=loginreq/roomid@=" + roomid.ToString() + "/\0";
            string jointext  = "type@=joingroup/rid@=" + roomid.ToString() + "/gid@=-9999/\0";

            byte[] loginraw = DataPack.MakeMsg(689, logintext);
            byte[] joinraw  = DataPack.MakeMsg(689, jointext);
            lock (this)
            {
                ClientSocket.Send(loginraw);
                ClientSocket.Send(joinraw);
            }
            LastTimeStamp = CommonTime.GetSeconds();
        }
Esempio n. 2
0
        public void keeplive(int s = 45)
        {
            long sec = CommonTime.GetSeconds() - LastTimeStamp;

            if (sec < s)
            {
                return;
            }
            LastTimeStamp = CommonTime.GetSeconds();
            string mrkltext = "type@=mrkl/\0";

            byte[] mrklraw = DataPack.MakeMsg(689, mrkltext);
            lock (this)
            {
                int snum = ClientSocket.Send(mrklraw);
            }
        }
Esempio n. 3
0
        public static string GetReqInfoLink(ulong roomid)
        {
            string api_url = "http://www.douyutv.com/api/v1/";
            string args    = string.Format(
                "room/{0}?aid=wp&client_sys=wp&time={1}",
                roomid.ToString(),
                CommonTime.GetSeconds().ToString()
                );

            string auth_md5 = args + "zNzMV1y4EMxOHS6I5WKm";
            MD5    md5      = new MD5CryptoServiceProvider();
            string auth_str = BitConverter.ToString
                                  (md5.ComputeHash(Encoding.UTF8.GetBytes(auth_md5))).Replace("-", "");
            string json_request_url = string.Format(
                "{0}{1}&auth={2}", api_url, args, auth_str.ToLower()
                );

            return(json_request_url);
        }