示例#1
0
        /// <summary>
        /// Не рекомендуется использовать извне.
        /// </summary>
        public ChatMessage ReadMessageAt(int msgNum)
        {
            InitJs();
            string jsResText = CustomBrowser.ExJsWithResult(
                JsFor_GetMessageAt(msgNum)
                ).Trim();

            if (string.IsNullOrWhiteSpace(jsResText) || CustomBrowser.CheckJsResult_IsUndefined(jsResText) || jsResText == "msgError")
            {
                ThrowInvalidJsResultExeption("JsFor_GetMessageAt", jsResText);
            }

            string jsResBool = CustomBrowser.ExJsWithResult(
                JsFor_CheckIfCompanionsMessageAt(msgNum)
                ).Trim();

            if (!CustomBrowser.CheckJsResult_WhiteList(jsResBool, new string[] { "1", "0" }))
            {
                ThrowInvalidJsResultExeption("JsFor_CheckIfCompanionsMessageAt", jsResBool);
            }
            jsResText = jsResText.Replace("<br>", "\n");

            ChatMessage res = new ChatMessage(
                jsResText,
                jsResBool == "1"
                );

            return(res);
        }
示例#2
0
        public bool GetWithUpdate_IsBotFuncsInitialized()
        {
            string jsRes = Convert.ToString(CustomBrowser.ExJsWithResult(JsFor_GetIsBotFuncsInitialized)).Trim();

            if (!CustomBrowser.CheckJsResult_WhiteList(jsRes, new string[] { "1", "0" }))
            {
                ThrowInvalidJsResultExeption("JsFor_GetIsBotFuncsInitialized", jsRes);
            }
            return(jsRes == "1");
        }
示例#3
0
        public bool GetWithUpdate_CheckCaptcha()
        {
            InitJs();
            string jsRes = Convert.ToString(CustomBrowser.ExJsWithResult(JsFor_CheckCaptcha)).Trim();

            if (!CustomBrowser.CheckJsResult_WhiteList(jsRes, new string[] { "1", "0" }))
            {
                ThrowInvalidJsResultExeption("JsFor_CheckCaptcha", jsRes);
            }
            return(jsRes == "1");
        }
示例#4
0
        public bool GetWithUpdate_IsStillTalking()
        {
            InitJs();
            string jsRes = Convert.ToString(CustomBrowser.ExJsWithResult(JsFor_CheckIfStillTalking)).Trim();

            if (!CustomBrowser.CheckJsResult_WhiteList(jsRes, new string[] { "1", "0" }))
            {
                ThrowInvalidJsResultExeption("JsFor_CheckIfStillTalking", jsRes);
            }

            isStillTalking = jsRes == "1";
            return(isStillTalking);
        }
示例#5
0
        public bool GetWithUpdate_IsSearchingCompanion()
        {
            isSearchingCompanion = false;
            return(isSearchingCompanion);

            string jsRes = CustomBrowser.ExJsWithResult(JsFor_CheckIfSearchingCompanion).Trim();

            if (!CustomBrowser.CheckJsResult_WhiteList(jsRes, new string[] { "1", "0" }))
            {
                ThrowInvalidJsResultExeption("JsFor_CheckIfSearchingCompanion", jsRes);
            }

            isSearchingCompanion = jsRes == "1";
            return(isSearchingCompanion);
        }
示例#6
0
        /// <summary>
        /// Не рекомендуется использовать извне.
        /// </summary>
        public int ReadMessagesCount()
        {
            InitJs();
            int?jsRes = null;

            try
            {
                jsRes = Convert.ToInt32(CustomBrowser.ExJsWithResult(
                                            JsFor_GetCountOfMessages
                                            ));
                return((int)jsRes);
            }
            catch
            {
                ThrowInvalidJsResultExeption("JsFor_GetCountOfMessages", "null");
                return(-9999);
            }
        }