Пример #1
0
        public static ReleaseList GetNewVersion(string appDir)
        {
            string      localXmlPath = Path.Combine(appDir, Constants.ReleaseConfigFileName);
            ReleaseList localRelease = FileUtil.ReadReleaseList(localXmlPath);

            return(FileUtil.ReadReleaseList(localRelease.ReleaseUrl));
        }
Пример #2
0
        public ReleaseFile[] GetDifferences(ReleaseList otherList, out long fileSize)
        {
            if (Packaged)
            {
                fileSize = otherList.Files[0].FileSize;
                return(new[] { otherList.Files[0] });
            }
            fileSize = 0;
            if (otherList == null || Compare(otherList) == 0)
            {
                return(null);
            }
            var ht = new Hashtable();

            foreach (ReleaseFile file in _files)
            {
                ht.Add(file.FileName, file.Version);
            }
            var diffrences = new List <ReleaseFile>();

            foreach (ReleaseFile file in otherList._files)
            {
                if ((!ht.ContainsKey(file.FileName)) || ht[file.FileName] == null ||
                    CompareVersion(file.Version, ht[file.FileName].ToString()) != 0)
                {
                    diffrences.Add(file);
                    fileSize += file.FileSize;
                }
            }
            return(diffrences.ToArray());
        }
Пример #3
0
        public static void SaveReleaseList(this ReleaseList list, string fileName)
        {
            string xml = XmlSerializerHelper.GetXmlStringFromObject(list);
            //WriteText(fileName, xml, Encoding.UTF8);
            var doc = new XmlDocument();

            doc.LoadXml(xml);
            var dir = Path.GetDirectoryName(fileName);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            doc.Save(fileName);
        }
Пример #4
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));
        }