Esempio n. 1
0
        void Page_Load(object o, EventArgs e)
        {
            Logger.Debug("Default.Page_Load. IsPostBack {0}", IsPostBack);

            if (IsPostBack == true)
            {
                return;
            }

            web_session = Global.Sessions [Session.SessionID];

            for (int i = 0; i < LanguageSupport.Languages.Length; i++)
            {
                languages_drop.Items.Add(new ListItem(LanguageSupport.Languages[i].Name,
                                                      LanguageSupport.Languages[i].LangCode));
            }

            if (Request.Cookies [CookieName] != null)
            {
                languages_drop.SelectedValue = Request.Cookies[CookieName].Value;
            }
            else             // Default language value
            {
                languages_drop.SelectedValue = DefaultLocale;
            }

            Global.Sessions [Session.SessionID].LanguageCode = languages_drop.SelectedValue;
        }
Esempio n. 2
0
        public string CreateImage(WebSession _session)
        {
            string file = GameImage.GetImageFileName (_session.Session.SessionID);
            image.CreateImage (_session.GameState, file);

            // Prevent IE from caching the image
            file += "?" + DateTime.Now.Ticks;
                return file;
        }
Esempio n. 3
0
        public string CreateImage(WebSession _session)
        {
            string file = GameImage.GetImageFileName(_session.Session.SessionID);

            image.CreateImage(_session.GameState, file);

            // Prevent IE from caching the image
            file += "?" + DateTime.Now.Ticks;
            return(file);
        }
Esempio n. 4
0
        protected void OnStartGame(Object sender, EventArgs e)
        {
            web_session           = Global.Sessions [Session.SessionID];
            web_session.GameState = null;

            // Collect language cookie
            Global.Sessions [Session.SessionID].LanguageCode = languages_drop.SelectedValue;

            Response.Cookies[CookieName].Value   = languages_drop.SelectedValue;
            Response.Cookies[CookieName].Expires = DateTime.Now.AddYears(1);

            Logger.Debug("Default.OnStartGame. Start game button click");
            Response.Redirect("Game.aspx");
        }
Esempio n. 5
0
        protected void OnStartGame(Object sender, EventArgs e)
        {
            web_session = Global.Sessions [Session.SessionID];
            web_session.GameState = null;

            // Collect language cookie
            Global.Sessions [Session.SessionID].LanguageCode = languages_drop.SelectedValue;

            Response.Cookies[CookieName].Value = languages_drop.SelectedValue;
            Response.Cookies[CookieName].Expires = DateTime.Now.AddYears (1);

            Logger.Debug ("Default.OnStartGame. Start game button click");
            Response.Redirect ("Game.aspx");
        }
Esempio n. 6
0
        protected virtual void Session_Start(Object sender, EventArgs e)
        {
            Logger.Debug("Global.Session_Start. Session {0}", Session.SessionID);

            WebSession details = new WebSession(HttpContext.Current.Session);

            lock (Sessions)
            {
                if (Sessions.ContainsKey(Session.SessionID))
                {
                    Sessions [Session.SessionID] = details;
                }
                else
                {
                    TotalSessions++;
                    Sessions.Add(Session.SessionID, details);
                }
            }
        }
Esempio n. 7
0
        void Page_Load(object o, EventArgs e)
        {
            Logger.Debug ("Default.Page_Load. IsPostBack {0}", IsPostBack);

            if (IsPostBack == true)
                return;

            web_session = Global.Sessions [Session.SessionID];

            for (int i = 0; i <LanguageSupport.Languages.Length; i++)
            {
                languages_drop.Items.Add (new ListItem (LanguageSupport.Languages[i].Name,
                    LanguageSupport.Languages[i].LangCode));
            }

            if (Request.Cookies [CookieName] != null)
                    languages_drop.SelectedValue = Request.Cookies[CookieName].Value;
            else // Default language value
                languages_drop.SelectedValue = DefaultLocale;

            Global.Sessions [Session.SessionID].LanguageCode = languages_drop.SelectedValue;
        }
