Feature

Namespace: Babel.Licensing Assembly: Babel.Licensing.dll

Represents a license feature. A feature is used typically to enable additional.

public class Feature : IObservableObject

Inheritance

objectFeature

Implements

IObservableObject

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Feature()

Specialized default constructor for use only by derived class.

protected Feature()

Feature(string)

Initializes a new instance of the class with a given feature name.

public Feature(string name)

Parameters

NameDescription

name string

The feature name.

Examples

ECDsaSignature ecdsa = new ECDsaSignature(ECDsaKeySize.KeySize112bit);
ecdsa.CreateKeyPair();

string licenseKey = new StringLicense()
                        .ForAnyAssembly()
                        .WithFeature("Statistics", "Statistical analysis", File.ReadAllBytes("Statistics.dll"))
                        .WithFeature("Reports", "PDF Reports", File.ReadAllBytes("Reports.dll"))
                        .SignWith(ecdsa)
                        .ToReadableString();

StringLicenseManager manager = new StringLicenseManager();
StringLicense license = manager.Validate(licenseKey);

Exceptions

NameDescription

Thrown when the parameter name is null.

Feature(string, byte[])

Initializes a new instance of the class with a given feature name and data.

public Feature(string name, byte[] data)

Parameters

NameDescription

name string

The feature name.

data byte[]

An array of bytes that contains the data related to this feature.

Examples

ECDsaSignature ecdsa = new ECDsaSignature(ECDsaKeySize.KeySize112bit);
ecdsa.CreateKeyPair();

string licenseKey = new StringLicense()
                        .ForAnyAssembly()
                        .WithFeature("Statistics", "Statistical analysis", File.ReadAllBytes("Statistics.dll"))
                        .WithFeature("Reports", "PDF Reports", File.ReadAllBytes("Reports.dll"))
                        .SignWith(ecdsa)
                        .ToReadableString();

StringLicenseManager manager = new StringLicenseManager();
StringLicense license = manager.Validate(licenseKey);

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Feature(Feature)

Copy constructor.

public Feature(Feature other)

Parameters

NameDescription

other Feature

The Feature object to copy.

Exceptions

NameDescription

Thrown when the parameter other to copy is null.

Properties

Data

Gets or sets the data associated with this feature.

public virtual byte[] Data { get; set; }

Property Value

byte[]

Description

Gets or sets the feature description.

public virtual string Description { get; set; }

Property Value

string

ExpireDate

Gets or sets the feature expire date.

public virtual DateTime? ExpireDate { get; set; }

Property Value

DateTime?

Id

Gets or sets the feature identifier.

public virtual string Id { get; set; }

Property Value

string

Key

Gets or sets the feature key. This is an additional field used to store encrypt key information.

public virtual byte[] Key { get; set; }

Property Value

byte[]

Listeners

Gets the listeners.

public virtual IEnumerable<IObjectListener> Listeners { get; }

Property Value

IEnumerable<IObjectListener>

Name

Gets or sets the feature name.

public virtual string Name { get; set; }

Property Value

string

Methods

Attach(IObjectListener)

Attaches the given listener.

public virtual void Attach(IObjectListener listener)

Parameters

NameDescription

The listener.

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Detach(IObjectListener)

Detaches the given listener.

public virtual void Detach(IObjectListener listener)

Parameters

NameDescription

The listener.

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Notify(params object[])

Notifies registered listeners.

public virtual void Notify(params object[] args)

Parameters

NameDescription

args object[]

A variable-length parameters list containing arguments.

Last updated