2002-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 23 Jun 2002 20:58:48 +0000 (20:58 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 23 Jun 2002 20:58:48 +0000 (20:58 -0000)
* HttpSessionState.cs: implemented more methods/properties.
* SessionDictionary.cs: New file.

svn path=/trunk/mcs/; revision=5424

mcs/class/System.Web/System.Web.SessionState/ChangeLog
mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs [new file with mode: 0644]

index 0a8f41a9e172146787dd02b3b78eea52cab93f9d..199a6ddd407944473454cd6fcfedf919bc476c6f 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-23  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpSessionState.cs: implemented more methods/properties.
+       * SessionDictionary.cs: New file.
+
 2002-06-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * System.Web.SessionState/HttpSessionState.cs:
index 9dd4f148549395663f1854a6597974304bee73eb..83ca50e4094b0d087ce7c701578d2dd88f2fe3c6 100644 (file)
-//\r
-// System.Web.SessionState.HttpSessionState\r
-//\r
-// Authors:\r
-//     Gonzalo Paniagua Javier (gonzalo@ximian.com)\r
-//\r
-// (C) 2002 Ximian, Inc (http://www.ximian.com)\r
-//\r
-using System;\r
-using System.Collections;\r
-using System.Collections.Specialized;\r
-\r
-namespace System.Web.SessionState {\r
-public sealed class HttpSessionState : ICollection, IEnumerable\r
-{\r
-       private int _codePage;\r
-       private NameValueCollection _state; //FIXME: it should be a ManagementNamedValueCollection\r
-\r
-       //public int CodePage -> compatibility with ASP\r
-\r
-       public HttpSessionState Contents\r
-       {\r
-               get { return this; }\r
-       }\r
-\r
-       public int Count\r
-       {\r
-               get { return _state.Count; }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public bool IsCookieless\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public bool IsNewSession\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public bool IsReadOnly\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public bool IsSynchronized\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       public object this [string key]\r
-       {\r
-               get { return _state [key]; }\r
-               set { _state [key] = (string) value; }\r
-       }\r
-\r
-       public object this [int index]\r
-       {\r
-               get { return _state [index]; }\r
-               set {\r
-                       string key = _state.Keys [index];\r
-                       _state [key] = (string) value;\r
-               }\r
-       }\r
-\r
-       public NameObjectCollectionBase.KeysCollection Keys\r
-       {\r
-               get { return _state.Keys; }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public int LCID\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-               set { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public SessionStateMode Mode\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public string SessionID\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public HttpStaticObjectsCollection StaticObjects\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-       }\r
-\r
-       public object SyncRoot\r
-       {\r
-               get { return this; }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public int Timeout\r
-       {\r
-               get { throw new NotImplementedException (); }\r
-               set { throw new NotImplementedException (); }\r
-       }\r
-\r
-       [MonoTODO]\r
-       public void Abandon ()\r
-       {\r
-               throw new NotImplementedException ();\r
-       }\r
-\r
-       public void Add (string name, object value)\r
-       {\r
-               if (_state == null)\r
-                       _state = new NameValueCollection ();\r
-\r
-               _state.Add (name, (string) value);\r
-       }\r
-\r
-       public void Clear ()\r
-       {\r
-               if (_state != null)\r
-                       _state.Clear ();\r
-       }\r
-       \r
-       public void CopyTo (Array array, int index)\r
-       {\r
-               if (_state == null)\r
-                       _state = new NameValueCollection ();\r
-\r
-               _state.CopyTo (array, index);\r
-       }\r
-\r
-       public IEnumerator GetEnumerator ()\r
-       {\r
-               if (_state == null)\r
-                       _state = new NameValueCollection ();\r
-\r
-               return _state.GetEnumerator ();\r
-       }\r
-       \r
-       public void Remove (string name)\r
-       {\r
-               if (_state != null)\r
-                       _state.Remove (name);\r
-       }\r
-\r
-       public void RemoveAll ()\r
-       {\r
-               if (_state != null)\r
-                       foreach (string key in _state.AllKeys)\r
-                               _state.Remove (key);\r
-       }\r
-\r
-       [MonoTODO("Implement ManagementNameValueCollection")]\r
-       public void RemoveAt (int index)\r
-       {\r
-               throw new NotImplementedException ();\r
-               //if (_state != null)\r
-               //      _state.RemoveAt (index);\r
-       }\r
-}\r
-}\r
-\r
+//
+// System.Web.SessionState.HttpSessionState
+//
+// Authors:
+//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Threading;
+
+namespace System.Web.SessionState {
+public sealed class HttpSessionState : ICollection, IEnumerable
+{
+       private NameValueCollection _state; //FIXME: it should be a ManagementNamedValueCollection
+       private string _id;
+       private SessionDictionary _dict;
+       private HttpStaticObjectsCollection _staticObjects;
+       private int _timeout;
+       private bool _newSession;
+       private bool _isCookieless;
+       private SessionStateMode _mode;
+       private bool _isReadonly;
+       private bool _abandoned;
+
+       internal HttpSessionState (string id,
+                                  SessionDictionary dict,
+                                  HttpStaticObjectsCollection staticObjects,
+                                  int timeout,
+                                  bool newSession,
+                                  bool isCookieless,
+                                  SessionStateMode mode,
+                                  bool isReadonly)
+       {
+               _id = id;
+               _dict = dict;
+               _staticObjects = staticObjects;
+               _timeout = timeout;
+               _newSession = newSession;
+               _isCookieless = isCookieless;
+               _mode = mode;
+               _isReadonly = isReadonly;
+       }
+
+       // Compatibility with ASP
+       public int CodePage
+       {
+               get { return 0; }
+       }
+
+       public HttpSessionState Contents
+       {
+               get { return this; }
+       }
+
+       public int Count
+       {
+               get { return _state.Count; }
+       }
+
+       public bool IsAbandoned
+       {
+               get { return _abandoned; }
+       }
+
+       public bool IsCookieless
+       {
+               get { return _isCookieless; }
+       }
+
+       public bool IsNewSession
+       {
+               get { return _newSession; }
+       }
+
+       public bool IsReadOnly
+       {
+               get { return _isReadonly; }
+       }
+
+       public bool IsSynchronized
+       {
+               get { return false; }
+       }
+
+       public object this [string key]
+       {
+               get { return _state [key]; }
+               set { _state [key] = (string) value; }
+       }
+
+       public object this [int index]
+       {
+               get { return _state [index]; }
+               set {
+                       string key = _state.Keys [index];
+                       _state [key] = (string) value;
+               }
+       }
+
+       public NameObjectCollectionBase.KeysCollection Keys
+       {
+               get { return _state.Keys; }
+       }
+
+       public int LCID
+       {
+               get { return Thread.CurrentThread.CurrentCulture.LCID; }
+               set { Thread.CurrentThread.CurrentCulture = new CultureInfo(value); }
+       }
+
+       public SessionStateMode Mode
+       {
+               get { return _mode; }
+       }
+
+       public string SessionID
+       {
+               get { return _id; }
+       }
+
+       public HttpStaticObjectsCollection StaticObjects
+       {
+               get { return _staticObjects; }
+       }
+
+       public object SyncRoot
+       {
+               get { return this; }
+       }
+
+       public int Timeout
+       {
+               get { return _timeout; }
+               set { _timeout = value; }
+       }
+
+       public void Abandon ()
+       {
+               _abandoned = true;
+       }
+
+       public void Add (string name, object value)
+       {
+               if (_state == null)
+                       _state = new NameValueCollection ();
+
+               _state.Add (name, (string) value);
+       }
+
+       public void Clear ()
+       {
+               if (_state != null)
+                       _state.Clear ();
+       }
+       
+       public void CopyTo (Array array, int index)
+       {
+               if (_state == null)
+                       _state = new NameValueCollection ();
+
+               _state.CopyTo (array, index);
+       }
+
+       public IEnumerator GetEnumerator ()
+       {
+               if (_state == null)
+                       _state = new NameValueCollection ();
+
+               return _state.GetEnumerator ();
+       }
+       
+       public void Remove (string name)
+       {
+               if (_state != null)
+                       _state.Remove (name);
+       }
+
+       public void RemoveAll ()
+       {
+               if (_state != null)
+                       foreach (string key in _state.AllKeys)
+                               _state.Remove (key);
+       }
+
+       [MonoTODO("Implement ManagementNameValueCollection")]
+       public void RemoveAt (int index)
+       {
+               throw new NotImplementedException ();
+               //if (_state != null)
+               //      _state.RemoveAt (index);
+       }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
new file mode 100644 (file)
index 0000000..8689d00
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// System.Web.SessionState.SessionDictionary
+//
+// Authors:
+//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Collections.Specialized;
+
+namespace System.Web.SessionState {
+internal class SessionDictionary : NameObjectCollectionBase
+{
+       private bool _dirty;
+
+       static SessionDictionary ()
+       {
+       }
+
+       public SessionDictionary ()
+       {
+       }
+
+       void Clear ()
+       {
+               _dirty = true;
+               BaseClear ();
+       }
+
+       [MonoTODO]
+       static SessionDictionary Deserialize (BinaryReader r)
+       {
+               throw new NotImplementedException ();
+       }
+
+       public string GetKey (int index)
+       {
+               return BaseGetKey (index);
+       }
+
+       [MonoTODO]
+       static bool IsInmutable (object o)
+       {
+               throw new NotImplementedException ();
+       }
+
+       void Remove (string s)
+       {
+               BaseRemove (s);
+               _dirty = true;
+       }
+
+       void RemoveAt (int index)
+       {
+               BaseRemoveAt (index);
+               _dirty = true;
+       }
+
+       [MonoTODO]
+       void Serialize(BinaryWriter w)
+       {
+               throw new NotImplementedException ();
+       }
+
+       bool Dirty
+       {
+               get { return _dirty; }
+               set { _dirty = value; }
+       }
+
+       object this [string s]
+       {
+               get { return BaseGet (s); }
+               set {
+                       BaseSet (s, value);
+                       _dirty = true;
+               }
+       }
+
+       object this [int index]
+       {
+               get { return BaseGet (index); }
+               set {
+                       BaseSet (index, value);
+                       _dirty = true;
+               }
+       }
+}
+
+}
+