Class MetadataFileBase

Namespace
Datamine.MineTrustConnector.Core.ConfigSchemas
Assembly
Datamine.MineTrustConnector.Core.dll

Abstract implementation of IMetadataFile which provides common save and load method implementations into an in-memory byte array.

public abstract class MetadataFileBase : IMetadataFile
Inheritance
MetadataFileBase
Implements
Derived
Inherited Members

Properties

Contents

Gets or sets the byte array contents of this instance.

protected byte[] Contents { get; set; }

Property Value

byte[]

The contents.

Methods

EnsureSchemaValue(string?, string?)

Ensures that the specified config value is present at the indicated location within the schema

public abstract void EnsureSchemaValue(string? key, string? value)

Parameters

key string

The key.

value string

The value.

Flatten()

Flattens the backing config data into an enumeration of key value pairs, where the key of each value is its hierarchical location within the schema (in path format)

public abstract IEnumerable<KeyValuePair<string?, string?>> Flatten()

Returns

IEnumerable<KeyValuePair<string, string>>

The flattened config schema

GetSchemaValues(string?)

Gets the available config values at the indicated location within the schema

public abstract IEnumerable<string?> GetSchemaValues(string? key)

Parameters

key string

The key.

Returns

IEnumerable<string>

The available values

Load(Stream)

Loads configuration data from the specified content stream.

public virtual void Load(Stream stream)

Parameters

stream Stream

The stream.

Load(string)

Loads configuration data from the specified file path.

public virtual void Load(string path)

Parameters

path string

The path.

Rebuild(IEnumerable<KeyValuePair<string?, string?>>)

Rebuilds this instance in its entirety from the specified set of config key value pairs, where the key of each value is its hierarchical location within the schema (in path format). All existing config data stored within this instance is removed.

public abstract void Rebuild(IEnumerable<KeyValuePair<string?, string?>> keyValuePairs)

Parameters

keyValuePairs IEnumerable<KeyValuePair<string, string>>

The key value pairs.

Save(Stream)

Saves the configuration data to the specified content stream.

public virtual void Save(Stream stream)

Parameters

stream Stream

The stream.

Save(string)

Saves a configuration file to the specified file path.

public virtual void Save(string path)

Parameters

path string

The path.

See Also