Esempio n. 1
0
        static void Main(string[] args)
        {
            //判断有无管理员权限
            if (!CheckIsAdministrator(args))
            {
                Console.WriteLine("程序不是以管理员权限运行,程序退出...");
                return;
            }
            AttachConsole(-1);

            Console.WriteLine("命令行参数:{0}", String.Join(" ", args));

            //CreateUpdateRequestForTest();
            //CreatePackageInfoForTest();
            //CreatePackageInfoForDevOps();

            UpdateRequest request = UpdateUtils.ParseUpdateRequest(args);

            if (request != null)
            {
                if (CheckNeedUpdate(args, request))
                {
                    if (args.Contains("-c"))
                    {
                        RunAsConsole(args, request);
                    }
                    else
                    {
                        RunAsWpfApplication(args, request);
                    }
                }
            }
            else
            {
                if (args.Contains("-c"))
                {
                    Console.WriteLine("缺少升级所需的参数");
                    Console.WriteLine("程序退出...");
                    //Console.WriteLine("按任意键继续...");
                    //Console.Read();
                }
                else
                {
                    RunAsWpfApplication(args, request);
                }
            }
        }