/// <summary> /// Initializes a new instance of the <see cref="T:ProviderRow" /> class. /// </summary> /// <param name="info">The original component information.</param> /// <param name="typeName">The type name.</param> /// <param name="disabled">A value indicating whether the provider is disabled.</param> /// <param name="selected">A value indicating whether the provider is selected.</param> public ProviderRow(ComponentInformation info, string typeName, string updateStatus, bool disabled, bool selected) { name = info.Name; this.typeName = typeName; version = info.Version; author = info.Author; authorUrl = info.Url; this.updateStatus = updateStatus; additionalClass = disabled ? " disabled" : ""; additionalClass += selected ? " selected" : ""; }
/// <summary> /// Gets the update status of a provider. /// </summary> /// <param name="info">The component information.</param> /// <returns>The update status.</returns> private string GetUpdateStatus(ComponentInformation info) { if(!Settings.DisableAutomaticVersionCheck) { if(string.IsNullOrEmpty(info.UpdateUrl)) return "n/a"; else { string newVersion = null; string newAssemblyUrl = null; UpdateStatus status = Tools.GetUpdateStatus(info.UpdateUrl, info.Version, out newVersion, out newAssemblyUrl); if(status == UpdateStatus.Error) { return "<span class=\"resulterror\">" + Properties.Messages.Error + "</span>"; } else if(status == UpdateStatus.NewVersionFound) { return "<span class=\"resulterror\">" + Properties.Messages.NewVersion + " <b>" + newVersion + "</b>" + (string.IsNullOrEmpty(newAssemblyUrl) ? "" : " (" + Properties.Messages.AutoUpdateAvailable + ")") + "</span>"; } else if(status == UpdateStatus.UpToDate) { return "<span class=\"resultok\">" + Properties.Messages.UpToDate + "</span>"; } else throw new NotSupportedException(); } } else return "n/a"; }