Пример #1
0
        public bool VerifyConnection()
        {
            const string url = @"https://winchatty.com/v2/checkConnection";

            using (var client = new ChattyWebClient())
            {
                string result = client.DownloadString(url);

                return(string.IsNullOrEmpty(result));
            }
        }
Пример #2
0
        public bool VerifyCredentials(string username, string password)
        {
            const string url        = @"https://winchatty.com/v2/verifyCredentials";
            const string dataFormat = @"username={0}&password={1}";

            using (var client = new ChattyWebClient())
            {
                string data   = string.Format(dataFormat, username, password);
                string result = client.UploadString(url, data);

                return(result.Contains("\"isValid\":true"));
            }
        }
Пример #3
0
        public bool PostComment(string username, string password, int parentId, string text)
        {
            const string url        = @"https://winchatty.com/v2/postComment";
            const string dataFormat = @"username={0}&password={1}&parentId={2}&text={3}";

            using (var client = new ChattyWebClient())
            {
                string data   = string.Format(dataFormat, username, password, parentId, text);
                string result = client.UploadString(url, data);

                const string success = "{\"result\":\"success\"}";

                return(result == success);
            }
        }
Пример #4
0
        public bool SendMessage(string username, string password, string targetUsername, string subject, string text)
        {
            const string url        = @"https://winchatty.com/v2/sendMessage";
            const string dataFormat = @"username={0}&password={1}&to={2}&subject={3}&body={4}";

            using (var client = new ChattyWebClient())
            {
                string data   = string.Format(dataFormat, username, password, targetUsername, subject, text);
                string result = client.UploadString(url, data);

                const string success = "{\"result\":\"success\"}";

                return(result == success);
            }
        }