Beispiel #1
0
        public static void Load()
        {
            var filePath = GetFilePath();

            if (File.Exists(filePath))
            {
                var doc = new XmlDocument();
                doc.Load(filePath);
                foreach (XmlNode node in doc.DocumentElement.ChildNodes)
                {
                    var obj = new AddonUpdateStats();
                    obj.Name    = node.Attributes["Name"].Value;
                    obj.Version = node.Attributes["Version"].Value;
                    var m     = Regex.Match(node.Attributes["Date"].Value, @"(.*)\.(.*)\.(.*) (.*):(.*):(.*)");
                    var year  = Convert.ToInt32(m.Groups[1].Captures[0].Value);
                    var month = Convert.ToInt32(m.Groups[2].Captures[0].Value);
                    var day   = Convert.ToInt32(m.Groups[3].Captures[0].Value);
                    var hour  = Convert.ToInt32(m.Groups[4].Captures[0].Value);
                    var min   = Convert.ToInt32(m.Groups[5].Captures[0].Value);
                    var sec   = Convert.ToInt32(m.Groups[6].Captures[0].Value);
                    obj.LastUpdated = new DateTime(year, month, day, hour, min, sec);
                    AddonNameList.Add(obj);
                }
            }
        }
Beispiel #2
0
        public static void Set(string addonName, string version)
        {
            var statusObj = AddonNameList.Find(delegate(AddonUpdateStats obj) { return(obj.Name.ToUpper().Equals(addonName.ToUpper())); });

            if (statusObj == null)
            {
                statusObj      = new AddonUpdateStats();
                statusObj.Name = addonName;
                AddonNameList.Add(statusObj);
            }
            statusObj.Version     = version;
            statusObj.LastUpdated = DateTime.Now;
        }