FileNotFoundException.cs 1.9 KB

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