Click or drag to resize
UsageRestriction Class
An usage Restriction is typically used to define environment license restrictions.
Inheritance Hierarchy

Namespace:  Babel.Licensing
Assemblies:   Babel.Licensing (in Babel.Licensing.dll) Version: 2.4.0.0
  Babel.Licensing (in Babel.Licensing.dll) Version: 2.4.0.0
Syntax
public class UsageRestriction : Restriction

The UsageRestriction type exposes the following members.

Constructors
  NameDescription
Public methodUsageRestriction
Initializes a new instance of the UsageRestriction class.
Top
Properties
  NameDescription
Public propertyCanRunInVirtualEnvironment
Whether the use of the license is permitted inside a virtual machine or emulator.
Public propertyExpireDate
Gets or sets the expire date after which the license is no longer valid.
(Inherited from Restriction.)
Public propertyId
Gets the restriction identifier.
(Inherited from Restriction.)
Public propertyName
Gets the restriction name.
(Overrides RestrictionName.)
Public propertyProcessList
Gets or sets the name of the process.
Public propertyUsage
Gets or sets the license usage.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValidate
Validates the current license usage restriction object.
(Overrides RestrictionValidate(ILicenseContext, Type, Object).)
Top
Examples
// Creates an XML license valid only for a specified process 
// name that is not executing in a virtual machine

var signer = XmlDigitalSignature.CreateFromKeyFile("Keys.snk");

string licenseXML = new XmlLicense().RestrictedToProcess("MotionCapture")
                                    .NotForVirtualEnvironment()
                                    .SignWith(signer)
                                    .ToReadableString();

//<Licenses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
//  <License>
//    <Restrictions>
//      <Restriction xsi:type="Usage" Id="r4A08" canRunInVirtualEnvironment="false">
//        <ProcessList>MotionCapture</ProcessList>
//      </Restriction>
//    </Restrictions>
//  </License>
//  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
//    <SignedInfo>
//      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
//      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
//      <Reference URI="">
//        <Transforms>
//          <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
//        </Transforms>
//        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
//        <DigestValue>ozYWhEYlFubqhRqkIrHA1kwD9sk=</DigestValue>
//      </Reference>
//    </SignedInfo>
//    <SignatureValue>afpb...</SignatureValue>
//  </Signature>
//</Licenses>
See Also