CompilerParameters.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // System.CodeDom.Compiler.CompilerParameters.cs
  3. //
  4. // Authors:
  5. // Daniel Stodden ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) 2002 Ximian, Inc.
  9. //
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. using System.Collections.Specialized;
  31. using System.Security.Policy;
  32. using System.Runtime.InteropServices;
  33. namespace System.CodeDom.Compiler
  34. {
  35. [ComVisible (false)]
  36. public class CompilerParameters
  37. {
  38. private string compilerOptions;
  39. #if (NET_1_1)
  40. private Evidence evidence;
  41. #endif
  42. private bool generateExecutable = false;
  43. private bool generateInMemory = false;
  44. private bool includeDebugInformation = false;
  45. private string mainClass;
  46. private string outputAssembly;
  47. private StringCollection referencedAssemblies;
  48. private TempFileCollection tempFiles;
  49. private bool treatWarningsAsErrors = false;
  50. private IntPtr userToken = IntPtr.Zero;
  51. private int warningLevel = -1;
  52. private string win32Resource;
  53. //
  54. // Constructors
  55. //
  56. public CompilerParameters()
  57. {
  58. }
  59. public CompilerParameters (string[] assemblyNames)
  60. {
  61. referencedAssemblies = new StringCollection();
  62. referencedAssemblies.AddRange (assemblyNames);
  63. }
  64. public CompilerParameters (string[] assemblyNames, string output)
  65. {
  66. referencedAssemblies = new StringCollection();
  67. referencedAssemblies.AddRange (assemblyNames);
  68. outputAssembly = output;
  69. }
  70. public CompilerParameters (string[] assemblyNames, string output, bool includeDebugInfo)
  71. {
  72. referencedAssemblies = new StringCollection();
  73. referencedAssemblies.AddRange (assemblyNames);
  74. outputAssembly = output;
  75. includeDebugInformation = includeDebugInfo;
  76. }
  77. //
  78. // Properties
  79. //
  80. public string CompilerOptions {
  81. get {
  82. return compilerOptions;
  83. }
  84. set {
  85. compilerOptions = value;
  86. }
  87. }
  88. #if (NET_1_1)
  89. public Evidence Evidence {
  90. get {
  91. return evidence;
  92. }
  93. set {
  94. evidence = value;
  95. }
  96. }
  97. #endif
  98. public bool GenerateExecutable {
  99. get {
  100. return generateExecutable;
  101. }
  102. set {
  103. generateExecutable = value;
  104. }
  105. }
  106. public bool GenerateInMemory {
  107. get {
  108. return generateInMemory;
  109. }
  110. set {
  111. generateInMemory = value;
  112. }
  113. }
  114. public bool IncludeDebugInformation {
  115. get {
  116. return includeDebugInformation;
  117. }
  118. set {
  119. includeDebugInformation = value;
  120. }
  121. }
  122. public string MainClass {
  123. get {
  124. return mainClass;
  125. }
  126. set {
  127. mainClass = value;
  128. }
  129. }
  130. public string OutputAssembly {
  131. get {
  132. return outputAssembly;
  133. }
  134. set {
  135. outputAssembly = value;
  136. }
  137. }
  138. public StringCollection ReferencedAssemblies {
  139. get {
  140. if (referencedAssemblies == null)
  141. referencedAssemblies = new StringCollection ();
  142. return referencedAssemblies;
  143. }
  144. }
  145. public TempFileCollection TempFiles {
  146. get {
  147. if (tempFiles == null)
  148. tempFiles = new TempFileCollection ();
  149. return tempFiles;
  150. }
  151. set {
  152. tempFiles = value;
  153. }
  154. }
  155. public bool TreatWarningsAsErrors {
  156. get {
  157. return treatWarningsAsErrors;
  158. }
  159. set {
  160. treatWarningsAsErrors = value;
  161. }
  162. }
  163. public IntPtr UserToken {
  164. get {
  165. return userToken;
  166. }
  167. set {
  168. userToken = value;
  169. }
  170. }
  171. public int WarningLevel {
  172. get {
  173. return warningLevel;
  174. }
  175. set {
  176. warningLevel = value;
  177. }
  178. }
  179. public string Win32Resource {
  180. get {
  181. return win32Resource;
  182. }
  183. set {
  184. win32Resource = value;
  185. }
  186. }
  187. }
  188. }