/// <summary> /// 用于检查版本是否需要更新 /// </summary> /// <param name="path"></param> /// <param name="version"></param> /// <returns></returns> #region private bool checkVersion(out String path, out String name) private bool checkVersion(out String path, out String name) { String versionFilePath = CommonUtils.getServiceRunningPath(); String file = String.Format(@"{0}config\version.xml", versionFilePath); String oldVersion; bool flag = CommonUtils.getVersionFromConfigFile(file, out oldVersion, out String appName); if (!flag) { Logger.info(typeof(UpdateController), "get old app version error."); path = String.Empty; name = String.Empty; return(false); } ResultEntity result = update.checkVersionFromServer(oldVersion); if (result == null) { Logger.info(typeof(UpdateController), "check app version from server failed."); path = String.Empty; name = String.Empty; return(false); } String requestUrl = result.path; if (String.IsNullOrEmpty(requestUrl)) { Logger.info(typeof(UpdateController), "check app version from server failed."); path = String.Empty; name = String.Empty; return(false); } path = requestUrl.Substring(0, requestUrl.LastIndexOf("/")); name = requestUrl.Substring(requestUrl.LastIndexOf("/") + 1); return(true); }