Class FeedPreferences
- Namespace
- ZeroInstall.Model.Preferences
- Assembly
- ZeroInstall.Model.dll
Stores user-specific preferences for a Feed.
public sealed class FeedPreferences : XmlUnknown, ICloneable<FeedPreferences>, IEquatable<FeedPreferences>
- Inheritance
-
objectFeedPreferences
- Implements
- Inherited Members
Constructors
FeedPreferences()
public FeedPreferences()
Properties
Implementations
A list of implementation-specific user-overrides.
public List<ImplementationPreferences> Implementations { get; }
Property Value
this[string]
Retrieves an existing entry from Implementations by ID or creates a new one if no appropriate one exists.
public ImplementationPreferences this[string id] { get; }
Parameters
Property Value
- ImplementationPreferences
The found or newly created ImplementationPreferences.
LastChecked
The point in time this feed was last checked for updates.
public UnixTime LastChecked { get; set; }
Property Value
Methods
Clone()
Creates a deep copy of this FeedPreferences instance.
public FeedPreferences Clone()
Returns
- FeedPreferences
The new copy of the FeedPreferences.
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
LoadFor(FeedUri)
Loads FeedPreferences for a specific feed.
[RequiresDynamicCode("XML serialization requires runtime code generation.")]
public static FeedPreferences LoadFor(FeedUri feedUri)
Parameters
feedUriFeedUriThe feed to load the preferences for.
Returns
- FeedPreferences
The loaded FeedPreferences.
Exceptions
- IOException
A problem occurred while reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- InvalidDataException
A problem occurred while deserializing an XML file.
LoadForSafe(FeedUri)
Tries to load FeedPreferences for a specific feed. Automatically falls back to defaults on errors.
[RequiresDynamicCode("XML serialization requires runtime code generation.")]
public static FeedPreferences LoadForSafe(FeedUri feedUri)
Parameters
feedUriFeedUriThe feed to load the preferences for.
Returns
- FeedPreferences
The loaded FeedPreferences or default value if there was a problem.
Normalize()
Removes superfluous entries from Implementations.
public void Normalize()
SaveFor(FeedUri)
Saves these FeedPreferences for a specific feed.
[RequiresDynamicCode("XML serialization requires runtime code generation.")]
public void SaveFor(FeedUri feedUri)
Parameters
feedUriFeedUriThe feed to save the preferences for.
Exceptions
- IOException
A problem occurred while writing the file.
- UnauthorizedAccessException
Write access to the file is not permitted.
ToString()
Returns the preferences in the form "FeedPreferences: LastChecked". Not safe for parsing!
public override string ToString()
Returns
UpdateFor(FeedUri, Action<FeedPreferences>)
Loads FeedPreferences for a specific feed, applies modifications to them and saves them again.
[RequiresDynamicCode("XML serialization requires runtime code generation.")]
public static void UpdateFor(FeedUri feedUri, Action<FeedPreferences> update)
Parameters
feedUriFeedUriThe feed to modify the preferences for.
updateAction<FeedPreferences>The modifications to apply to the preferences.
Exceptions
- IOException
A problem occurred while reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- InvalidDataException
A problem occurred while deserializing an XML file.
Operators
operator ==(FeedPreferences?, FeedPreferences?)
Indicates whether the object on the left is equal to the object on the right.
public static bool operator ==(FeedPreferences? left, FeedPreferences? right)
Parameters
leftFeedPreferencesThe left object
rightFeedPreferencesThe right object
Returns
- bool
true if the objects are equal; otherwise, false.
operator !=(FeedPreferences?, FeedPreferences?)
Indicates whether the object on the left is not equal to the object on the right.
public static bool operator !=(FeedPreferences? left, FeedPreferences? right)
Parameters
leftFeedPreferencesThe left object
rightFeedPreferencesThe right object
Returns
- bool
true if the objects are not equal; otherwise, false.