1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #if !DEBUG
- using System;
- using System.IO;
- #endif
- using System;
- using System.IO;
- using System.Linq;
- using System.Windows.Forms;
- using Update.Config;
- using Update.Util;
- namespace Update
- {
- class Program
- {
- //入口
- static void Main(string[] args)
- {
- #if DEBUG
- ////测试用地址
- HostConfig.Init(FilePathUtil.GetAbsolutePath("Test\\" + HostConfig.DEFAULT_NAME));
- #else
- if (args == null || args.Length < 1) return;
- //Progrom Files格式的文件夹会被拆分成两个参数传进来,所以需要进行合并
- HostConfig.Init(String.Join(" ", args.Select(t => t.ToString())));//运行
- #endif
- try
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- //手动更新且需要更新
- if (UpdateUtil.CheckUpdate()&&Const.IsAutoUpdate)
- {
- //需要更新
- Application.Run(new FrmUpdate());
- }
- else
- {
- //不需要更新,直接启动
- ProcessUtil.Start(HostConfig.ExecutablePath, "Updater Start");
- }
- }
- catch (Exception e)
- {
- MessageBox.Show(e.StackTrace);
- }
- }
- }
- }
|