1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /* This file is part of SevenZipSharp.
- SevenZipSharp is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- SevenZipSharp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with SevenZipSharp. If not, see <http://www.gnu.org/licenses/>.
- */
- using System;
- using System.Windows.Forms;
- namespace AutomaticUpdate
- {
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
- {
- if (args.Length > 0)
- {
- FormMain.KillPath = args[0].Replace("|"," ");
- if (args.Length > 1)
- {
- FormMain.InputCompressFilePath = args[1].Replace("|", " ");
- }
- }
- System.Threading.Thread.Sleep(1500);
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.ThreadException += Application_ThreadException;
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- Application.Run(new FormMain());
-
- }
- static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
- {
- Exception Exception = (Exception)e.ExceptionObject;
- MessageBox.Show("更新失败,请关闭正在运行的程序后重试。\r\n错误原因:" + Exception.Message);
- // if (System.IO.File.Exists(FormMain.runApplicationPath))
- // {
- // FormMain.RunStart(FormMain.runApplicationPath);
- // }
- Application.ExitThread();
- Application.Exit();
- }
- static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
- {
- MessageBox.Show("更新失败,请关闭正在运行的程序后重试。\r\n错误原因:" + e.Exception.Message.ToString());
- Application.ExitThread();
- Application.Exit();
- }
- }
- }
|