/// <summary> /// 查询是否有更新 /// </summary> /// <param name="msg"></param> /// <returns>0 不需要更新 1 需要更新 -1 异常</returns> public static int CheckUpdate(out string msg) { MDownloadfile[] updateFileList = null; string json = TransClass.CheckUpdate(PubGlobal.Envionment.APPVersion, ref updateFileList); MMessage <string> mmsg = Converter.Deserialize <MMessage <string> >(json); if (mmsg.Flag && updateFileList != null && updateFileList.Length > 0) { string path = PubGlobal.Envionment.UpdateFolderPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } foreach (MDownloadfile file in updateFileList) { try { ZipClass.UnzipBytesToFile(file.FileContent, path + @"\" + file.FileName); } catch (Exception ex) { msg = ex.Message; return(-1); } } msg = string.Empty; return(1); } else { msg = "不需要更新"; return(0); } }