InvalidProjectFileException.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // InvalidProjectFileException.cs:
  3. //
  4. // Author:
  5. // Marek Sieradzki ([email protected])
  6. //
  7. // (C) 2005 Marek Sieradzki
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. #if NET_2_0
  28. using System;
  29. using System.Runtime.Serialization;
  30. using System.Xml;
  31. namespace Microsoft.Build.BuildEngine {
  32. [Serializable]
  33. public sealed class InvalidProjectFileException : Exception {
  34. string baseMessage;
  35. int columnNumber;
  36. int endColumnNumber;
  37. string errorCode;
  38. string errorSubcategory;
  39. bool hasBeenLogged;
  40. string helpKeyword;
  41. int lineNumber;
  42. int endLineNumber;
  43. string message;
  44. string projectFile;
  45. public InvalidProjectFileException ()
  46. : base ("Invalid project file exception has occured")
  47. {
  48. this.message = "Invalid project file exception has occured";
  49. }
  50. public InvalidProjectFileException (string message)
  51. : base (message)
  52. {
  53. this.message = message;
  54. }
  55. public InvalidProjectFileException (string projectFile,
  56. int lineNumber,
  57. int columnNumber,
  58. int endLineNumber,
  59. int endColumnNumber,
  60. string message,
  61. string errorSubcategory,
  62. string errorCode,
  63. string helpKeyword)
  64. : base (message)
  65. {
  66. this.projectFile = projectFile;
  67. this.lineNumber = lineNumber;
  68. this.columnNumber = columnNumber;
  69. this.endLineNumber = endLineNumber;
  70. this.endColumnNumber = endColumnNumber;
  71. this.message = message;
  72. this.errorSubcategory = errorSubcategory;
  73. this.errorCode = errorCode;
  74. this.helpKeyword = helpKeyword;
  75. }
  76. public InvalidProjectFileException (string message,
  77. Exception innerException)
  78. : base (message, innerException)
  79. {
  80. }
  81. public InvalidProjectFileException (XmlNode xmlNode,
  82. string message,
  83. string errorSubcategory,
  84. string errorCode,
  85. string helpKeyword)
  86. : base (message)
  87. {
  88. this.message = message;
  89. this.errorSubcategory = errorSubcategory;
  90. this.errorCode = errorCode;
  91. this.helpKeyword = helpKeyword;
  92. }
  93. public override void GetObjectData (SerializationInfo info,
  94. StreamingContext context)
  95. {
  96. base.GetObjectData (info, context);
  97. info.AddValue ("BaseMessage", baseMessage);
  98. info.AddValue ("ColumnNumber", columnNumber);
  99. info.AddValue ("EndColumnNumber", endColumnNumber);
  100. info.AddValue ("ErrorCode", errorCode);
  101. info.AddValue ("ErrorSubcategory", errorSubcategory);
  102. info.AddValue ("HasBeenLogged", hasBeenLogged);
  103. info.AddValue ("HelpKeyword", helpKeyword);
  104. info.AddValue ("LineNumber", lineNumber);
  105. info.AddValue ("EndLineNumber", endLineNumber);
  106. info.AddValue ("ProjectFile", projectFile);
  107. }
  108. public string BaseMessage {
  109. get {
  110. return baseMessage;
  111. }
  112. }
  113. public int ColumnNumber {
  114. get {
  115. return columnNumber;
  116. }
  117. }
  118. public int EndColumnNumber {
  119. get {
  120. return endColumnNumber;
  121. }
  122. }
  123. public int EndLineNumber {
  124. get {
  125. return endLineNumber;
  126. }
  127. }
  128. public string ErrorCode {
  129. get {
  130. return errorCode;
  131. }
  132. }
  133. public string ErrorSubcategory {
  134. get {
  135. return errorSubcategory;
  136. }
  137. }
  138. public bool HasBeenLogged {
  139. get {
  140. return hasBeenLogged;
  141. }
  142. set {
  143. hasBeenLogged = value;
  144. }
  145. }
  146. public string HelpKeyword {
  147. get {
  148. return helpKeyword;
  149. }
  150. }
  151. public int LineNumber {
  152. get {
  153. return lineNumber;
  154. }
  155. }
  156. public override string Message {
  157. get {
  158. return base.Message;
  159. }
  160. }
  161. public string ProjectFile {
  162. get {
  163. return projectFile;
  164. }
  165. }
  166. }
  167. }
  168. #endif