FileNotFoundException.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // System.IO.FileNotFoundException.cs
  3. //
  4. // Author:
  5. // Paolo Molaro ([email protected])
  6. // Duncan Mak ([email protected])
  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. namespace System.IO {
  14. public class FileNotFoundException : IOException {
  15. private string fileName;
  16. private string fusionLog;
  17. private string msg;
  18. private Exception inner;
  19. // Constructors
  20. public FileNotFoundException ()
  21. : base (Locale.GetText ("File not found"))
  22. {
  23. msg = "File not found";
  24. }
  25. public FileNotFoundException (string message)
  26. : base (message)
  27. {
  28. msg = message;
  29. }
  30. public FileNotFoundException (string message, Exception inner)
  31. : base (message, inner)
  32. {
  33. msg = message;
  34. this.inner = inner;
  35. }
  36. public FileNotFoundException (string message, string fileName)
  37. : base (message)
  38. {
  39. msg = message;
  40. this.fileName = fileName;
  41. }
  42. public FileNotFoundException (string message, string fileName, Exception innerException)
  43. : base (message, innerException)
  44. {
  45. msg = message;
  46. this.fileName = fileName;
  47. inner = innerException;
  48. }
  49. protected FileNotFoundException (SerializationInfo info, StreamingContext context)
  50. : base (info, context)
  51. {
  52. fileName = info.GetString ("FileNotFound_FileName");
  53. fusionLog = info.GetString ("FileNotFound_FusionLog");
  54. }
  55. public string FileName
  56. {
  57. get { return fileName; }
  58. }
  59. public string FusionLog
  60. {
  61. get { return fusionLog; }
  62. }
  63. public override string Message
  64. {
  65. get { return Locale.GetText (msg); }
  66. }
  67. public override void GetObjectData (SerializationInfo info, StreamingContext context)
  68. {
  69. info.AddValue ("FileNotFound_FileName", fileName);
  70. info.AddValue ("FileNotFound_FusionLog", fusionLog);
  71. }
  72. public override string ToString ()
  73. {
  74. return inner.ToString();
  75. }
  76. }
  77. }