XmlLicense

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

Defines a license object that can be retrieved from an XML document. This class cannot be inherited.

public sealed class XmlLicense : ILicense

Inheritance

objectXmlLicense

Implements

ILicense

Inherited Members

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

Extension Methods

Licenseable.Build(ILicense), Licenseable.CopyFrom<XmlLicense>(XmlLicense, XmlLicense), Licenseable.ExpiresAt<XmlLicense>(XmlLicense, DateTime?), Licenseable.ForAnyAssembly<XmlLicense>(XmlLicense), Licenseable.ForAnyComponent<XmlLicense>(XmlLicense), Licenseable.ForAssembly<XmlLicense>(XmlLicense, Assembly), Licenseable.ForAssembly<XmlLicense>(XmlLicense, string), Licenseable.ForBetaTesters<XmlLicense>(XmlLicense, string, string, DateTime?), Licenseable.ForProduct<XmlLicense>(XmlLicense, string, string, string, string, string), Licenseable.IssuedAt<XmlLicense>(XmlLicense, DateTime?), Licenseable.LicensedTo<XmlLicense>(XmlLicense, string, string, string, string, byte[]), Licenseable.NotForVirtualEnvironment<XmlLicense>(XmlLicense), Licenseable.RestrictedToProcess<XmlLicense>(XmlLicense, params string[]), Licenseable.SignWith(ILicense, ISignatureProvider), Licenseable.SignWithKeys(ILicense, string, string), Licenseable.SupportExpiresAt<XmlLicense>(XmlLicense, DateTime?), Licenseable.ToRestrictedDomain<XmlLicense>(XmlLicense, string, string), Licenseable.UseOnlyAt<XmlLicense>(XmlLicense, string), Licenseable.ValidateWith(ILicense, ISignatureProvider), Licenseable.ValidateWithPublicKey(ILicense, string), Licenseable.WithComponents<XmlLicense>(XmlLicense, params string[]), Licenseable.WithFeature<XmlLicense>(XmlLicense, string, string, byte[], DateTime?, byte[]), Licenseable.WithFeature<XmlLicense>(XmlLicense, Feature), Licenseable.WithFeatures<XmlLicense>(XmlLicense, params Feature[]), Licenseable.WithField<XmlLicense>(XmlLicense, string, string), Licenseable.WithFields<XmlLicense>(XmlLicense, IDictionary<string, string>), Licenseable.WithFields<XmlLicense>(XmlLicense, params Field[]), Licenseable.WithHardwareKey<XmlLicense>(XmlLicense, string), Licenseable.WithId<XmlLicense>(XmlLicense, string), Licenseable.WithMaxSites<XmlLicense>(XmlLicense, int), Licenseable.WithMaximumRunCount<XmlLicense>(XmlLicense, int?), Licenseable.WithMaximumRunningInstances<XmlLicense>(XmlLicense, int?), Licenseable.WithRestrictions<XmlLicense>(XmlLicense, params Restriction[]), Licenseable.WithTrialDays<XmlLicense>(XmlLicense, int?), Licenseable.WithTrialRunTime<XmlLicense>(XmlLicense, TimeSpan?), Licenseable.WithType<XmlLicense>(XmlLicense, string), Licenseable.WithUniqueId<XmlLicense>(XmlLicense, string, int)

Constructors

XmlLicense()

Initializes a new instance of the class.

public XmlLicense()

Examples

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

var license = new XmlLicense();

string xml = license.WithUniqueId()
        .SignWithKeys(ecdsa.PublicKey, ecdsa.PrivateKey)
        .ValidateSignature()
        .ToReadableString();

// <Licenses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
//  <License Id="DD6FF" />
//  <Signature>
//    <Algorithm name="ECDSA" />
//    <PublicKey>EYP7JKB35IX6PI65WTKOXFYEGYZ4C727XSIFXOOTOU5NOLC</PublicKey>
//    <SignatureValue>JeVpo+pVfEOwCqtjF+M=</SignatureValue>
//  </Signature>
// </Licenses>

Properties

Assemblies

Gets the licensed assemblies collection.

public ICollection<string> Assemblies { get; }

Property Value

ICollection<string>

Components

Gets the licensed components collection.

public ICollection<string> Components { get; }

Property Value

ICollection<string>

ExpireDate

Gets, sets the license expire date.

public DateTime? ExpireDate { get; set; }

Property Value

DateTime?

Features

Gets the license collection.

public ICollection<Feature> Features { get; }

Property Value

ICollection<Feature>

Fields

Gets the license collection.

public ICollection<Field> Fields { get; }

Property Value

ICollection<Field>

Id

Gets or sets the license identifier.

public string Id { get; set; }

Property Value

string

IsBeta

Gets a value indicating whether this object is beta.

public bool IsBeta { get; }

Property Value

bool

IsTrial

Gets a value indicating whether this object is trial.

public bool IsTrial { get; }

Property Value

bool

IssueDate

Gets, sets the license issue date.

public DateTime? IssueDate { get; set; }

Property Value

DateTime?

LicenseKey

Gets the license key granted to this component.

public string LicenseKey { get; }

Property Value

string

Licensee

Gets, sets the information.

public Licensee Licensee { get; set; }

Property Value

Licensee

Product

Gets, sets the licensed product information.

public Product Product { get; set; }

Property Value

Product

Restrictions

Gets the collection of objects.

public ICollection<Restriction> Restrictions { get; }

Property Value

ICollection<Restriction>

Sites

Gets or sets the number of sites to license.

public int? Sites { get; set; }

Property Value

int?

SupportExpireDate

Gets, sets the license support expire date.

public DateTime? SupportExpireDate { get; set; }

Property Value

DateTime?

Timestamp

Gets the license object creation time.

public DateTime Timestamp { get; }

Property Value

DateTime

Type

Gets or sets the license type.

public string Type { get; set; }

Property Value

string

Methods

Dispose()

Disposes of the resources used by the license object.

public void Dispose()

~XmlLicense()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

protected ~XmlLicense()

Parse(string)

Parse the specified XML license string.

public static XmlLicense Parse(string licenseKey)

Parameters

NameDescription

licenseKey string

The license key.

Returns

NameDescription

An XmlLicense object that corresponds to the license key.

Last updated