2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / WindowsBase / System.IO / FileFormatException.cs
blob38ae5d5a70ed5d37ea8b3e3a4beaca1788fecc2c
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 //
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
22 // Authors:
23 // Chris Toshok (toshok@ximian.com)
24 // Miguel de Icaza (miguel@ximian.com)
27 using System;
28 using System.Runtime.Serialization;
29 using System.Security;
31 namespace System.IO {
33 [Serializable]
34 public class FileFormatException : FormatException, ISerializable
36 Uri source_uri;
38 public FileFormatException () : base ()
42 public FileFormatException (string message) : base (message)
46 public FileFormatException (Uri sourceUri)
48 this.source_uri = sourceUri;
51 protected FileFormatException (SerializationInfo info, StreamingContext context)
52 : base (info, context)
54 if (info == null)
55 throw new ArgumentNullException ("info");
57 source_uri = (Uri) info.GetValue ("sourceUri", typeof (Uri));
60 public FileFormatException (string message, Exception innerException)
61 : base (message, innerException)
65 public FileFormatException (Uri sourceUri, Exception innerException)
66 : base ("", innerException)
68 source_uri = sourceUri;
71 public FileFormatException (Uri sourceUri, string message)
72 : base (message)
74 source_uri = sourceUri;
77 public FileFormatException (Uri sourceUri, string message, Exception innerException)
78 : base (message, innerException)
80 source_uri = sourceUri;
83 public Uri SourceUri {
84 get { return source_uri; }
87 [SecurityCritical]
88 public override void GetObjectData (SerializationInfo info, StreamingContext context)
90 base.GetObjectData (info, context);
91 info.AddValue ("sourceUri", source_uri);