跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

浏览文件

ProcessHelper.cs

36 行 · 941 B历史下载
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace Core.Librarys
9{
10 public class ProcessHelper
11 {
12 public static bool Run(string filename, string[] args)
13 {
14 try
15 {
16 string arguments = "";
17 foreach (string arg in args)
18 {
19 arguments += $"\"{arg}\" ";
20 }
21 arguments = arguments.Trim();
22 Process process = new Process();
23 ProcessStartInfo startInfo = new ProcessStartInfo(filename, arguments);
24 process.StartInfo = startInfo;
25 process.Start();
26 return true;
27 }
28 catch (Exception ex)
29 {
30 Logger.Error(ex.ToString());
31 return false;
32 }
33
34 }
35 }
36}