2 // System.IO.FileNotFoundException.cs
5 // Paolo Molaro (lupus@ximian.com)
6 // Duncan Mak (duncan@ximian.com)
8 // (C) 2001 Ximian, Inc. http://www.ximian.com
10 using System.Globalization;
12 using System.Runtime.Serialization;
17 public class FileNotFoundException : IOException {
18 private string fileName;
19 private string fusionLog;
22 public FileNotFoundException ()
23 : base (Locale.GetText ("File not found"))
27 public FileNotFoundException (string message)
32 public FileNotFoundException (string message, Exception inner)
33 : base (message, inner)
37 public FileNotFoundException (string message, string fileName)
40 this.fileName = fileName;
43 public FileNotFoundException (string message, string fileName, Exception innerException)
44 : base (message, innerException)
46 this.fileName = fileName;
49 protected FileNotFoundException (SerializationInfo info, StreamingContext context)
50 : base (info, context)
52 fileName = info.GetString ("FileNotFound_FileName");
53 fusionLog = info.GetString ("FileNotFound_FusionLog");
56 public string FileName
58 get { return fileName; }
61 public string FusionLog
63 get { return fusionLog; }
66 public override string Message
69 if (base.Message == null)
70 return "File not found";
75 return "File '" + fileName + "' not found.";
79 public override void GetObjectData (SerializationInfo info, StreamingContext context)
81 base.GetObjectData (info, context);
82 info.AddValue ("FileNotFound_FileName", fileName);
83 info.AddValue ("FileNotFound_FusionLog", fusionLog);
86 public override string ToString ()
88 string result = GetType ().FullName + ": " + Message;
89 if (InnerException != null)
90 result += " ----> " + InnerException.ToString ();
92 if (StackTrace != null)
93 result += "\n" + StackTrace;