/// <summary> /// 版本号比较,并输出总文件大小 /// </summary> /// <param name="otherList"></param> /// <param name="fileSize"></param> /// <returns></returns> public ReleaseFile[] GetDifferences(ReleaseList otherList, out int fileSize) { fileSize = 0; if (otherList == null || Compare(otherList) == 0) { return(null); } var ht = new Hashtable(); foreach (ReleaseFile file in files) { ht.Add(file.FileName, file.ReleaseDate); } var diffrences = new List <ReleaseFile>(); foreach (ReleaseFile file in otherList.files) { //如果本地的XML文件中不包括服务器上要升级的文件或者服务器的文件的发布日期大于本地XML文件的发布日期,开始升级 if (!ht.ContainsKey(file.FileName) || DateTime.Parse(file.ReleaseDate) > DateTime.Parse(ht[file.FileName].ToString())) { diffrences.Add(file); fileSize += file.FileSize; } } return(diffrences.ToArray()); }
public UpdateForm( string tempPath, string localRelease, ReleaseList remoteRelease ) { InitializeComponent(); this.tempPath = tempPath; this.localReleaseVersion = localRelease; this.remoteRelease = remoteRelease; this.diff = remoteRelease.Files.ToArray(); }
public static void Start() { currentVersion = OperatorFile.GetIniFileString("Version", "CurrentVersion", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini"); try { DownloadTool.DownloadFile(tempPath, "http://" + OperatorFile.GetIniFileString("DataBase", "Server", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini") + "/AmbleUpdate/", ReleaseConfigFileName); } catch (Exception ex) { MessageBox.Show("Can not connect to the server,Please contact the Admin"); } remoteReleaseList = new ReleaseList(tempPath + ReleaseConfigFileName); }
public static void Start() { currentVersion = OperatorFile.GetIniFileString("Version", "CurrentVersion", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini"); try { DownloadTool.DownloadFile(tempPath, "http://" + OperatorFile.GetIniFileString("DataBase", "Server", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini") + "/AmbleUpdate/", ReleaseConfigFileName); } catch(Exception ex) { MessageBox.Show("Can not connect to the server,Please contact the Admin"); } remoteReleaseList = new ReleaseList(tempPath + ReleaseConfigFileName); }
//版本号北京 public int Compare(ReleaseList otherList) { if (otherList == null) { throw new ArgumentNullException("otherList"); } int diff = Compare(otherList.ReleaseVersion); if (diff != 0) { return(diff); } return((releaseDate == otherList.ReleaseDate) ? 0 : (DateTime.Parse(releaseDate) > DateTime.Parse(otherList.ReleaseDate) ? 1 : -1)); }
/// <summary> /// 版本号比较,并输出总文件大小 /// </summary> /// <param name="otherList"></param> /// <param name="fileSize"></param> /// <returns></returns> public ReleaseFile[] GetDifferences(ReleaseList otherList, out int fileSize) { fileSize = 0; if (otherList == null || Compare(otherList) == 0) return null; var ht = new Hashtable(); foreach (ReleaseFile file in files) { ht.Add(file.FileName, file.ReleaseDate); } var diffrences = new List<ReleaseFile>(); foreach (ReleaseFile file in otherList.files) { //如果本地的XML文件中不包括服务器上要升级的文件或者服务器的文件的发布日期大于本地XML文件的发布日期,开始升级 if (!ht.ContainsKey(file.FileName) || DateTime.Parse(file.ReleaseDate) > DateTime.Parse(ht[file.FileName].ToString())) { diffrences.Add(file); fileSize += file.FileSize; } } return diffrences.ToArray(); }
//版本号北京 public int Compare(ReleaseList otherList) { if (otherList == null) throw new ArgumentNullException("otherList"); int diff = Compare(otherList.ReleaseVersion); if (diff != 0) return diff; return (releaseDate == otherList.ReleaseDate) ? 0 : (DateTime.Parse(releaseDate) > DateTime.Parse(otherList.ReleaseDate) ? 1 : -1); }