Ejemplo n.º 1
0
        private bool CheckUpdateReport()
        {
            bool isSuccess;

            if (!new CommandLineParser(Environment.GetCommandLineArgs()).IsExist(LauncherConstants.UPDATE_REPORT_COMMAND))
            {
                return(true);
            }
            UpdateReport report        = new UpdateReport();
            string       str           = string.Empty;
            string       updateVersion = string.Empty;

            try
            {
                using (FileStream stream = new FileStream(ApplicationUtils.GetAppRootPath() + "/" + LauncherConstants.REPORT_FILE_NAME, FileMode.Open))
                {
                    report.Read(stream);
                    isSuccess     = report.IsSuccess;
                    str           = report.Error + report.StackTrace;
                    updateVersion = report.UpdateVersion;
                }
            }
            catch (Exception exception1)
            {
                isSuccess = false;
                str       = exception1.ToString();
            }
            if (!isSuccess)
            {
                LoggerProvider.GetLogger(this).ErrorFormat("ClientUpdateError: {0}", str);
                EngineService.Engine.NewEvent <ClientUpdateErrorEvent>().Schedule();
                return(false);
            }
            if (!this.IsCurrentVersionNeedsUpdate())
            {
                return(true);
            }
            LoggerProvider.GetLogger(this).ErrorFormat("ClientUpdateError: Updated version is not correct, update version = {0}, currentVersion = {1}", report.UpdateVersion, this.currentVersion);
            EngineService.Engine.NewEvent <ClientUpdateErrorEvent>().Schedule();
            return(false);
        }