Beispiel #1
0
        internal static UpdateInfo[] LoadExtendedInfo(string updateDirectory)
        {
            List<UpdateInfo> list = new List<UpdateInfo>();

            string filePath = Path.Combine(updateDirectory, ConstUpdateFileName);
            XmlDocument doc = new XmlDocument();
            doc.Load(filePath);

            foreach (XmlNode update in doc.SelectNodes("/Updates/Update"))
            {
                UpdateInfo item = new UpdateInfo();
                item.Load(update);
                list.Add(item);
            }

            list.Sort(CompareByVersion);

            return list.ToArray();
        }
Beispiel #2
0
        private static int CompareByVersion(UpdateInfo x, UpdateInfo y)
        {
            int result;

            if (x == null)
            {
                if (y == null)
                    result = 0;
                else
                    result = -1;
            }
            else
            {
                if (y == null)
                    result = 1;
                else
                {
                    result = x.Version.CompareTo(y.Version);
                }
            }

            return result * -1;
        }