コード例 #1
0
        /// <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());
        }
コード例 #2
0
ファイル: UpdateForm.cs プロジェクト: phox/AmbleSystem
        public UpdateForm(
			string tempPath,
			string localRelease,
			ReleaseList remoteRelease
			)
        {
            InitializeComponent();
            this.tempPath = tempPath;
            this.localReleaseVersion = localRelease;
            this.remoteRelease = remoteRelease;
            this.diff = remoteRelease.Files.ToArray();
        }
コード例 #3
0
ファイル: UpdateForm.cs プロジェクト: hnjm/AmbleSystem
 public UpdateForm(
     string tempPath,
     string localRelease,
     ReleaseList remoteRelease
     )
 {
     InitializeComponent();
     this.tempPath            = tempPath;
     this.localReleaseVersion = localRelease;
     this.remoteRelease       = remoteRelease;
     this.diff = remoteRelease.Files.ToArray();
 }
コード例 #4
0
 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);
 }
コード例 #5
0
ファイル: UpdateInfo.cs プロジェクト: phox/AmbleSystem
 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);
 }
コード例 #6
0
        //版本号北京
        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));
        }
コード例 #7
0
ファイル: ReleaseList.cs プロジェクト: phox/AmbleSystem
 /// <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();
 }
コード例 #8
0
ファイル: ReleaseList.cs プロジェクト: phox/AmbleSystem
 //版本号北京
 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);
 }