2
0

FileNotFoundException.cs 1.8 KB

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