Пример #1
0
        public void update(string[] args)
        {
            //0.get params
            if (args.Length != MainServicePlugin.COUNT_ARGS)
            {
                LogUtils.error("walle.udate.Program", "args error...");
                return;
            }
            var oDownloadVo = new DownloadVo();
            oDownloadVo.FilePathProcess = args[0];
            oDownloadVo.Url = args[1];

            //1.clear
            this.m_oClearService.clear();

            //2.读取strUrlUpdateXML
            UpdateInfo oUpdateInfo;
            try
            {
                oUpdateInfo = this.m_oDownloadService.download(oDownloadVo);
            }
            catch (Exception)
            {
                LogUtils.error("walle.udate.Program", "DownloadService error...");
                return;
            }

            //3.读取strProcessName的strVersion
            var strVersion = "";
            try
            {
                strVersion = this.m_oFileVerService.getVer(oDownloadVo.FilePathProcess);
            }
            catch (Exception)
            {
                LogUtils.error("walle.udate.Program", "FileVerService error...");
                //return;
            }

            //4.如果oUpdateInfo.version == strVersion
            if (oUpdateInfo.Version != strVersion)
            {
                //4.0.确认是否更新
                var oDialogResult = new ConfirmForm().ShowDialog();
                if (oDialogResult == DialogResult.OK)
                {
                    //4.1.Kill strProcessName
                    this.m_oProcessService.kill(oDownloadVo.FilePathProcess);

                    //4.2.根据oUpdateInfo,下载zip到strFilePathZip
                    var strFilePathZip = this.m_oDownloadZipService.download(oUpdateInfo);

                    //4.3.根据strFilePathZip,解压到strDirPathZip
                    this.m_oUnzipService.unzip(strFilePathZip, oDownloadVo.FilePathProcess);

                    //4.4.start strProcessName
                    this.m_oProcessService.start(oDownloadVo.FilePathProcess);
                }
            }
        }
Пример #2
0
        public UpdateInfo download(DownloadVo oDownloadVo)
        {
            LogUtils.debug("DownloadService.download", "start...");

            //1.创建文件夹
            var oDirInfo = new FileInfo(DownloadServicePlugin.FILE_PATH_TMP_XML).Directory;
            if (!oDirInfo.Exists)
            {
                oDirInfo.Create();
            }

            //2.download
            WebUtils.downloadFile(oDownloadVo.Url, DownloadServicePlugin.FILE_PATH_TMP_XML);

            //3.parse
            var oUpdateInfo = DownloadServicePlugin.parse();

            LogUtils.debug("DownloadService.download", "end...");

            return oUpdateInfo;
        }
Пример #3
0
        public UpdateInfo download(DownloadVo oDownloadVo)
        {
            LogUtils.debug("DownloadService.download", "start...");

            //1.创建文件夹
            var oDirInfo = new FileInfo(DownloadServicePlugin.FILE_PATH_TMP_XML).Directory;

            if (!oDirInfo.Exists)
            {
                oDirInfo.Create();
            }

            //2.download
            WebUtils.downloadFile(oDownloadVo.Url, DownloadServicePlugin.FILE_PATH_TMP_XML);

            //3.parse
            var oUpdateInfo = DownloadServicePlugin.parse();

            LogUtils.debug("DownloadService.download", "end...");

            return(oUpdateInfo);
        }
Пример #4
0
        public void update(string[] args)
        {
            //0.get params
            if (args.Length != MainServicePlugin.COUNT_ARGS)
            {
                LogUtils.error("walle.udate.Program", "args error...");
                return;
            }
            var oDownloadVo = new DownloadVo();

            oDownloadVo.FilePathProcess = args[0];
            oDownloadVo.Url             = args[1];

            //1.clear
            this.m_oClearService.clear();

            //2.读取strUrlUpdateXML
            UpdateInfo oUpdateInfo;

            try
            {
                oUpdateInfo = this.m_oDownloadService.download(oDownloadVo);
            }
            catch (Exception)
            {
                LogUtils.error("walle.udate.Program", "DownloadService error...");
                return;
            }

            //3.读取strProcessName的strVersion
            var strVersion = "";

            try
            {
                strVersion = this.m_oFileVerService.getVer(oDownloadVo.FilePathProcess);
            }
            catch (Exception)
            {
                LogUtils.error("walle.udate.Program", "FileVerService error...");
                //return;
            }

            //4.如果oUpdateInfo.version == strVersion
            if (oUpdateInfo.Version != strVersion)
            {
                //4.0.确认是否更新
                var oDialogResult = new ConfirmForm().ShowDialog();
                if (oDialogResult == DialogResult.OK)
                {
                    //4.1.Kill strProcessName
                    this.m_oProcessService.kill(oDownloadVo.FilePathProcess);

                    //4.2.根据oUpdateInfo,下载zip到strFilePathZip
                    var strFilePathZip = this.m_oDownloadZipService.download(oUpdateInfo);

                    //4.3.根据strFilePathZip,解压到strDirPathZip
                    this.m_oUnzipService.unzip(strFilePathZip, oDownloadVo.FilePathProcess);

                    //4.4.start strProcessName
                    this.m_oProcessService.start(oDownloadVo.FilePathProcess);
                }
            }
        }