[runtime] Fix casting error in InternalCodePage.
[mono.git] / mcs / class / System.Web / System.Web / HttpApplicationStateWrapper.cs
1 //
2 // HttpApplicationStateWrapper.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008 Novell Inc. http://novell.com
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 using System;
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
35 using System.Runtime.CompilerServices;
36 using System.Runtime.Serialization;
37 using System.Security.Permissions;
38 using System.Security.Principal;
39 using System.Web.Caching;
40
41 namespace System.Web
42 {
43         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
44         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
45         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
46         public class HttpApplicationStateWrapper : HttpApplicationStateBase
47         {
48                 HttpApplicationState w;
49
50                 public HttpApplicationStateWrapper (HttpApplicationState httpApplicationState)
51                 {
52                         if (httpApplicationState == null)
53                                 throw new ArgumentNullException ("httpApplicationState");
54                         w = httpApplicationState;
55                 }
56
57                 public override string [] AllKeys {
58                         get { return w.AllKeys; }
59                 }
60
61                 public override HttpApplicationStateBase Contents {
62                         get { return new HttpApplicationStateWrapper (w.Contents); }
63                 }
64
65                 public override int Count {
66                         get { return w.Count; }
67                 }
68
69                 public override bool IsSynchronized {
70                         get { return ((ICollection) this).IsSynchronized; }
71                 }
72
73                 public override object this [int index] {
74                         get { return Get (index); }
75                 }
76
77                 public override object this [string name] {
78                         get { return Get (name); }
79                         set { Set (name, value); }
80                 }
81
82                 public override NameObjectCollectionBase.KeysCollection Keys {
83                         get { return w.Keys; }
84                 }
85
86                 public override HttpStaticObjectsCollectionBase StaticObjects {
87                         get { return new HttpStaticObjectsCollectionWrapper (w.StaticObjects); }
88                 }
89
90                 public override object SyncRoot {
91                         get { return ((ICollection) this).SyncRoot; }
92                 }
93
94                 public override void Add (string name, object value)
95                 {
96                         w.Add (name, value);
97                 }
98
99                 public override void Clear ()
100                 {
101                         w.Clear ();
102                 }
103
104                 public override void CopyTo (Array array, int index)
105                 {
106                         ((ICollection) this).CopyTo (array, index);
107                 }
108
109                 public override object Get (int index)
110                 {
111                         return w.Get (index);
112                 }
113
114                 public override object Get (string name)
115                 {
116                         return w.Get (name);
117                 }
118
119                 public override IEnumerator GetEnumerator ()
120                 {
121                         return w.GetEnumerator ();
122                 }
123
124                 public override string GetKey (int index)
125                 {
126                         return w.GetKey (index);
127                 }
128
129                 [MonoTODO]
130                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
131                 {
132                         w.GetObjectData (info, context);
133
134                         throw new NotImplementedException ();
135                 }
136
137                 public override void Lock ()
138                 {
139                         w.Lock ();
140                 }
141
142                 public override void OnDeserialization (object sender)
143                 {
144                         w.OnDeserialization (sender);
145                 }
146
147                 public override void Remove (string name)
148                 {
149                         w.Remove (name);
150                 }
151
152                 public override void RemoveAll ()
153                 {
154                         w.RemoveAll ();
155                 }
156
157                 public override void RemoveAt (int index)
158                 {
159                         w.RemoveAt (index);
160                 }
161
162                 public override void Set (string name, object value)
163                 {
164                         w.Set (name, value);
165                 }
166
167                 public override void UnLock ()
168                 {
169                         w.UnLock ();
170                 }
171         }
172 }