本文整理汇总了C#中System.Diagnostics.Process.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Process.Run方法的具体用法?C# Process.Run怎么用?C# Process.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.Process
的用法示例。
在下文中一共展示了Process.Run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run(string message)
{
if (Environment.OSVersion.Platform != PlatformID.Unix &&
Environment.OSVersion.Platform != PlatformID.MacOSX)
{
message = message
.Replace("\"", "^\"")
.Replace(" ", "^ ")
.Replace("|", "^|")
.Replace("%", "^&")
.Replace("&", "^&")
.Replace("<", "^<")
.Replace(">", "^>");
}
message = "\"" + message + "\"";
var process = new Process();
process.Run(_file, message, false, _keyPath);
}
示例2: Execute
public void Execute(string[] arguments)
{
if (arguments.Length < 1)
return;
var visible = true;
var sb = new StringBuilder();
for (int i = 1; i < arguments.Length; i++)
{
if (arguments[i] == "--process-hidden")
{
visible = false;
continue;
}
sb.Append("\"" + arguments[i] + "\" ");
}
var proc = new Process();
proc.Run(
arguments[0],
sb.ToString().Trim(),
visible,
Environment.CurrentDirectory);
}
示例3: execute
private void execute(Process proc, string cmd, string arguments, Action<bool, string> onLineReceived)
{
Logger.Write("Executing {0} {1}", cmd, arguments);
if (onLineReceived != null)
proc.Query(cmd, arguments, false, Environment.CurrentDirectory, onLineReceived);
else
proc.Run(cmd, arguments, false, Environment.CurrentDirectory);
}
示例4: run
private void run(string cmd, string arguments)
{
try {
var proc = new Process();
proc.Run(cmd, arguments, false, Environment.NewLine);
} catch {
}
}
示例5: Run
public void Run(TreeNode node)
{
if (node.Tag == null)
return;
var result = (FileFindResult)node.Tag;
var directory = Path.GetDirectoryName(result.File);
if (result.Type == FileFindResultType.Directory || result.Type == FileFindResultType.DirectoryInProject)
directory = result.File;
var additionalParameters = "";
if (_defaultLanguage != null)
additionalParameters = " --default.language=" + _defaultLanguage;
var proc = new Process();
proc.Run("oi", additionalParameters, false, directory);
}