MineViewer.SMPInterface.Debug C# (CSharp) Method

Debug() public static method

public static Debug ( string s ) : void
s string
return void
        public static void Debug(string s)
        {
            System.Diagnostics.Debug.Write(s);
            try
            {
                Action d = new Action(delegate()
                {
                    if (s.EndsWith("\n"))
                        s = s.Substring(0, s.Length - 1);
                    string[] lines = new string[con.tbText.Lines.Length + 1];
                    if (con.tbText.Lines.Length > 0)
                        Array.Copy(con.tbText.Lines, lines, con.tbText.Lines.Length);
                    lines[lines.Length - 1] = s;
                    con.tbText.Lines = lines;

                    con.tbText.SelectionStart = con.tbText.Text.Length;
                    con.tbText.ScrollToCaret();
                    //con.tbText.Refresh();
                });
                con.Invoke(d);
            }
            catch { }
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Authecate the user to join
        /// </summary>
        private static bool Auth(string _Username, string _Password)
        {
            WebClient Client = new WebClient();
            string    returns;

            try
            {
                Debug("Connecting to minecraft.net...\n");
                PostData post = new PostData("http://minecraft.net/game/getversion.jsp");
                post.Add("user", _Username);
                post.Add("password", _Password);
                post.Add("version", "12");
                returns = post.GetResult(true);
            }
            catch { SMPInterface.LastError = "Could not connect to minecraft.net"; return(false); }
            SMPInterface.Debug("Authecation: " + returns + "\n");

            if (returns != "Bad login" && returns != "Old version" && returns != "Error")
            {
                string[] Bits = returns.Split(":".ToCharArray());

                SessionHash  = Bits[1];
                CaseUsername = Bits[2];
                SessionID    = Bits[3];

                return(true);
            }
            else
            {
                SMPInterface.LastError = returns;
                return(false);
            }
        }
All Usage Examples Of MineViewer.SMPInterface::Debug