Пример #1
0
        public void SendKeepAlive()
        {
            Dictionary <string, string> Values = new Dictionary <string, string>();

            Values.Add("id", LogId);

            FormUrlEncodedContent Content = new FormUrlEncodedContent(Values);

            try
            {
                Task <HttpResponseMessage> PostTask = ConnectionClient.PostAsync(ConnectionAddress + "keep_alive_form.php", Content);
                if (PostTask.Wait(2000))
                {
                    HttpResponseMessage Response = PostTask.Result;

                    Task <string> ReadTask = Response.Content.ReadAsStringAsync();
                    if (ReadTask.Wait(2000))
                    {
                        string Result = ReadTask.Result;
                    }
                }
            }
            catch
            {
            }
        }
Пример #2
0
        public void UploadLog(string LoginName, string Channel, string Message, string Hash)
        {
            Dictionary <string, string> Values = new Dictionary <string, string>();

            Values.Add("id", LogId);
            Values.Add("name", LoginName);
            Values.Add("channel", Channel);
            Values.Add("guildname", GetGuildName(LoginName));
            Values.Add("message", Message);
            Values.Add("hash", Hash);

            try
            {
                FormUrlEncodedContent Content = new FormUrlEncodedContent(Values);

                Task <HttpResponseMessage> PostTask = ConnectionClient.PostAsync(ConnectionAddress + "upload_form.php", Content);
                if (PostTask.Wait(2000))
                {
                    HttpResponseMessage Response = PostTask.Result;

                    Task <string> ReadTask = Response.Content.ReadAsStringAsync();
                    if (ReadTask.Wait(2000))
                    {
                        string Result = ReadTask.Result;
                    }
                }
            }
            catch
            {
            }
        }
Пример #3
0
        public void DownloadLog(string GuildName, ref int RegisteredUserCount, ref int ConnectedUserCount, ref int GuestUserCount, Dictionary <string, int> GuildmateTable, List <string> ChatLineList)
        {
            Dictionary <string, string> Values = new Dictionary <string, string>();

            Values.Add("id", LogId);
            Values.Add("guildname", GuildName);
            Values.Add("index", LastReadIndex.ToString());

            try
            {
                FormUrlEncodedContent Content = new FormUrlEncodedContent(Values);

                Task <HttpResponseMessage> PostTask = ConnectionClient.PostAsync(ConnectionAddress + "download_form.php", Content);
                if (PostTask.Wait(2000))
                {
                    HttpResponseMessage Response = PostTask.Result;

                    Task <string> ReadTask = Response.Content.ReadAsStringAsync();
                    if (ReadTask.Wait(2000))
                    {
                        string   Result = ReadTask.Result;
                        string[] Lines  = Result.Split('\n');

                        bool IsUserInfoParsed = false;
                        for (int i = 0; i < Lines.Length; i++)
                        {
                            string Line = Lines[i];
                            if (Line.Length < 1 || Line[0] != '*')
                            {
                                continue;
                            }
                            Line = Line.Substring(1);

                            if (!IsUserInfoParsed)
                            {
                                IsUserInfoParsed = true;
                                ParseUserInfo(Line, ref RegisteredUserCount, ref ConnectedUserCount, ref GuestUserCount, GuildmateTable);
                            }
                            else
                            {
                                ChatLineList.Add(Line);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }