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


C# Diagnostics.Process类代码示例

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


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

示例1: run_shell_script

 private static void run_shell_script()
 {
     System.Diagnostics.Process proc = new System.Diagnostics.Process();
     proc.EnableRaisingEvents = false;
     proc.StartInfo.FileName = "run.sh";
     proc.Start();
 }
开发者ID:SebastianLasisz,项目名称:Processing-video,代码行数:7,代码来源:MainWindow.cs

示例2: Help_Click

 private void Help_Click(object sender, RoutedEventArgs e)
 {
     var help = new System.Diagnostics.Process();
     help.StartInfo.FileName = @"Archiver Revolution.chm";
     help.StartInfo.UseShellExecute = true;
     help.Start();
 }
开发者ID:JKord,项目名称:ArchiverRevolution,代码行数:7,代码来源:MainWindow.xaml.cs

示例3: SpeakAsync

        public void SpeakAsync(string text)
        {
            if (MONO)
            {
                //if (_speechlinux == null)
                {
                    _state = SynthesizerState.Speaking;
                    _speechlinux = new System.Diagnostics.Process();
                    _speechlinux.StartInfo.RedirectStandardInput = true;
                    _speechlinux.StartInfo.UseShellExecute = false;
                    _speechlinux.StartInfo.FileName = "festival";
                    _speechlinux.Start();
                    _speechlinux.Exited += new EventHandler(_speechlinux_Exited);

                    log.Info("TTS: start " + _speechlinux.StartTime);

                }

                _state = SynthesizerState.Speaking;
                _speechlinux.StandardInput.WriteLine("(SayText \"" + text + "\")");
                _speechlinux.StandardInput.WriteLine("(quit)");

                _speechlinux.Close();

                _state = SynthesizerState.Ready;
            }
            else
            {
                _speechwindows.SpeakAsync(text);
            }

            log.Info("TTS: say " + text);
        }
开发者ID:kaldpils,项目名称:ardupilotone,代码行数:33,代码来源:Speech.cs

示例4: Reboot

                public static void Reboot()
                {
                        if (Lfx.Workspace.Master != null) {
                                Lfx.Workspace.Master.Disposing = true;
                                Lfx.Workspace.Master.Dispose();
                        }

                        string[] ParametrosAPasar = System.Environment.GetCommandLineArgs();
                        ParametrosAPasar[0] = "";
                        string Params = string.Join(" ", ParametrosAPasar).Trim();

                        string ExeName;
                        if (System.IO.File.Exists(Lfx.Environment.Folders.ApplicationFolder + "ActualizadorLazaro.exe"))
                                ExeName = Lfx.Environment.Folders.ApplicationFolder + "ActualizadorLazaro.exe";
                        else
                                ExeName = Lfx.Environment.Folders.ApplicationFolder + "Lazaro.exe";

                        System.Diagnostics.Process NuevoProceso = new System.Diagnostics.Process();
                        if (Lfx.Environment.SystemInformation.RunTime == Lfx.Environment.SystemInformation.RunTimes.DotNet) {
                                NuevoProceso.StartInfo = new System.Diagnostics.ProcessStartInfo(ExeName, Params);
                        } else {
                                string MonoName = Lfx.Environment.SystemInformation.Platform == SystemInformation.Platforms.Windows ? "mono.exe" : "/usr/bin/mono";
                                NuevoProceso.StartInfo = new System.Diagnostics.ProcessStartInfo(MonoName, @"""" + ExeName + @""" " + Params);
                        }

                        NuevoProceso.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
                        NuevoProceso.StartInfo.UseShellExecute = false;
                        NuevoProceso.Start();

                        System.Environment.Exit(0);
                }
开发者ID:solutema,项目名称:ultralight,代码行数:31,代码来源:Shell.cs

示例5: Chmod

 public static void Chmod(string Filename, int Chmod)
 {
     string exec = "chmod "+ Chmod.ToString() +" \""+ Filename +"\"";
     System.Diagnostics.Process process = new System.Diagnostics.Process();
     process.StartInfo.FileName = exec;
     process.Start();
 }
开发者ID:sundowndk,项目名称:SNDK,代码行数:7,代码来源:IO.cs

示例6: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();

            if(!UpdateSpec())
            {
                MessageBox.Show("error");
                return;
            }

            string path = Environment.CurrentDirectory.ToString() + "\\nuget.exe";

            if (!System.IO.File.Exists(directory + "\\nuget.exe"))
                System.IO.File.Copy(path, directory + "\\nuget.exe");

            System.Diagnostics.Process nuget = new System.Diagnostics.Process();
            nuget.StartInfo.FileName = directory + "\\nuget.exe";
            nuget.StartInfo.RedirectStandardOutput = true;
            nuget.StartInfo.UseShellExecute = false;
            nuget.StartInfo.WorkingDirectory = directory;
            nuget.StartInfo.Arguments = "pack ";//+ System.IO.Path.GetFileName(txtCsproj.Text);
            nuget.Start();

            var aa = nuget.StandardOutput.ReadToEnd();
            listBox1.Items.Add(nuget.StandardOutput.ReadToEnd());
        }
