using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 测试
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] Args)
{
//自启动函数在CommonVariable 类里定义,要实例化才能调用
CommonVariable common = new CommonVariable();
//如果是管理员,则直接运行
common.AutoStart();
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
}
private void AutoStart()
{
var starupPath = GetType().Assembly.Location;
try
{
var fileName = starupPath;
var shortFileName = fileName.Substring(fileName.LastIndexOf('\\'