Пример #1
0
        /// <summary>
        ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败
        /// </summary>
        private void builtUpdateServer()
        {
            string path = Directory.GetCurrentDirectory() + "\\Update.exe";

            //如果Update程序已经启动,先关闭它.
            ServerUpdater.CloseApplication("update");
            if (!File.Exists(path))
            {
                BaseCode code = new BaseCode();
                code.Head = CodeHead.UPDATE_FAIL;
                mainServer.SendCode(code);
            }
            else
            {
                Thread.Sleep(300);
                //启动Update程序
                Thread updateThread = new Thread(new ThreadStart(runUpdateApp));
                updateThread.Start();
                //告诉控制端Update程序已经启动.
                Thread.Sleep(100);
                PortCode code = new PortCode();
                code.Head = CodeHead.UPDATE_READY;
                code.Port = Constant.Port_Update;
                mainServer.SendCode(code);
            }
        }
Пример #2
0
        /// <summary>
        ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败
        /// </summary>
        private void builtUpdateServer()
        {
            string path = Directory.GetCurrentDirectory() + "\\Update.exe";

            // string path = @"D:\My Documents\Visual Studio 2005\Projects\程序设计大赛\ICANSEEYOU\Update\bin\Debug\Update.exe";
            //如果Update程序已经启动,先关闭它.
            ServerUpdater.CloseApplication("update");
            if (!File.Exists(path))
            {
                BaseCode code = new BaseCode();
                code.Head = CodeHead.UPDATE_FAIL;
                mainChick.SendCode(code);
            }
            else
            {
                Thread.Sleep(300);
                //启动Update程序
                Thread updateThread = new Thread(new ThreadStart(runUpdateApp));
                updateThread.Start();
                //告诉控制端Update程序已经启动.
                Thread.Sleep(100);
                PortCode code = new PortCode();
                code.Head = CodeHead.UPDATE_READY;
                code.Port = Constant.Port_Update;
                mainChick.SendCode(code);
            }
        }