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


C# ProcInfo类代码示例

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


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

示例1: OnFailure

		public override void OnFailure () {}	// not use this function

		public override IEnumerator OnProcess ( ProcInfo pi )
		{
			string form = "";

			if (OnMakeDataForm (ref form)) 
			{
				OnSuccess (form);
			}
			else
			{
				ComDebug.Log(string.Format("{0}.OnMakeDataForm = false : {1}", this.GetType().ToString(), errorMsg));
				yield break;
			}

			if(string.IsNullOrEmpty(errorMsg) == false)
			{
				ComDebug.Log(string.Format("{0}.OnSuccess = false : {1}", this.GetType().ToString(), errorMsg));
				yield break;
			}

			yield return null;
		}
开发者ID:SNY-GROUP,项目名称:EMProject,代码行数:24,代码来源:ComFakeServerProcEntity.cs

示例2: Start_noshell

		private static bool Start_noshell (ProcessStartInfo startInfo,
						   Process process)
		{
			ProcInfo proc_info=new ProcInfo();
			IntPtr stdin_rd = IntPtr.Zero, stdin_wr = IntPtr.Zero;
			IntPtr stdout_wr;
			IntPtr stderr_wr;
			bool ret;
			MonoIOError error;

			if (startInfo.HaveEnvVars) {
				string [] strs = new string [startInfo.EnvironmentVariables.Count];
				startInfo.EnvironmentVariables.Keys.CopyTo (strs, 0);
				proc_info.envKeys = strs;

				strs = new string [startInfo.EnvironmentVariables.Count];
				startInfo.EnvironmentVariables.Values.CopyTo (strs, 0);
				proc_info.envValues = strs;
			}

			if (startInfo.RedirectStandardInput == true) {
				if (IsWindows) {
					int DUPLICATE_SAME_ACCESS = 0x00000002;
					IntPtr stdin_wr_tmp;

					ret = MonoIO.CreatePipe (out stdin_rd,
									 out stdin_wr_tmp);
					if (ret) {
						ret = MonoIO.DuplicateHandle (Process.GetCurrentProcess ().Handle, stdin_wr_tmp,
						Process.GetCurrentProcess ().Handle, out stdin_wr, 0, 0, DUPLICATE_SAME_ACCESS);
						MonoIO.Close (stdin_wr_tmp, out error);
					}
				}
				else
				{
					ret = MonoIO.CreatePipe (out stdin_rd,
									 out stdin_wr);
				}
				if (ret == false) {
					throw new IOException ("Error creating standard input pipe");
				}
			} else {
				stdin_rd = MonoIO.ConsoleInput;
				/* This is required to stop the
				 * &$*£ing stupid compiler moaning
				 * that stdin_wr is unassigned, below.
				 */
				stdin_wr = (IntPtr)0;
			}

			if (startInfo.RedirectStandardOutput == true) {
				IntPtr out_rd = IntPtr.Zero;
				if (IsWindows) {
					IntPtr out_rd_tmp;
					int DUPLICATE_SAME_ACCESS = 0x00000002;

					ret = MonoIO.CreatePipe (out out_rd_tmp,
									 out stdout_wr);
					if (ret) {
						MonoIO.DuplicateHandle (Process.GetCurrentProcess ().Handle, out_rd_tmp,
						Process.GetCurrentProcess ().Handle, out out_rd, 0, 0, DUPLICATE_SAME_ACCESS);
						MonoIO.Close (out_rd_tmp, out error);
					}
				}
				else {
					ret = MonoIO.CreatePipe (out out_rd,
									 out stdout_wr);
				}

				process.stdout_rd = out_rd;
				if (ret == false) {
					if (startInfo.RedirectStandardInput == true) {
						MonoIO.Close (stdin_rd, out error);
						MonoIO.Close (stdin_wr, out error);
					}

					throw new IOException ("Error creating standard output pipe");
				}
			} else {
				process.stdout_rd = (IntPtr)0;
				stdout_wr = MonoIO.ConsoleOutput;
			}

			if (startInfo.RedirectStandardError == true) {
				IntPtr err_rd = IntPtr.Zero;
				if (IsWindows) {
					IntPtr err_rd_tmp;
					int DUPLICATE_SAME_ACCESS = 0x00000002;

					ret = MonoIO.CreatePipe (out err_rd_tmp,
									 out stderr_wr);
					if (ret) {
						MonoIO.DuplicateHandle (Process.GetCurrentProcess ().Handle, err_rd_tmp,
						Process.GetCurrentProcess ().Handle, out err_rd, 0, 0, DUPLICATE_SAME_ACCESS);
						MonoIO.Close (err_rd_tmp, out error);
					}
				}
				else {
					ret = MonoIO.CreatePipe (out err_rd,
									 out stderr_wr);
//.........这里部分代码省略.........
开发者ID:kumpera,项目名称:mono,代码行数:101,代码来源:Process.cs

示例3: Start_shell

		private static bool Start_shell (ProcessStartInfo startInfo,
						 Process process)
		{
			ProcInfo proc_info=new ProcInfo();
			bool ret;

			if (startInfo.RedirectStandardInput ||
			    startInfo.RedirectStandardOutput ||
			    startInfo.RedirectStandardError) {
				throw new InvalidOperationException ("UseShellExecute must be false when redirecting I/O.");
			}

			if (startInfo.HaveEnvVars)
				throw new InvalidOperationException ("UseShellExecute must be false in order to use environment variables.");

			FillUserInfo (startInfo, ref proc_info);
			try {
				ret = ShellExecuteEx_internal (startInfo,
							       ref proc_info);
			} finally {
				if (proc_info.Password != IntPtr.Zero)
					Marshal.FreeBSTR (proc_info.Password);
				proc_info.Password = IntPtr.Zero;
			}
			if (!ret) {
				throw new Win32Exception (-proc_info.pid);
			}

			process.process_handle = proc_info.process_handle;
			process.pid = proc_info.pid;

			process.StartExitCallbackIfNeeded ();

			return(ret);
		}
开发者ID:kumpera,项目名称:mono,代码行数:35,代码来源:Process.cs

示例4: CreateProcess_internal

		private extern static bool CreateProcess_internal(ProcessStartInfo startInfo,
								  IntPtr stdin,
								  IntPtr stdout,
								  IntPtr stderr,
								  ref ProcInfo proc_info);
开发者ID:kumpera,项目名称:mono,代码行数:5,代码来源:Process.cs

示例5: ShellExecuteEx_internal

		private extern static bool ShellExecuteEx_internal(ProcessStartInfo startInfo,
								   ref ProcInfo proc_info);
开发者ID:kumpera,项目名称:mono,代码行数:2,代码来源:Process.cs

示例6: FillUserInfo

		// Note that ProcInfo.Password must be freed.
		private static void FillUserInfo (ProcessStartInfo startInfo, ref ProcInfo proc_info)
		{
#if NET_2_0
			if (startInfo.UserName != null) {
				proc_info.UserName = startInfo.UserName;
				proc_info.Domain = startInfo.Domain;
				if (startInfo.Password != null)
					proc_info.Password = Marshal.SecureStringToBSTR (startInfo.Password);
				else
					proc_info.Password = IntPtr.Zero;
				proc_info.LoadUserProfile = startInfo.LoadUserProfile;
			}
#endif
		}
开发者ID:kumpera,项目名称:mono,代码行数:15,代码来源:Process.cs

示例7: StartWithCreateProcess

		bool StartWithCreateProcess (ProcessStartInfo startInfo)
		{
			if (startInfo.StandardOutputEncoding != null && !startInfo.RedirectStandardOutput)
				throw new InvalidOperationException (SR.GetString(SR.StandardOutputEncodingNotAllowed));

			if (startInfo.StandardErrorEncoding != null && !startInfo.RedirectStandardError)
				throw new InvalidOperationException (SR.GetString(SR.StandardErrorEncodingNotAllowed));

			if (this.disposed)
				throw new ObjectDisposedException (GetType ().Name);

			var procInfo = new ProcInfo ();

			if (startInfo.HaveEnvVars) {
				List<string> envVariables = null;
				StringBuilder sb = null;

				foreach (DictionaryEntry de in startInfo.EnvironmentVariables) {
					if (de.Value == null)
						continue;

					if (envVariables == null)
						envVariables = new List<string> ();

					if (sb == null)
						sb = new StringBuilder ();
					else
						sb.Clear ();

					sb.Append ((string) de.Key);
					sb.Append ('=');
					sb.Append ((string) de.Value);

					envVariables.Add (sb.ToString ());
				}

				procInfo.envVariables = envVariables?.ToArray ();
			}

			MonoIOError error;
			IntPtr stdin_read = IntPtr.Zero, stdin_write = IntPtr.Zero;
			IntPtr stdout_read = IntPtr.Zero, stdout_write = IntPtr.Zero;
			IntPtr stderr_read = IntPtr.Zero, stderr_write = IntPtr.Zero;

			try {
				if (startInfo.RedirectStandardInput) {
					CreatePipe (out stdin_read, out stdin_write, true);
				} else {
					stdin_read = MonoIO.ConsoleInput;
					stdin_write = IntPtr.Zero;
				}

				if (startInfo.RedirectStandardOutput) {
					CreatePipe (out stdout_read, out stdout_write, false);
				} else {
					stdout_read = IntPtr.Zero;
					stdout_write = MonoIO.ConsoleOutput;
				}

				if (startInfo.RedirectStandardError) {
					CreatePipe (out stderr_read, out stderr_write, false);
				} else {
					stderr_read = IntPtr.Zero;
					stderr_write = MonoIO.ConsoleError;
				}

				FillUserInfo (startInfo, ref procInfo);

				//
				// FIXME: For redirected pipes we need to send descriptors of
				// stdin_write, stdout_read, stderr_read to child process and
				// close them there (fork makes exact copy of parent's descriptors)
				//
				if (!CreateProcess_internal (startInfo, stdin_read, stdout_write, stderr_write, ref procInfo)) {
					throw new Win32Exception (-procInfo.pid, "ApplicationName='" + startInfo.FileName + "', CommandLine='" + startInfo.Arguments +
						"', CurrentDirectory='" + startInfo.WorkingDirectory + "', Native error= " + Win32Exception.GetErrorMessage (-procInfo.pid));
				}
			} catch {
				if (startInfo.RedirectStandardInput) {
					if (stdin_read != IntPtr.Zero)
						MonoIO.Close (stdin_read, out error);
					if (stdin_write != IntPtr.Zero)
						MonoIO.Close (stdin_write, out error);
				}

				if (startInfo.RedirectStandardOutput) {
					if (stdout_read != IntPtr.Zero)
						MonoIO.Close (stdout_read, out error);
					if (stdout_write != IntPtr.Zero)
						MonoIO.Close (stdout_write, out error);
				}

				if (startInfo.RedirectStandardError) {
					if (stderr_read != IntPtr.Zero)
						MonoIO.Close (stderr_read, out error);
					if (stderr_write != IntPtr.Zero)
						MonoIO.Close (stderr_write, out error);
				}

				throw;
//.........这里部分代码省略.........
开发者ID:BrzVlad,项目名称:mono,代码行数:101,代码来源:Process.cs

示例8: StartWithShellExecuteEx

		bool StartWithShellExecuteEx (ProcessStartInfo startInfo)
		{
			if (this.disposed)
				throw new ObjectDisposedException (GetType ().Name);

			if (!String.IsNullOrEmpty(startInfo.UserName) || (startInfo.Password != null))
				throw new InvalidOperationException(SR.GetString(SR.CantStartAsUser));

			if (startInfo.RedirectStandardInput || startInfo.RedirectStandardOutput || startInfo.RedirectStandardError)
				throw new InvalidOperationException(SR.GetString(SR.CantRedirectStreams));

			if (startInfo.StandardErrorEncoding != null)
				throw new InvalidOperationException(SR.GetString(SR.StandardErrorEncodingNotAllowed));

			if (startInfo.StandardOutputEncoding != null)
				throw new InvalidOperationException(SR.GetString(SR.StandardOutputEncodingNotAllowed));

			// can't set env vars with ShellExecuteEx...
			if (startInfo.environmentVariables != null)
				throw new InvalidOperationException(SR.GetString(SR.CantUseEnvVars));

			ProcInfo procInfo = new ProcInfo();
			bool ret;

			FillUserInfo (startInfo, ref procInfo);
			try {
				ret = ShellExecuteEx_internal (startInfo, ref procInfo);
			} finally {
				if (procInfo.Password != IntPtr.Zero)
					Marshal.ZeroFreeBSTR (procInfo.Password);
				procInfo.Password = IntPtr.Zero;
			}
			if (!ret) {
				throw new Win32Exception (-procInfo.pid);
			}

			SetProcessHandle (new SafeProcessHandle (procInfo.process_handle, true));
			SetProcessId (procInfo.pid);

			return ret;
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:41,代码来源:Process.cs

示例9: Start_noshell

		static bool Start_noshell (ProcessStartInfo startInfo, Process process)
		{
			var proc_info = new ProcInfo ();

			if (startInfo.HaveEnvVars) {
				string [] strs = new string [startInfo.EnvironmentVariables.Count];
				startInfo.EnvironmentVariables.Keys.CopyTo (strs, 0);
				proc_info.envKeys = strs;

				strs = new string [startInfo.EnvironmentVariables.Count];
				startInfo.EnvironmentVariables.Values.CopyTo (strs, 0);
				proc_info.envValues = strs;
			}

			MonoIOError error;
			IntPtr stdin_read = IntPtr.Zero, stdin_write = IntPtr.Zero;
			IntPtr stdout_read = IntPtr.Zero, stdout_write = IntPtr.Zero;
			IntPtr stderr_read = IntPtr.Zero, stderr_write = IntPtr.Zero;

			try {
				if (startInfo.RedirectStandardInput) {
					CreatePipe (out stdin_read, out stdin_write, true);
				} else {
					stdin_read = MonoIO.ConsoleInput;
					stdin_write = IntPtr.Zero;
				}

				if (startInfo.RedirectStandardOutput) {
					CreatePipe (out stdout_read, out stdout_write, false);
				} else {
					stdout_read = IntPtr.Zero;
					stdout_write = MonoIO.ConsoleOutput;
				}

				if (startInfo.RedirectStandardError) {
					CreatePipe (out stderr_read, out stderr_write, false);
				} else {
					stderr_read = IntPtr.Zero;
					stderr_write = MonoIO.ConsoleError;
				}

				FillUserInfo (startInfo, ref proc_info);

				//
				// FIXME: For redirected pipes we need to send descriptors of
				// stdin_write, stdout_read, stderr_read to child process and
				// close them there (fork makes exact copy of parent's descriptors)
				//
				if (!CreateProcess_internal (startInfo, stdin_read, stdout_write, stderr_write, ref proc_info)) {
					throw new Win32Exception (-proc_info.pid, 
					"ApplicationName='" + startInfo.FileName +
					"', CommandLine='" + startInfo.Arguments +
					"', CurrentDirectory='" + startInfo.WorkingDirectory +
					"', Native error= " + Win32Exception.W32ErrorMessage (-proc_info.pid));
				}
			} catch {
				if (startInfo.RedirectStandardInput) {
					if (stdin_read != IntPtr.Zero)
						MonoIO.Close (stdin_read, out error);
					if (stdin_write != IntPtr.Zero)
						MonoIO.Close (stdin_write, out error);
				}

				if (startInfo.RedirectStandardOutput) {
					if (stdout_read != IntPtr.Zero)
						MonoIO.Close (stdout_read, out error);
					if (stdout_write != IntPtr.Zero)
						MonoIO.Close (stdout_write, out error);
				}

				if (startInfo.RedirectStandardError) {
					if (stderr_read != IntPtr.Zero)
						MonoIO.Close (stderr_read, out error);
					if (stderr_write != IntPtr.Zero)
						MonoIO.Close (stderr_write, out error);
				}

				throw;
			} finally {
				if (proc_info.Password != IntPtr.Zero) {
					Marshal.ZeroFreeBSTR (proc_info.Password);
					proc_info.Password = IntPtr.Zero;
				}
			}

			process.process_handle = proc_info.process_handle;
			process.pid = proc_info.pid;
			
			if (startInfo.RedirectStandardInput) {
				//
				// FIXME: The descriptor needs to be closed but due to wapi io-layer
				// not coping with duplicated descriptors any StandardInput write fails
				//
				// MonoIO.Close (stdin_read, out error);

#if MOBILE
				var stdinEncoding = Encoding.Default;
#else
				var stdinEncoding = Console.InputEncoding;
#endif
//.........这里部分代码省略.........
开发者ID:igorshmukler,项目名称:mono,代码行数:101,代码来源:Process.cs

示例10: OnProcess

		public abstract IEnumerator OnProcess ( ProcInfo pi ) ;
开发者ID:SNY-GROUP,项目名称:EMProject,代码行数:1,代码来源:ComProcEntity.cs

示例11: OnProcess

		public override IEnumerator OnProcess ( ProcInfo pi )
		{
			yield return null;
		}
开发者ID:SNY-GROUP,项目名称:EMProject,代码行数:4,代码来源:ComTCPProcEntity.cs

示例12: CreateProcess_internal

		private static bool CreateProcess_internal(ProcessStartInfo startInfo,
		IntPtr stdin,
		IntPtr stdout,
		IntPtr stderr,
		ref ProcInfo proc_info)
		{
			throw new System.NotImplementedException();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:Process.Mosa.cs

示例13: ShellExecuteEx_internal

		private static bool ShellExecuteEx_internal(ProcessStartInfo startInfo,
		ref ProcInfo proc_info)
		{
			throw new System.NotImplementedException();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:5,代码来源:Process.Mosa.cs


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