GetImageFileName() public static method

public static GetImageFileName ( string sessionid ) : string
sessionid string
return string
示例#1
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);
        }
示例#2
0
        protected virtual void Session_End(Object sender, EventArgs e)
        {
            const string CachePrefix = "@@@InProc@";
            string       sessionid;

            // Needed due to a bug in Mono < 2.7.
            // See: http://bugzilla.novell.com/show_bug.cgi?id=629990
            if (Session.SessionID.StartsWith(CachePrefix, StringComparison.OrdinalIgnoreCase))
            {
                sessionid = Session.SessionID.Substring(CachePrefix.Length);
            }
            else
            {
                sessionid = Session.SessionID;
            }

            Logger.Debug("Global.Session_End. Session {0}", sessionid);

            lock (Sessions)
            {
                if (Sessions.ContainsKey(sessionid))
                {
                    Sessions.Remove(sessionid);

                    try
                    {
                        File.Delete(GameImage.GetImageFileName(Session.SessionID));
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("Global.Session_End. Could not delete {0}, exception: {1}",
                                     GameImage.GetImageFileName(Session.SessionID), ex);
                    }
                }
                else
                {
                    Logger.Error("Global.Session_End. Could not find session " + Session.SessionID);
                }
            }
        }