/// <summary> /// Registers installed version of DotVVM Extension, or removes it in case of uninstallation. /// </summary> /// <param name="visualVersion">version of microsoft visual IDE</param> /// <param name="installedVersion">version of newly installed version, or null if uninstalled</param> public static void RegisterInstalledVersion(VisualVersionInfo visualVersion, Version installedVersion) { if (visualVersion == null) { throw new NullReferenceException($"{nameof(VersionHelper)}.{nameof(RegisterInstalledVersion)} - parameter {nameof(visualVersion)} cannot be null."); } var extensionKey = GetOrCreateExtensionRegistryKey(); var binary = SerializationHelper.ObjectToByteArray(installedVersion); extensionKey.SetValue(visualVersion.KeyValueName(), binary, RegistryValueKind.Binary); }
/// <summary> /// Gets current installed version of DotVVM Extension, if installed. /// </summary> /// <param name="visualVersion">version of microsoft visual IDE</param> /// <returns>extension version, can be null if it's not installed</returns> public static Version GetInstalledVersion(VisualVersionInfo visualVersion) { var extensionKey = GetOrCreateExtensionRegistryKey(); return(SerializationHelper.ByteArrayToObject <Version>(extensionKey.GetValue(visualVersion.KeyValueName(), null) as byte[])); }