ProcessStartInfo.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. //
  2. // System.Diagnostics.ProcessStartInfo.cs
  3. //
  4. // Authors:
  5. // Dick Porter ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) 2002 Ximian, Inc. http://www.ximian.com
  9. //
  10. using System.ComponentModel;
  11. using System.Collections.Specialized;
  12. namespace System.Diagnostics
  13. {
  14. [TypeConverter (typeof (ExpandableObjectConverter))]
  15. public sealed class ProcessStartInfo
  16. {
  17. private string arguments = "";
  18. private bool create_no_window = false;
  19. private bool error_dialog = false;
  20. private IntPtr error_dialog_parent_handle = (IntPtr)0;
  21. private string filename = "";
  22. private bool redirect_standard_error = false;
  23. private bool redirect_standard_input = false;
  24. private bool redirect_standard_output = false;
  25. private bool use_shell_execute = true;
  26. private string verb = "";
  27. private ProcessWindowStyle window_style = ProcessWindowStyle.Normal;
  28. private string working_directory = "";
  29. public ProcessStartInfo()
  30. {
  31. }
  32. public ProcessStartInfo(string filename)
  33. {
  34. this.filename = filename;
  35. }
  36. public ProcessStartInfo(string filename, string arguments)
  37. {
  38. this.filename = filename;
  39. this.arguments = arguments;
  40. }
  41. [RecommendedAsConfigurable (true), DefaultValue ("")]
  42. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  43. [MonitoringDescription ("Command line agruments for this process.")]
  44. public string Arguments {
  45. get {
  46. return(arguments);
  47. }
  48. set {
  49. arguments = value;
  50. }
  51. }
  52. [DefaultValue (false)]
  53. [MonitoringDescription ("Start this process with a new window.")]
  54. public bool CreateNoWindow {
  55. get {
  56. return(create_no_window);
  57. }
  58. set {
  59. create_no_window = value;
  60. }
  61. }
  62. [MonoTODO("Need to read the env block somehow")]
  63. [DesignerSerializationVisibility (DesignerSerializationVisibility.Content), DefaultValue (null)]
  64. [Editor ("System.Diagnostics.Design.StringDictionaryEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  65. [MonitoringDescription ("Environment variables used for this process.")]
  66. public StringDictionary EnvironmentVariables {
  67. get {
  68. throw new NotImplementedException();
  69. }
  70. }
  71. [DefaultValue (false)]
  72. [MonitoringDescription ("Thread shows dialogboxes for errors.")]
  73. public bool ErrorDialog {
  74. get {
  75. return(error_dialog);
  76. }
  77. set {
  78. error_dialog = value;
  79. }
  80. }
  81. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)]
  82. public IntPtr ErrorDialogParentHandle {
  83. get {
  84. return(error_dialog_parent_handle);
  85. }
  86. set {
  87. error_dialog_parent_handle = value;
  88. }
  89. }
  90. [RecommendedAsConfigurable (true), DefaultValue ("")]
  91. [Editor ("System.Diagnostics.Design.StartFileNameEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  92. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  93. [MonitoringDescription ("The name of the resource to start this process.")]
  94. public string FileName {
  95. get {
  96. return(filename);
  97. }
  98. set {
  99. filename = value;
  100. }
  101. }
  102. [DefaultValue (false)]
  103. [MonitoringDescription ("Errors of this process are redirected.")]
  104. public bool RedirectStandardError {
  105. get {
  106. return(redirect_standard_error);
  107. }
  108. set {
  109. redirect_standard_error = value;
  110. }
  111. }
  112. [DefaultValue (false)]
  113. [MonitoringDescription ("Standard input of this process is redirected.")]
  114. public bool RedirectStandardInput {
  115. get {
  116. return(redirect_standard_input);
  117. }
  118. set {
  119. redirect_standard_input = value;
  120. }
  121. }
  122. [DefaultValue (false)]
  123. [MonitoringDescription ("Standart output of this process is redirected.")]
  124. public bool RedirectStandardOutput {
  125. get {
  126. return(redirect_standard_output);
  127. }
  128. set {
  129. redirect_standard_output = value;
  130. }
  131. }
  132. [DefaultValue (true)]
  133. [MonitoringDescription ("Use the shell to start this process.")]
  134. public bool UseShellExecute {
  135. get {
  136. return(use_shell_execute);
  137. }
  138. set {
  139. use_shell_execute = value;
  140. }
  141. }
  142. [DefaultValue ("")]
  143. [TypeConverter ("System.Diagnostics.Design.VerbConverter, " + Consts.AssemblySystem_Design)]
  144. [MonitoringDescription ("The verb to apply to a used document.")]
  145. public string Verb {
  146. get {
  147. return(verb);
  148. }
  149. set {
  150. verb = value;
  151. }
  152. }
  153. [MonoTODO]
  154. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)]
  155. public string[] Verbs {
  156. get {
  157. return(null);
  158. }
  159. }
  160. [DefaultValue (typeof (ProcessWindowStyle), "Normal")]
  161. [MonitoringDescription ("The window style used to start this process.")]
  162. public ProcessWindowStyle WindowStyle {
  163. get {
  164. return(window_style);
  165. }
  166. set {
  167. window_style = value;
  168. }
  169. }
  170. [RecommendedAsConfigurable (true), DefaultValue ("")]
  171. [Editor ("System.Diagnostics.Design.WorkingDirectoryEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  172. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  173. [MonitoringDescription ("The initial directory for this process.")]
  174. public string WorkingDirectory {
  175. get {
  176. return(working_directory);
  177. }
  178. set {
  179. working_directory = value;
  180. }
  181. }
  182. }
  183. }