2 // HttpFileCollectionWrapper.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2008 Novell Inc. http://novell.com
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
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;
44 [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
46 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
47 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
48 public class HttpFileCollectionWrapper : HttpFileCollectionBase
52 public HttpFileCollectionWrapper (HttpFileCollection httpFileCollection)
54 if (httpFileCollection == null)
55 throw new ArgumentNullException ("httpFileCollection");
56 w = httpFileCollection;
59 public override string [] AllKeys {
60 get { return w.AllKeys; }
63 public override int Count {
64 get { return w.Count; }
67 public override bool IsSynchronized {
68 get { return ((ICollection) w).IsSynchronized; }
71 public override HttpPostedFileBase this [int index] {
72 get { return Get (index); }
75 public override HttpPostedFileBase this [string name] {
76 get { return Get (name); }
79 public override NameObjectCollectionBase.KeysCollection Keys {
80 get { return w.Keys; }
83 public override object SyncRoot {
84 get { return ((ICollection) w).SyncRoot; }
87 public override void CopyTo (Array dest, int index)
89 w.CopyTo (dest, index);
92 public override HttpPostedFileBase Get (int index)
94 return new HttpPostedFileWrapper (w.Get (index));
97 public override HttpPostedFileBase Get (string name)
99 return new HttpPostedFileWrapper (w.Get (name));
102 public override IEnumerator GetEnumerator ()
104 return w.GetEnumerator ();
107 public override string GetKey (int index)
109 return w.GetKey (index);
112 public override void GetObjectData (SerializationInfo info, StreamingContext context)
114 w.GetObjectData (info, context);
117 public override void OnDeserialization (object sender)
119 w.OnDeserialization (sender);