Show / Hide Table of Contents

Class ModelUtils

Provides utility methods for interface and feed URIs.

Inheritance
Object
ModelUtils
Namespace: ZeroInstall.Model
Assembly: ZeroInstall.Model.dll
Syntax
public static class ModelUtils : Object

Properties

Version

The version of Zero Install feed model (used for compatibility checks).

Declaration
public static ImplementationVersion Version { get; }
Property Value
Type Description
ImplementationVersion

Methods

ContainsTemplateVariables(String)

Determines whether a string contains a template variable (a substring enclosed in curly brackets, e.g {var}).

Declaration
public static bool ContainsTemplateVariables(string value)
Parameters
Type Name Description
String value
Returns
Type Description
Boolean

GetAbsoluteHref(Uri, String)

Turns a relative HREF into an absolute one, using the file containing the reference as the base.

Declaration
public static Uri GetAbsoluteHref(Uri href, string source)
Parameters
Type Name Description
Uri href

The potentially relative HREF; will remain untouched if absolute.

String source

The file containing the reference; can be null.

Returns
Type Description
Uri

An absolute HREF.

Exceptions
Type Condition
UriFormatException

href is a relative URI that cannot be resolved.

GetAbsoluteHref(Uri, FeedUri)

Turns a relative HREF into an absolute one, using the file containing the reference as the base.

Declaration
public static Uri GetAbsoluteHref(Uri href, FeedUri source = null)
Parameters
Type Name Description
Uri href

The potentially relative HREF; will remain untouched if absolute.

FeedUri source

The file containing the reference; can be null.

Returns
Type Description
Uri

An absolute HREF.

Exceptions
Type Condition
UriFormatException

href is a relative URI that cannot be resolved.

GetAbsolutePath(String, String)

Turns a relative path into an absolute one, using the file containing the reference as the base.

Declaration
public static string GetAbsolutePath(string path, string source)
Parameters
Type Name Description
String path

The potentially relative path; will remain untouched if absolute.

String source

The file containing the reference; can be null.

Returns
Type Description
String

An absolute path.

Exceptions
Type Condition
UriFormatException

path is a relative URI that cannot be resolved.

GetAbsolutePath(String, FeedUri)

Turns a relative path into an absolute one, using the file containing the reference as the base.

Declaration
public static string GetAbsolutePath(string path, FeedUri source = null)
Parameters
Type Name Description
String path

The potentially relative path; will remain untouched if absolute.

FeedUri source

The file containing the reference; can be null.

Returns
Type Description
String

An absolute path.

Exceptions
Type Condition
UriFormatException

path is a relative URI that cannot be resolved.

In This Article
Back to top Copyright Bastian Eicher et al