Example #1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                return;
            }

            if (args[0] == "update")
            {
                try
                {
                    string callExeName   = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(args[1]));
                    string updateFileDir = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(args[2]));
                    string appDir        = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(args[3]));
                    var    updateInfo    = ByteConvertHelper.Bytes2Object(Convert.FromBase64String(args[4])) as UpdateInfo;

                    App             app    = new App();
                    DownFileProcess downUi = new DownFileProcess(callExeName, updateFileDir, appDir, updateInfo)
                    {
                        WindowStartupLocation = WindowStartupLocation.CenterScreen
                    };
                    app.Run(downUi);
                }
                catch (Exception ex)
                {
                    LogerManager.Current.AsyncError("开启升级程序异常:" + ex.Message);
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Length == 0)
            {
                MessageBox.Show("无参数启动");
                return;
            }
            else
            {
                //MessageBox.Show("参数启动");
                //MessageBox.Show(e.Args[0]);
                //MessageBox.Show(e.Args[1]);
                //MessageBox.Show(e.Args[2]);
                //MessageBox.Show(e.Args[3]);
                //MessageBox.Show(e.Args[4]);
                //MessageBox.Show(e.Args[5]);

                try
                {
                    string callExeName   = e.Args[1];
                    string updateFileDir = e.Args[2];
                    string appDir        = e.Args[3];
                    string appName       = e.Args[4];
                    string appVersion    = e.Args[5];
                    string desc          = "更新描述";


                    var downUI = new DownFileProcess(callExeName, updateFileDir, appDir, appName, appVersion, desc)
                    {
                        WindowStartupLocation = WindowStartupLocation.CenterScreen
                    };
                    downUI.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }


            //var dlg = new MainWindow();
            //dlg.ShowDialog();
        }