private static string GetAssemblyVersion(string assemblyQualifiedName) { var match = AssemblyVersionRegex.Match(assemblyQualifiedName ?? string.Empty); return(match.Success ? match.Groups["Version"].Value : DefaultAssemblyVersion); }
/// <summary> /// Initializes a new instance of the <see cref="ActionUpdater"/> class /// </summary> /// <param name="fullRawAssemblyInfoLink">The link to the assemblyinfo.cs file that can be found in your github. This has to be a raw link</param> /// <param name="localVersion">The local version of the assembly to compare</param> /// <param name="assemblyName">The name of the <see cref="Assembly"/></param> public ActionUpdater(string fullRawAssemblyInfoLink, Version localVersion, string assemblyName) : base(fullRawAssemblyInfoLink) { // Don't try to download or invoke anything if the developer couldn't even provide a proper link... if (!IsLinkValid) { return; } new Action( async delegate { using (var client = new WebClient()) { var match = AssemblyVersionRegex.Match(await client.DownloadStringTaskAsync(Link)); RaiseEvent( new CheckPerformedEventArgs( match.Success ? new Version(match.Groups[1].Value) : null, localVersion, assemblyName)); } }).Invoke(); }