示例#1
0
        /// <summary>
        /// Submits data to be processed that has parameters.
        /// </summary>
        /// <param name="submitAct">The act being processed. (Example: login, register)</param>
        /// <returns>The result of the query as a byte array.</returns>
        public static bool SubmitData(string submitAct)
        {
            try
            {
                //MessageBox.Show(submitAct);

                using (ByteGuardWebClient byteguardWebClient = new ByteGuardWebClient())
                {
                    NameValueCollection submitData = new NameValueCollection {
                        { "act", submitAct }
                    };

                    byteguardWebClient.CookieJar = CookieContainer;

                    lock (LockObject)
                    {
                        Variables.WebResponse = Encoding.ASCII.GetString(byteguardWebClient.UploadValues(String.Format("{0}process.php", Variables.ByteGuardHost), submitData));
                    }

                    //MessageBox.Show(ByteGuardInterface.Globals.Variables.WebResponse);
                    return(true);
                }
            }
            catch
            {
                Variables.Containers.Active.SetStatus("The server appears to be offline.", 1);

                if (Variables.Containers.Main != null)
                {
                    Variables.Containers.Main.SetStatus("The server appears to be offline.", 1);
                }
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// Submits data to be processed that has parameters.
        /// </summary>
        /// <param name="submitAct">The act being processed. (Example: login, register)</param>
        /// <returns>The result of the query as a byte array.</returns>
        public static bool SubmitData(string submitAct)
        {
            try
            {
                //MessageBox.Show(submitAct);

                using (ByteGuardWebClient byteguardWebClient = new ByteGuardWebClient())
                {
                    NameValueCollection submitData = new NameValueCollection {
                        { "act", submitAct }
                    };

                    byteguardWebClient.CookieJar = CookieContainer;

                    lock (LockObject)
                    {
                        General.WebResponse = Encoding.ASCII.GetString(byteguardWebClient.UploadValues(String.Format("{0}process.php", General.ByteGuardHost), submitData));
                    }

                    //MessageBox.Show(ByteGuardInterface.Globals.Variables.WebResponse);
                    return(true);
                }
            }
            catch
            {
                MessageBox.Show("The server appears to be offline.2", "Update Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }
        }