public override string ToString() { if (MinimumVersion.ToString() == "0.0.0.0") { if (MaximumVersion.Major == int.MaxValue) { return(Name); } else { return(Name + ", version <" + MaximumVersion.ToString()); } } else { if (MaximumVersion.Major == int.MaxValue) { return(Name + ", version >" + MinimumVersion.ToString()); } else if (MinimumVersion == MaximumVersion) { return(Name + ", version " + MinimumVersion.ToString()); } else { return(Name + ", version " + MinimumVersion.ToString() + "-" + MaximumVersion.ToString()); } } }
internal void SaveAsElement(XmlWriter writer) { writer.WriteStartElement("SupportedFramework"); if (MaximumVersion != NoMaximumVersion) { writer.WriteAttributeString("MaximumVersion", MaximumVersion.ToString()); } if (MinimumVersion != NoMinimumVersion) { writer.WriteAttributeString("MinimumVersion", MinimumVersion.ToString()); } WriteNonEmptyAttribute("Profile", Profile); WriteNonEmptyAttribute("Identifier", Identifier); WriteNonEmptyAttribute("DisplayName", DisplayName); WriteNonEmptyAttribute("MinimumVersionDisplayName", MinimumVersionDisplayName); WriteNonEmptyAttribute("MonoSpecificVersion", MonoSpecificVersion); WriteNonEmptyAttribute("MonoSpecificVersionDisplayName", MonoSpecificVersionDisplayName); writer.WriteEndElement(); void WriteNonEmptyAttribute(string name, string val) { if (!string.IsNullOrEmpty(val)) { writer.WriteAttributeString(name, val); } } }
public override bool ProcessRecordAsync() { //Error out for the case where multiple provider names with any version specified if (((!Name.IsNullOrEmpty() && Name.Length > 1) || Name[0].ContainsWildcards()) && ((RequiredVersion != null) || (MinimumVersion != null) || (MaximumVersion != null))) { Error(Constants.Errors.MultipleNamesWithVersionNotAllowed); return(false); } foreach (var path in Name) { var isRooted = false; var resolvedPath = path; if (!string.IsNullOrWhiteSpace(path)) { if (IsRooted(path)) { if ((RequiredVersion != null) || (MaximumVersion != null) || (MinimumVersion != null)) { Error(Constants.Errors.FullProviderFilePathVersionNotAllowed); } try { ProviderInfo provider = null; Collection <string> resolvedPaths = GetResolvedProviderPathFromPSPath(path, out provider); // Ensure the path is a single path from the file system provider if ((resolvedPaths.Count > 1) || (!String.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) { Error(Constants.Errors.FilePathMustBeFileSystemPath, path); return(false); } resolvedPath = resolvedPaths[0]; isRooted = true; } catch (Exception ex) { Error(Constants.Errors.FileNotFound, ex.Message); return(true); } } foreach (var p in PackageManagementService.ImportPackageProvider(this, resolvedPath, RequiredVersion.ToVersion(), MinimumVersion.ToVersion(), MaximumVersion.ToVersion(), isRooted, Force.IsPresent)) { WriteObject(p); } } } //foreach name return(true); }
protected void ExportVersionRange(XmlTextWriter xmlWriter, HasVersionRange defaults) { if (MinimumVersion > defaults.MinimumVersion) { xmlWriter.WriteAttributeString("minimumVersion", MinimumVersion.ToString(2)); } if (MaximumVersion < defaults.MaximumVersion) { xmlWriter.WriteAttributeString("maximumVersion", MaximumVersion.ToString(2)); } }
public override bool Equals(object obj) { var other = obj as SupportedFramework; if (other == null) { return(false); } if (!string.Equals(DisplayName, other.DisplayName)) { return(false); } if (!string.Equals(Identifier, other.Identifier)) { return(false); } if (!string.Equals(Profile, other.Profile)) { return(false); } if (!string.Equals(MonoSpecificVersion, other.MonoSpecificVersion)) { return(false); } if (!string.Equals(MonoSpecificVersionDisplayName, other.MonoSpecificVersionDisplayName)) { return(false); } if (!string.Equals(MinimumVersionDisplayName, other.MinimumVersionDisplayName)) { return(false); } if (!MinimumVersion.Equals(other.MinimumVersion)) { return(false); } if (!MaximumVersion.Equals(other.MaximumVersion)) { return(false); } return(true); }
public override int GetHashCode() { int hashCode = 0; unchecked { if (Identifier != null) { hashCode += 1000000007 * Identifier.GetHashCode(); } if (Profile != null) { hashCode += 1000000009 * Profile.GetHashCode(); } if (MinimumVersion != null) { hashCode += 1000000021 * MinimumVersion.GetHashCode(); } } return(hashCode); }
public override async Task <Diagonosis> Examine(PatientHistory history) { var info = await GetInfo(); if (NuGetVersion.TryParse(info.Version?.ToString(), out var semVer)) { if (semVer.IsCompatible(MinimumVersion, ExactVersion)) { ReportStatus($"XCode.app ({info.Version} {info.Build})", Status.Ok); return(Diagonosis.Ok(this)); } } ReportStatus($"XCode.app ({info.Version}) not installed.", Status.Error); return(new Diagonosis(Status.Error, this, new Prescription($"Download XCode {MinimumVersion.ThisOrExact(ExactVersion)}"))); }
protected void ExportVersionRange(XmlTextWriter xmlWriter) { xmlWriter.WriteAttributeString("minimumVersion", MinimumVersion.ToString(2)); xmlWriter.WriteAttributeString("maximumVersion", MaximumVersion.ToString(2)); }
/// <summary> /// Gets the required minimum version for third party plugins /// </summary> /// <param name="plugin">The enum of the plugin to get the minimum version for</param> /// <returns>String with minimum version required</returns> public static string GetRequiredMinimumVersion(MinimumVersion plugin) { switch (plugin) { case MinimumVersion.BrowseTheWeb: return "0.3.0"; case MinimumVersion.OnlineVideos: return "1.2"; case MinimumVersion.SubCentral: return "1.1"; case MinimumVersion.Trakt: return "1.5.1.1"; default: return "unknown"; } }
public override string ToString() => $"{(MinimumInclusive ? "[" : "(")}{MinimumVersion?.ToString(false) ?? ""},{MaximumVersion?.ToString(false) ?? ""}{(MaximumInclusive ? "]" : ")")}";
public override int GetHashCode() => (((MinimumVersion?.GetHashCode() ?? -1) << 8) ^ (MaximumVersion?.GetHashCode() ?? -1)) ^ (MinimumInclusive ? 0b10 : 0) ^ (MaximumInclusive ? 0b1 : 0);
public override int GetHashCode() { return(Name.GetHashCode() ^ MinimumVersion.GetHashCode() ^ MaximumVersion.GetHashCode()); }