This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpToolLib/UpdateCheck.cs

32 lines
1.0 KiB
C#

using System;
using System.Xml.Linq;
using UpToolLib.Tool;
namespace UpToolLib
{
public static class UpdateCheck
{
private static XElement _meta;
private static XElement Meta
{
get
{
if (_meta is null) Reload();
return _meta;
}
set => _meta = value;
}
public static Version OnlineVersion => Version.Parse(Meta.Element("Version").Value);
public static Uri Installer => new Uri(Meta.Element("Installer").Value);
public static string InstallerHash => Meta.Element("InstallerHash").Value.ToUpper();
public static Uri App => new Uri(Meta.Element("File").Value);
public static string AppHash => Meta.Element("Hash").Value.ToUpper();
public static void Reload() =>
Reload(XDocument.Load(PathTool.InfoXml).Element("meta").Element("UpdateSource").Value);
public static void Reload(string source) => Meta = XDocument.Load(source).Element("meta");
}
}