wzp
2021-07-28 864986e4cad03f6b9bba9a7e65379db496b62a6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace AsiaINFO.SMS.APPCMPP2
{
    using Common;
    using System;
    using System.Diagnostics;
    using System.Windows.Forms;
 
    internal static class Program
    {
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                SetEnv.SetEnvironmentVariable("NLS_LANG", "American_America.US7ASCII");
                Application.Run(new MainForm());
            }
            catch (Exception exception)
            {
                WorkLog.AddMsg("严重错误日志", exception.Message);
            }
            finally
            {
                string[] strArray = Process.GetCurrentProcess().MainModule.FileName.Split(new char[] { '\\' });
                RunCmd("taskkill /im " + strArray[strArray.Length - 1] + " /f ");
            }
        }
 
        public static string RunCmd(string command)
        {
            Process process = new Process {
                StartInfo = { FileName = "cmd.exe", Arguments = "/c " + command, UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }
            };
            process.Start();
            return process.StandardOutput.ReadToEnd();
        }
    }
}