本文整理汇总了C#中DataReceivedEventHandler类的典型用法代码示例。如果您正苦于以下问题:C# DataReceivedEventHandler类的具体用法?C# DataReceivedEventHandler怎么用?C# DataReceivedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataReceivedEventHandler类属于命名空间,在下文中一共展示了DataReceivedEventHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
public static ShellProcess Run(String cmd, String args,
DataReceivedEventHandler outputDataReceivedEventHandler,
DataReceivedEventHandler errorDataReceivedEventHandler)
{
return RunShellProcess(new ShellProcess(
cmd, args, outputDataReceivedEventHandler, errorDataReceivedEventHandler));
}
开发者ID:grerlrr,项目名称:X264ConversionWrapper,代码行数:7,代码来源:Shell.cs
示例2: startJavaShell
public bool startJavaShell(DataReceivedEventHandler dataReceivedCallBack, string extraExecutionArguments)
{
try
{
classPath = getListOfCurrentJarStubsForClassPath(classPath);
var executionArguments = string.Format(ikvm.IKVMExecution_Script,
classPath, classToExecute, extraExecutionArguments);
if (extraExecutionArguments!="")
executionArguments += " " + extraExecutionArguments;
var executionWorkingDirectory = PublicDI.config.CurrentExecutableDirectory;
dataReceived = null;
inputStream = null;
IKVMProcess = null;
IKVMProcess = Processes.startProcessAndRedirectIO(ikvm.IKVMExecutable, executionArguments, ref inputStream, dataReceivedCallBack, dataReceivedCallBack);
if (inputStream != null)
return true;
"in startJavaShell , IKVMProcess.inputStream == null".error();
}
catch (Exception ex)
{
ex.log();
}
return false;
}
开发者ID:pusp,项目名称:o2platform,代码行数:25,代码来源:JavaShell.cs
示例3: OnDataReceived
void OnDataReceived(DataReceivedEventHandler handler, DataReceivedEventArgs e)
{
if (handler != null)
{
handler(this, e);
}
}
开发者ID:mmajcica,项目名称:Rothko,代码行数:7,代码来源:ProcessWrapper.cs
示例4: CheckSshKey
public static Process CheckSshKey(string szSSHURL, DataReceivedEventHandler AppHandleOutput, DataReceivedEventHandler AppHandleError, EventHandler AppHandleAbort)
{
szSSHURL=szSSHURL.TrimEnd(':');
string szPort = null;
string szUrl = szSSHURL;
int nPos = szSSHURL.LastIndexOf(":");
if (nPos >= 0)
{
szPort = szSSHURL.Substring(nPos + 1, szSSHURL.Length - nPos - 1);
szUrl = szSSHURL.Substring(0, nPos );
}
string szExeArgument;
if(string.IsNullOrEmpty(szPort.Trim()))
{
szExeArgument = string.Format("-T \"{0}\"", szUrl); ;
}
else
{
szExeArgument = string.Format("-T -p {0} \"{1}\"", szPort, szUrl); ;
}
string.Format("-T -p 29418 [email protected] \"{0}\"", szSSHURL);
return CGitSourceConfig.m_objGitSrcModule.RunCommonCmdAsynch(@"ssh", szExeArgument, AppHandleOutput, AppHandleError, AppHandleAbort);
}
开发者ID:NHNChina,项目名称:nGit,代码行数:25,代码来源:CGitCmdSSH.cs
示例5: RunSimulation
public override void RunSimulation(DataReceivedEventHandler outputDataReceived, DataReceivedEventHandler errorDataReceived, EventHandler exited)
{
CreateCtlFile();
CreateShellScript();
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.FileName = CygwinDirectoryPath + "\\" + CygwinExecutionFilePath;
pInfo.UseShellExecute = false;
pInfo.CreateNoWindow = true;
pInfo.RedirectStandardInput = true;
pInfo.RedirectStandardOutput = true;
pInfo.RedirectStandardError = true;
CygwinProcess = new Process();
CygwinProcess.StartInfo = pInfo;
CygwinProcess.OutputDataReceived += outputDataReceived;
CygwinProcess.ErrorDataReceived += errorDataReceived;
CygwinProcess.Exited += exited ?? new EventHandler( (object o, EventArgs e) => { } );
CygwinProcess.Start();
CygwinProcess.EnableRaisingEvents = true;
CygwinProcess.BeginOutputReadLine();
CygwinProcess.BeginErrorReadLine();
CygwinProcess.StandardInput.WriteLine( @"cd " + WorkingDirectoryPathInCygwin );
CygwinProcess.StandardInput.WriteLine( @"./simulation.sh" );
//CygwinProcess.StandardInput.WriteLine( @"" );
//CygwinProcess.StandardInput.WriteLine( @"" );
//CygwinProcess.StandardInput.WriteLine( @"" );
CygwinProcess.StandardInput.WriteLine( @"exit" );
}
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:28,代码来源:CygwinEngine.cs
示例6: StartLivestreamer
private Task StartLivestreamer(string inputUrl, DataReceivedEventHandler onData)
=> Task.Run(() =>
{
Process livestreamer = new Process
{
StartInfo =
{
FileName = Config.LivestreamerDir,
Arguments = $"--stream-url {inputUrl} best",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
},
EnableRaisingEvents = true
};
livestreamer.OutputDataReceived += onData;
if (!livestreamer.Start())
Logger.FormattedWrite(typeof (TrackData).Name, "Failed starting livestreamer.",
ConsoleColor.Red);
livestreamer.BeginOutputReadLine();
livestreamer.WaitForExit();
livestreamer.OutputDataReceived -= onData;
});
开发者ID:SSStormy,项目名称:Stormbot,代码行数:27,代码来源:LivestreamerResolver.cs
示例7: Run
public static void Run(string testArgument, DataReceivedEventHandler dataReceived = null)
{
string jarArgs = String.Format("{0} {1}", JavaArgs, testArgument);
var processInfo = new ProcessStartInfo(JavaExecutable, jarArgs)
{
CreateNoWindow = true,
UseShellExecute = false, // redirected streams
// redirect output stream
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true
};
_process = new Process { StartInfo = processInfo, EnableRaisingEvents = true };
_process.OutputDataReceived += ProcessOnOutputDataReceived;
_process.ErrorDataReceived += ProcessOnErrorDataReceived;
if (dataReceived != null)
{
_process.OutputDataReceived += dataReceived;
_process.ErrorDataReceived += dataReceived;
}
_process.Start();
Trace.WriteLine("Java process started.");
_process.BeginOutputReadLine();
_process.BeginErrorReadLine();
Trace.WriteLine("Waiting for Java process to exit.");
_process.WaitForExit();
Trace.WriteLine("Java process exited.");
_process.Close();
}
开发者ID:pacificIT,项目名称:TomP2P.NET,代码行数:34,代码来源:JarRunner.cs
示例8: SyncCmd
public SyncCmd(DataReceivedEventHandler hander = null)
{
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
p.ErrorDataReceived += hander ?? new DataReceivedEventHandler(p_ErrorDataReceived);
p.StartInfo.WorkingDirectory = System.Environment.CurrentDirectory;
//设定程序名
p.StartInfo.FileName = "cmd.exe";
//关闭Shell的使用
p.StartInfo.UseShellExecute = false;
//重定向标准输入
p.StartInfo.RedirectStandardInput = true;
//重定向标准输出
p.StartInfo.RedirectStandardOutput = true;
//重定向错误输出
p.StartInfo.RedirectStandardError = true;
//设置不显示窗口
p.StartInfo.CreateNoWindow = true;
}
开发者ID:iraychen,项目名称:umeng-muti-channel-build-tool,代码行数:31,代码来源:Sys.cs
示例9: ExecuteAndWaitForExit
public static int ExecuteAndWaitForExit(string filename, string arguments, string workingDirectory, TextWriter outputData, TextWriter outputError, int? timeout)
{
var entrance = new object();
DataReceivedEventHandler d1 = null;
if (outputData != null)
{
d1 = new DataReceivedEventHandler(delegate(object x1, DataReceivedEventArgs e)
{
lock (entrance)
{
outputData.Write(e.Data);
}
});
}
DataReceivedEventHandler d2 = null;
if (outputError != null)
{
d2 = new DataReceivedEventHandler(delegate(object x1, DataReceivedEventArgs e)
{
lock (entrance)
{
outputError.Write(e.Data);
}
});
}
return ExecuteAndWaitForExit(filename, arguments, workingDirectory, d1, d2, null, null, timeout);
}
开发者ID:benbon,项目名称:SharpKit,代码行数:27,代码来源:ProcessHelper.cs
示例10: CGitAsynchFomr
public CGitAsynchFomr()
{
syncContext = SynchronizationContext.Current;
ProcessReceiveData = new DataReceivedEventHandler(GitProcessReceiveData);
ProcessAbort = new ExitProcessHandler(GitProcessExit);
ProcessErrorData = new DataReceivedEventHandler(GitProcessErrorData);
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:7,代码来源:CGitAsynchFomr.cs
示例11: executeAppScanDEScan
public Process executeAppScanDEScan(string targetFolder,string tempAppScanWorkingDirectory, DataReceivedEventHandler onAppScanLogEvent)
{
var executable = "java.exe";
var executableParams = appScanDECommandLineParams1 + appScanDECommandLineParams2 +
appScanDECommandLineParams3 + appScanDECommandLineParams4 +
appScanDECommandLineParams5 + appScanDECommandLineParams6 + " \"" + targetFolder + "\" \"" + tempAppScanWorkingDirectory + "\"";
return Processes.startProcessAsConsoleApplication(executable, executableParams, onAppScanLogEvent);
}
开发者ID:pusp,项目名称:o2platform,代码行数:8,代码来源:AppScanDE_Scanner.cs
示例12: executeJavaFile
// if we pass a callback for logging we need to start a IKVM shell
public Process executeJavaFile(string fileToExecute, DataReceivedEventHandler dataReceivedCallBack)
{
var IKVMShell = new JavaShell(ikvm);
IKVMShell.compileJavaFile(fileToExecute);
IKVMShell.executeClassFile(dataReceivedCallBack);
//IKVMShell.startJavaShell(dataReceivedCallBack, fileToExecute);
return IKVMShell.IKVMProcess;
}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Scripts,代码行数:9,代码来源:JavaExec.cs
示例13: CGitAsynchControl
public CGitAsynchControl()
{
//callback initialize
syncContext = SynchronizationContext.Current;
ProcessReceiveData = new DataReceivedEventHandler(GitProcessReceiveData);
ProcessAbort = new ExitProcessHandler(GitProcessExit);
ProcessErrorData = new DataReceivedEventHandler(GitProcessErrorData);
m_WaitForm = null;
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:9,代码来源:CGitAsynchControl.cs
示例14: UpLoadBranchAsynch
//asynch operation
public static Process UpLoadBranchAsynch(string szRemoteRepoName, string szBranch,DataReceivedEventHandler AppHandleOutput, DataReceivedEventHandler AppHandleError, EventHandler AppHandleAbort)
{
if (string.IsNullOrEmpty(szRemoteRepoName) || string.IsNullOrEmpty(szBranch))
{
return null;
}
string szExeCmd = string.Format("push {0} {1}", szRemoteRepoName, szBranch);
return CGitSourceConfig.m_objGitSrcModule.RunGitCmdAsynch(szExeCmd, AppHandleOutput, AppHandleError, AppHandleAbort);
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:10,代码来源:CGitCmdPush.cs
示例15: ShellProcess
public ShellProcess(String cmd, String args, DataReceivedEventHandler outputDataReceivedEventHandler)
{
ProcStartInfo = new ProcessStartInfo(cmd, args);
ProcStartInfo.RedirectStandardError = true;
ProcStartInfo.RedirectStandardOutput = true;
ProcStartInfo.UseShellExecute = false;
ProcStartInfo.CreateNoWindow = true;
m_OutputDataReceivedEventHandler = outputDataReceivedEventHandler;
m_ErrorDataReceivedEventHandler = null;
}
开发者ID:grerlrr,项目名称:X264ConversionWrapper,代码行数:10,代码来源:Shell.cs
示例16: runAsynch
public static Process runAsynch(string szRepositoryUrl, string szWorkingDir,DataReceivedEventHandler AppHandleOutput, DataReceivedEventHandler AppHandleError, EventHandler AppHandleAbort)
{
if (string.IsNullOrEmpty(szWorkingDir)||string.IsNullOrEmpty(szRepositoryUrl))
{
return null ;
}
string szArgument=GetArgument(szRepositoryUrl,szWorkingDir,null,0);
return CGitSourceConfig.m_objGitSrcModule.RunGitCmdAsynch(szArgument,AppHandleOutput,AppHandleError,AppHandleAbort);
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:10,代码来源:CGitCmdClone.cs
示例17: Execute
public bool Execute(CancellationToken cancellationToken, string workingDirectory, string commandPath, string commandArguments, out string output)
{
UnableToExecuteCommand = false;
Output = new StringBuilder();
DataReceivedEventHandlerOutput = new DataReceivedEventHandler(OnOutputDataReceived);
DataReceivedEventHandlerError = new DataReceivedEventHandler(OnErrorDataReceived);
var processCommand = new Process();
try
{
processCommand.StartInfo.WorkingDirectory = workingDirectory;
processCommand.StartInfo.FileName = commandPath;
processCommand.StartInfo.Arguments = commandArguments;
processCommand.StartInfo.UseShellExecute = false;
processCommand.StartInfo.CreateNoWindow = true;
processCommand.StartInfo.RedirectStandardError = true;
processCommand.StartInfo.RedirectStandardOutput = true;
processCommand.OutputDataReceived += DataReceivedEventHandlerOutput;
processCommand.ErrorDataReceived += DataReceivedEventHandlerError;
Output.Append(commandPath + " ");
Output.AppendLine(commandArguments);
_logger.Info(string.Format(Properties.Resource.InfoMessageCommandLineStarted, commandPath, commandArguments));
if (!cancellationToken.IsCancellationRequested)
{
cancellationToken.Register(() => processCommand.Kill());
processCommand.Start();
processCommand.BeginOutputReadLine();
processCommand.BeginErrorReadLine();
processCommand.WaitForExit();
}
cancellationToken.ThrowIfCancellationRequested();
_logger.Info(string.Format(Properties.Resource.InfoMessageCommandLineCompleted, commandPath, commandArguments));
}
finally
{
processCommand.OutputDataReceived -= DataReceivedEventHandlerOutput;
processCommand.ErrorDataReceived -= DataReceivedEventHandlerError;
processCommand.Close();
DataReceivedEventHandlerOutput = null;
DataReceivedEventHandlerError = null;
}
output = Output.ToString();
return !UnableToExecuteCommand;
}
开发者ID:taliesins,项目名称:talifun-commander,代码行数:53,代码来源:CommandLineExecutor.cs
示例18: PullBranchAsynch
//asynch operation
public static Process PullBranchAsynch(string szRemoteRepoName,string szRemoteBranch,bool bIsRebaseMode,DataReceivedEventHandler AppHandleOutput, DataReceivedEventHandler AppHandleError, EventHandler AppHandleAbort)
{
if (string.IsNullOrEmpty(szRemoteRepoName) || string.IsNullOrEmpty(szRemoteBranch))
{
return null;
}
string szExeCmd =string.Empty;
if (bIsRebaseMode == false)
szExeCmd= string.Format("pull -v --progress {0} {1}", szRemoteRepoName,szRemoteBranch);
else
szExeCmd = string.Format("pull -v --progress --rebase {0} {1}", szRemoteRepoName, szRemoteBranch);
return CGitSourceConfig.m_objGitSrcModule.RunGitCmdAsynch(szExeCmd, AppHandleOutput, AppHandleError, AppHandleAbort);
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:15,代码来源:CGitCmdPull.cs
示例19: Start
public void Start(String ScriptPath, DataReceivedEventHandler outoutData, DataReceivedEventHandler errorData)
{
if (!App.WebCrawlerConnected && !String.IsNullOrWhiteSpace(ScriptPath))
{
NodeInfo.Arguments = Path.GetFileName(ScriptPath);
NodeInfo.WorkingDirectory = Path.GetDirectoryName(ScriptPath);
node = Process.Start(NodeInfo);
node.BeginOutputReadLine();
node.BeginErrorReadLine();
node.OutputDataReceived += outoutData;
node.ErrorDataReceived += errorData;
}
}
开发者ID:dvgamer,项目名称:Touno.Sentinel-II,代码行数:15,代码来源:ProcessCall.cs
示例20: GetAllCommitsBySybcThread
public static Thread GetAllCommitsBySybcThread(DataReceivedEventHandler AppHandleOutput, DataReceivedEventHandler AppHandleError, EventHandler AppHandleAbort)
{
string szArgument = @"log -z --pretty=format:";
szArgument = szArgument + @"((__VALID_ITEM_0__))"; //@"((__VALID_COMMIT_ITEM__))";
szArgument += @"%H((__VALID_ITEM_1__))" //@"%H((__VALID_HASH_ITEM__))"
+ @"%P((__VALID_ITEM_2__))" //@"%P((__VALID_PARENT_ITEM__))"
+ @"%T((__VALID_ITEM_3__))"//@"%T((__VALID_TREE_ITEM__))"
+ @"%aN((__VALID_ITEM_4__))" //@"%aN((__VALID_AUTHOR_NAME_ITEM__))"
+ @"%aE((__VALID_ITEM_5__))" //@"%aE((__VALID_AUTHOR_EMAIL_ITEM__))"
+ @"%ai((__VALID_ITEM_6__))" //@"%ai((__VALID_AUTHOR_DATE_ITEM__))"
+ @"%cN((__VALID_ITEM_7__))" //@"%cN((__VALID_COMMITTER_NAME_ITEM__))"
+ @"%ci((__VALID_ITEM_8__))" // @"%ci((__VALID_COMMITTER_DATE_ITEM__))"
+ @"%e((__VALID_ITEM_9__))" // @"%e((__VALID_COMMITTER_ENCODE_ITEM__))"
+ @"%s((__VALID_ITEM_10__))" // @"%s((__VALID_COMMITTE_MESSAGE_ITEM__))"
+ @"%n";
szArgument = szArgument + @" --date-order --all --boundary";
return CGitSourceConfig.m_objGitSrcModule.RunGitCmdByThread(szArgument, AppHandleOutput, AppHandleError, AppHandleAbort);
}
开发者ID:nhnchengdu,项目名称:nGit,代码行数:18,代码来源:CGitCmdLog.cs
注:本文中的DataReceivedEventHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论