开发者ID:AlirezaP,项目名称:NugetUI,代码行数:26,代码来源:Form1.cs

示例7: CheckEpub

        //CheckEpubを実施、Output/Errorを表示する
        public void CheckEpub()
        {
            //EPUBチェック実施中パネルを表示する
            var checkingDlg = new EpubCheckingDialog();
            checkingDlg.Show();

            var p = new System.Diagnostics.Process();

            //実行ファイル
            p.StartInfo.FileName = javaPath;

            //引数
            var args = "-jar "
                        + "\""+ epubCheckPath + "\" "
                        +" \"" + epubPath + "\"";
            p.StartInfo.Arguments = args;

            //出力とエラーをストリームに書き込むようにする
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;

            //OutputDataReceivedとErrorDataReceivedイベントハンドラを追加
            p.OutputDataReceived += OutputDataReceived;
            p.ErrorDataReceived += ErrorDataReceived;

            p.StartInfo.RedirectStandardInput = false;
            p.StartInfo.CreateNoWindow = true;

            p.Start();

            p.BeginOutputReadLine();
            p.BeginErrorReadLine();

            p.WaitForExit();
            p.Close();

            var resultDlg = new EpubCheckResultDialog();

            //Outputをコピーする
            foreach (var output in outputLines)
            {
                resultDlg.outputTextBox.Text += (output + "\n");
            }

            //Errorをコピーする
            if (errorLines.Count> 1)
            {
                foreach (var error in errorLines)
                {
                    resultDlg.errorTextBox.Text += (error + "\n");
                }
            }
            else
            {
                resultDlg.errorTextBox.Text = "エラーはありませんでした。";
            }
            checkingDlg.Close();
            resultDlg.ShowDialog();
        }
开发者ID:sauberwind,项目名称:Nov2Epub,代码行数:61,代码来源:EpubCheckWrapper.cs

示例8: runningBalkCopy

        public static void runningBalkCopy(string dbName, string path, BCPDirection direction, string option, string remoteDb)
        {
            //ディレクション
            string strDirection = "in";
            if (direction == BCPDirection.BCP_OUT)
            {
                strDirection = "out";
            }
            else
            {
                strDirection = "in";
            }

            //リモートDB
            string strRemoteDb = "";
            if (remoteDb != "")
            {
                strRemoteDb = " -S " + remoteDb;
            }

            using (System.Diagnostics.Process proc = new System.Diagnostics.Process())
            {
                proc.StartInfo.FileName = "bcp";
                proc.StartInfo.Arguments = dbName + " " + strDirection + " \"" + path + "\" " + option + strRemoteDb;
                proc.Start();
                proc.WaitForExit();
            }
        }
开发者ID:yuta1011tokyo,项目名称:Liplis-Windows,代码行数:28,代码来源:LpsSqlServerBalkCopy.cs

示例9: Uninstall

        public override void Uninstall(IDictionary state)
        {
            //UninstallFirewallRule(state);
            /*
            bool rebootRequired;
            Interop.DriverPackageUninstallW(
                Context.Parameters["TARGETDIR"] + @"\ytdrv.inf",
                0,
                IntPtr.Zero,
                out rebootRequired
                );
            */
            // Удаляем драйвер.
            System.Diagnostics.Process infSetup =
                new System.Diagnostics.Process();

            infSetup.StartInfo.FileName = "rundll32";
            infSetup.StartInfo.Arguments =
                "advpack.dll, LaunchINFSection .\\ytdrv.inf,Uninstall.NT";
            infSetup.StartInfo.CreateNoWindow = true;
            infSetup.StartInfo.UseShellExecute = true;
            infSetup.StartInfo.WorkingDirectory = Context.Parameters["INSTDIR"];

            infSetup.Start();

            base.Uninstall(state);
        }
开发者ID:virl,项目名称:yttrium,代码行数:27,代码来源:ProjectInstaller.cs

示例10: Install

        public override void Install(IDictionary state)
        {
            // Устанавливаем драйвер.
            System.Diagnostics.Process infSetup =
                new System.Diagnostics.Process();

            infSetup.StartInfo.FileName = "rundll32";
            infSetup.StartInfo.Arguments = "syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\\ytdrv.inf";
            infSetup.StartInfo.CreateNoWindow = true;
            infSetup.StartInfo.UseShellExecute = false;
            infSetup.StartInfo.WorkingDirectory = Context.Parameters["INSTDIR"];

            infSetup.Start();

            base.Install(state);
            /*
            bool rebootRequired;
            int result = Interop.DriverPackageInstallW(
                Context.Parameters["INSTDIR"] + "ytdrv.inf",
                Interop.DRIVER_PACKAGE_LEGACY_MODE,
                IntPtr.Zero,
                out rebootRequired
                );

            MessageBox.Show(result.ToString("X"));
            //InstallFirewallRule(state);
             */
        }