Esempio n. 8
0
        public void Page_Load(object sender, EventArgs e)
        {
            updated_label.Text = "Updated: " + DateTime.Now;

            WebSession[] sessions;

            lock (Global.Sessions)
            {
                sessions = new WebSession [Global.Sessions.Count];
                Global.Sessions.Values.CopyTo(sessions, 0);
            }

            // Sessions
            foreach (WebSession session in sessions)
            {
                TableRow r = new TableRow();

                // Session ID
                TableCell c = new TableCell();
                c.Controls.Add(new LiteralControl(session.Session.SessionID.ToString()));
                r.Cells.Add(c);

                // Date
                c = new TableCell();
                c.Controls.Add(new LiteralControl(session.Started.ToString()));
                r.Cells.Add(c);

                sessions_table.Rows.Add(r);
            }

            // Application counters
            {
                TableRow r = new TableRow();

                AddCell(r, "Server started");
                AddCell(r, Global.Started.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Total sessions (as assigned by .Net)");
                AddCell(r, Global.TotalSessions.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Total started game sessions");
                AddCell(r, Global.TotalGamesSessions.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Total ended game sessions");
                AddCell(r, Global.TotalEndedSessions.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Total games played");
                AddCell(r, Global.TotalGames.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Total seconds played");
                AddCell(r, Global.TotalTimeSeconds.ToString());
                application_table.Rows.Add(r);

                r = new TableRow();
                AddCell(r, "Memory used");
                AddCell(r, GC.GetTotalMemory(false).ToString());
                application_table.Rows.Add(r);
            }

            total_label.Text = "Total active sessions: " + Global.Sessions.Count;

            // Games
            //string text = Game.CreateManager ().GetGamesSummary ();
            //text = text.Replace (Environment.NewLine, "<br/>");
            //games_label.Text = text;

            // Assemblies
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                TableRow     r    = new TableRow();
                AssemblyName name = asm.GetName();

                // Name
                TableCell c = new TableCell();
                c.Controls.Add(new LiteralControl(name.Name));
                r.Cells.Add(c);

                // Version
                c = new TableCell();
                c.Controls.Add(new LiteralControl(name.Version.ToString()));
                r.Cells.Add(c);

                assemblies_table.Rows.Add(r);
            }

            // Performance counters
            foreach (PerfCounter perf in PerfCounters)
            {
                TableRow r = new TableRow();

                // Category
                TableCell c = new TableCell();
                c.Controls.Add(new LiteralControl(perf.Category));
                r.Cells.Add(c);

                // Name
                c = new TableCell();
                c.Controls.Add(new LiteralControl(perf.Counter));
                r.Cells.Add(c);

                // Value
                c = new TableCell();
                c.Controls.Add(new LiteralControl(ReadCounter(perf.Category, perf.Counter)));
                r.Cells.Add(c);

                counters_table.Rows.Add(r);
            }
        }
Esempio n. 9
0
        protected virtual void Session_Start(Object sender, EventArgs e)
        {
            Logger.Debug ("Global.Session_Start. Session {0}", Session.SessionID);

            WebSession details = new WebSession (HttpContext.Current.Session);

            lock (Sessions)
            {
                if (Sessions.ContainsKey (Session.SessionID))
                {
                    Sessions [Session.SessionID] = details;
                }
                else
                {
                    TotalSessions++;
                    Sessions.Add (Session.SessionID, details);
                }
            }
        }
Esempio n. 10
0
        public void Page_Load(object sender, EventArgs e)
        {
            updated_label.Text = "Updated: " + DateTime.Now;

            WebSession[] sessions;

            lock (Global.Sessions)
            {
            sessions = new WebSession [Global.Sessions.Count];
            Global.Sessions.Values.CopyTo (sessions, 0);
            }

            // Sessions
            foreach (WebSession session in sessions)
            {
            TableRow r = new TableRow ();

            // Session ID
            TableCell c = new TableCell ();
                    c.Controls.Add (new LiteralControl (session.Session.SessionID.ToString ()));
                    r.Cells.Add (c);

            // Date
            c = new TableCell ();
                    c.Controls.Add (new LiteralControl (session.Started.ToString ()));
            r.Cells.Add (c);

            sessions_table.Rows.Add (r);
            }

            // Application counters
            {
            TableRow r = new TableRow ();

            AddCell (r, "Server started");
            AddCell (r, Global.Started.ToString());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Total sessions (as assigned by .Net)");
            AddCell (r, Global.TotalSessions.ToString ());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Total started game sessions");
            AddCell (r, Global.TotalGamesSessions.ToString ());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Total ended game sessions");
            AddCell (r, Global.TotalEndedSessions.ToString ());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Total games played");
            AddCell (r, Global.TotalGames.ToString ());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Total seconds played");
            AddCell (r, Global.TotalTimeSeconds.ToString ());
            application_table.Rows.Add (r);

            r = new TableRow ();
            AddCell (r, "Memory used");
            AddCell (r,  GC.GetTotalMemory(false).ToString ());
            application_table.Rows.Add (r);
            }

                total_label.Text = "Total active sessions: " + Global.Sessions.Count;

            // Games
            //string text = Game.CreateManager ().GetGamesSummary ();
            //text = text.Replace (Environment.NewLine, "<br/>");
            //games_label.Text = text;

            // Assemblies
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
            TableRow r = new TableRow ();
            AssemblyName name = asm.GetName ();

            // Name
            TableCell c = new TableCell ();
                    c.Controls.Add (new LiteralControl (name.Name));
                    r.Cells.Add (c);

            // Version
            c = new TableCell ();
                    c.Controls.Add (new LiteralControl (name.Version.ToString ()));
            r.Cells.Add (c);

            assemblies_table.Rows.Add (r);
            }

            // Performance counters
            foreach (PerfCounter perf in PerfCounters)
            {
            TableRow r = new TableRow ();

            // Category
            TableCell c = new TableCell ();
                    c.Controls.Add (new LiteralControl (perf.Category));
                    r.Cells.Add (c);

            // Name
            c = new TableCell ();
                    c.Controls.Add (new LiteralControl (perf.Counter));
            r.Cells.Add (c);

            // Value
            c = new TableCell ();
                    c.Controls.Add (new LiteralControl (ReadCounter (perf.Category, perf.Counter)));
            r.Cells.Add (c);

            counters_table.Rows.Add (r);
            }
        }