[System] UriKind.RelativeOrAbsolute workaround.
[mono.git] / mcs / class / System.Web.Abstractions / System.Web / HttpFileCollectionWrapper.cs
1 //
2 // HttpFileCollectionWrapper.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.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
45         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
46         public class HttpFileCollectionWrapper : HttpFileCollectionBase
47         {
48                 HttpFileCollection w;
49
50                 public HttpFileCollectionWrapper (HttpFileCollection httpFileCollection)
51                 {
52                         if (httpFileCollection == null)
53                                 throw new ArgumentNullException ("httpFileCollection");
54                         w = httpFileCollection;
55                 }
56
57                 public override string [] AllKeys {
58                         get { return w.AllKeys; }
59                 }
60
61                 public override int Count {
62                         get { return w.Count; }
63                 }
64
65                 public override bool IsSynchronized {
66                         get { return ((ICollection) w).IsSynchronized; }
67                 }
68
69                 public override HttpPostedFileBase this [int index] {
70                         get { return Get (index); }
71                 }
72
73                 public override HttpPostedFileBase this [string name] {
74                         get { return Get (name); }
75                 }
76
77                 public override NameObjectCollectionBase.KeysCollection Keys {
78                         get { return w.Keys; }
79                 }
80
81                 public override object SyncRoot {
82                         get { return ((ICollection) w).SyncRoot; }
83                 }
84
85                 public override void CopyTo (Array dest, int index)
86                 {
87                         w.CopyTo (dest, index);
88                 }
89
90                 public override HttpPostedFileBase Get (int index)
91                 {
92                         HttpPostedFile file = w.Get (index);
93                         if (file == null)
94                                 return null;
95
96                         return new HttpPostedFileWrapper (file);
97                 }
98
99                 public override HttpPostedFileBase Get (string name)
100                 {
101                         HttpPostedFile file = w.Get (name);
102                         if (file == null)
103                                 return null;
104
105                         return new HttpPostedFileWrapper (file);
106                 }
107
108                 public override IEnumerator GetEnumerator ()
109                 {
110                         return w.GetEnumerator ();
111                 }
112
113                 public override string GetKey (int index)
114                 {
115                         return w.GetKey (index);
116                 }
117
118                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
119                 {
120                         w.GetObjectData (info, context);
121                 }
122
123                 public override void OnDeserialization (object sender)
124                 {
125                         w.OnDeserialization (sender);
126                 }
127         }
128 }