Exemple #1
0
        public void Connect()
        {
            /* Try to connect (this is slow :/) */

            this.ServerPage.MessageInfo("Attempting to connect to " + this.ServerName + " on " + this.ServerPort.ToString());
            Obsidian.DoConnect(this.ServerName, this.ServerPort, new NetworkThread.ConnectCallback(this.ServerSocket_Connect));
        }
Exemple #2
0
        //:stitch.chatspike.net 317  w00t Brik 2496 1145297959 seconds idle, signon time
        private static void Cmd317(string prefix, string command, string[] parameters, mcPage page)
        {
            int idle = Int32.Parse(parameters[2]);

            //string idleprefix = "second(s)";
            System.DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc).AddSeconds(double.Parse(parameters[3])).ToLocalTime();

            TimeSpan t          = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            int      timeonline = (int)t.TotalSeconds - int.Parse(parameters[3]);

            //string timeonlineprefix = "second(s)";

            /*
             * avoid negative online time if their local clock isn't quite right --
             * minor cosmetic detail, but I think it looks good. --w00t
             */
            if (idle > timeonline)
            {
                timeonline = idle;
            }

            /*
             * XXX - this could be improved on by using 'x hours, y mins' or something.
             * I'm unsure exactly how this would be done, I assume by using the modulus
             * or something. aquanight? --w00t
             */
                        #if DeadCode
            if (idle > 60)
            {
                /* get minutes */
                idle       = idle / 60;
                idleprefix = "minute(s)";

                if (idle > 60)
                {
                    /* get hours */
                    idle       = idle / 60;
                    idleprefix = "hours(s)";

                    if (idle > 24)
                    {
                        /* days */
                        idle       = idle / 24;
                        idleprefix = "day(s)";
                    }
                }
            }


            if (timeonline > 60)
            {
                /* get minutes */
                timeonline       = timeonline / 60;
                timeonlineprefix = "minute(s)";
                if (timeonline > 60)
                {
                    /* get hours */
                    timeonline       = timeonline / 60;
                    timeonlineprefix = "hours(s)";

                    if (timeonline > 24)
                    {
                        /* days */
                        timeonline       = timeonline / 24;
                        timeonlineprefix = "day(s)";
                    }
                }
            }
            page.Server.CurrentPage.MessageInfo("Idle: " + idle.ToString() + " " + idleprefix + " online for " + timeonline.ToString() + " " + timeonlineprefix + ", signon: " + time.ToString("ddd, MMM d, yyyy HH:mm:ss"));
                        #endif
            page.Server.CurrentPage.MessageInfo("Idle: " + Obsidian.FormatTime(idle) + " online for " + Obsidian.FormatTime(timeonline) + ", signon: " + time.ToString("ddd, MMM d, yyyy HH:mm:ss"));
        }