开发者ID:virl,项目名称:yttrium,代码行数:28,代码来源:ProjectInstaller.cs

示例11: stackpanel_MouseDown

 private void stackpanel_MouseDown(object sender, MouseButtonEventArgs e)
 {
     string filename = (string)((StackPanel)(sender)).ToolTip;
     System.Diagnostics.Process process = new System.Diagnostics.Process();
     process.StartInfo = new System.Diagnostics.ProcessStartInfo(filename);
     process.Start();
 }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:7,代码来源:ImageViewer.xaml.cs

示例12: run

 void run()
 {
     System.Diagnostics.Process proc = new System.Diagnostics.Process();
     string strCmdLine="dir";
     //strCmdLine = "/C regenresx " + textBox1.Text + " " + textBox2.Text;
     System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
 }
开发者ID:ravihuang,项目名称:desktopassistant,代码行数:7,代码来源:RunShellScript.cs

示例13: Launch

		public static void Launch(Account account, String url) {

			if (account == null || account.Browser == null) {

				var action = new Action(() => System.Diagnostics.Process.Start(url));

				if (Program.MainForm.InvokeRequired) {
					Program.MainForm.Invoke(action);
				}
				else {
					action();
				}

				return;
			}

			Boolean poop = false;
			System.Diagnostics.Process browser = new System.Diagnostics.Process();

			browser.StartInfo.Arguments = url;
			browser.StartInfo.FileName = account.Browser.Path;

			try {
				browser.Start();
			}
			catch (InvalidOperationException) { poop = true; }
			catch (System.ComponentModel.Win32Exception) { poop = true; }

			if (poop) {
				System.Windows.Forms.Help.ShowHelp(Program.MainForm, url);
			}
		}
开发者ID:pamtbaau,项目名称:Gmail-Notifier-Plus,代码行数:32,代码来源:UrlHelper.cs

示例14: device_OnPaketArrival

        static void device_OnPaketArrival(object sender, CaptureEventArgs e)
        {
            Packet packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);
              var tcpPacket = TcpPacket.GetEncapsulated(packet);
            //  TcpPacket tcpPacket = packet.Extract(typeof(TcpPacket)) as TcpPacket;
              //string KeyWord = "qwe";
              if (tcpPacket != null) {
                  String SPort = tcpPacket.SourcePort.ToString();
                  var DPort = tcpPacket.DestinationPort.ToString();
                  var Data = Encoding.Unicode.GetString(tcpPacket.PayloadData); //Encoding.ASCII.GetString(tcpPacket.PayloadData).ToString();

                  if (OptionTCP.UnsafeCompareByte(tcpPacket.PayloadData, KeyWord))
                  {  //if  if (OptionTCP.UnsafeCompareByte(tcpPacket.PayloadData, KeyWord) && SPort = tcpPacket.SourcePort.ToString() == 1768)
                    Console.WriteLine("eeeeeeeess");
                    try
                    {
                        System.Diagnostics.Process proc = new System.Diagnostics.Process();
                        proc.StartInfo.FileName = "dropTcpPacket.exe";
                        proc.StartInfo.Arguments = StegWord;
                        proc.Start();
                    }
                    catch (Exception exp) {
                        Console.WriteLine("errro .. {0}", exp.ToString());
                    }
                  }
                  else Console.WriteLine("nnnnnnnnoo: {0}", Encoding.Unicode.GetString(KeyWord));

                  Console.WriteLine("Sport: {0},  DPort: {1}, Data: {2}", SPort, DPort, Data);
                  Console.WriteLine("==========================================================");

              }
        }
开发者ID:omusakhulu,项目名称:RSTEG,代码行数:32,代码来源:Program.cs

示例15: ExecuteCommand

        private static string ExecuteCommand(string fileName, string arguments)
        {
            try
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();

                process.StartInfo = new System.Diagnostics.ProcessStartInfo()
                {
                    FileName = fileName,
                    Arguments = arguments,
                    WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    UseShellExecute = false,
                    RedirectStandardError = true
                };

                process.Start();

                string error = process.StandardError.ReadToEnd();
                process.WaitForExit();

                return error;
            }
            catch (Exception e)
            {
                return e.Message;
            }
        }
开发者ID:TheX,项目名称:WinLess,代码行数:28,代码来源:Compiler.cs


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