当前位置: 首页>>代码示例>>C#>>正文


C# DataReceivedEventHandler类代码示例

本文整理汇总了C#中DataReceivedEventHandler的典型用法代码示例。如果您正苦于以下问题:C# DataReceivedEventHandler类的具体用法?C# DataReceivedEventHandler怎么用?C# DataReceivedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataReceivedEventHandler类属于命名空间,在下文中一共展示了DataReceivedEventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的DataReceivedEventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。