Fri Jun 14 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / class / corlib / System.IO / FileNotFoundException.cs
1 //
2 // System.IO.FileNotFoundException.cs
3 //
4 // Author:
5 //   Paolo Molaro (lupus@ximian.com)
6 //   Duncan Mak (duncan@ximian.com)
7 //
8 // (C) 2001 Ximian, Inc.  http://www.ximian.com
9 //
10 using System.Globalization;
11 using System.IO;
12 using System.Runtime.Serialization;
13
14 namespace System.IO {
15
16         [Serializable]
17         public class FileNotFoundException : IOException {
18                 private string fileName;
19                 private string fusionLog;
20                 private string msg;
21                 private Exception inner;
22
23                 // Constructors
24                 public FileNotFoundException ()
25                         : base (Locale.GetText ("File not found"))
26                 {
27                         msg = "File not found";
28                 }
29
30                 public FileNotFoundException (string message)
31                         : base (message)
32                 {
33                         msg = message;
34                 }
35
36                 public FileNotFoundException (string message, Exception inner)
37                         : base (message, inner)
38                 {
39                         msg = message;
40                         this.inner = inner;
41                 }
42
43                 public FileNotFoundException (string message, string fileName)
44                         : base (message)
45                 {
46                         msg = message;
47                         this.fileName = fileName;
48                 }
49
50                 public FileNotFoundException (string message, string fileName, Exception innerException)
51                         : base (message, innerException)
52                 {
53                         msg = message;
54                         this.fileName = fileName;
55                         inner = innerException;
56                 }
57
58                 protected FileNotFoundException (SerializationInfo info, StreamingContext context)
59                         : base (info, context)
60                 {
61                         fileName = info.GetString ("FileNotFound_FileName");
62                         fusionLog = info.GetString ("FileNotFound_FusionLog");
63                         
64                 }
65
66                 public string FileName
67                 {
68                         get { return fileName; }
69                 }
70
71                 public string FusionLog
72                 {
73                         get { return fusionLog; }
74                 }
75
76                 public override string Message
77                 {
78                         get { return Locale.GetText (msg); }
79                 }
80
81                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
82                 {
83                         info.AddValue ("FileNotFound_FileName", fileName);
84                         info.AddValue ("FileNotFound_FusionLog", fusionLog);
85                 }
86
87                 public override string ToString ()
88                 {
89                         return "System.IO.FileNotFoundException: " + msg;
90                 }
91         }
92 }