Class License

Class License

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (25.6.0)

Provides methods to license the component.

public sealed class License
{
    private readonly string _path;
    public License(string path)
    {
        _path = path;
    }
    public void Load()
    {
    }
    public bool IsValid()
    {
    }
}

Inheritance

object License

Inherited Members

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

Examples

In this example, an attempt will be made to find a license file named MyLicense.licin the folder that contains

the component, in the folder that contains the calling assembly,in the folder of the entry assembly and then in the embedded resources of the calling assembly.

using Aspose.Words; // Namespace does not need to be repeated on each line if already declared
License license = new License();
license.SetLicense("MyLicense.lic"); // Line should end with a semicolon for consistency
Dim license As license = New license
License.SetLicense("MyLicense.lic")

Shows how to load a license for Aspose.Note from a file.

Aspose.Note.License license =
       new Aspose.Note.License();
      license.SetLicense("Aspose.Note.lic");

Shows how to load a license for Aspose.Note from a stream.

Aspose.Note.License license = new Aspose.Note.License();
      using (FileStream myStream = new FileStream("Aspose.Note.lic", FileMode.Open))
      {
          license.SetLicense(myStream);
      }

Shows how to load a license for Aspose.Note from embedded file resource.

Aspose.Note.License license = new Aspose.Note.License();
   license.SetLicense("Aspose.Note.lic");

Constructors

License()

public License()
   {
   }

Methods

SetLicense(string)

Licenses the component.

public void SetLicense(string licenseName)
   {
   }

Parameters

licenseName string

Can be a full or short file name or name of an embedded resource.Use an empty string to switch to evaluation mode.

Examples

In this example, an attempt will be made to find a license file named MyLicense.licin the folder that contains

the component, in the folder that contains the calling assembly,in the folder of the entry assembly and then in the embedded resources of the calling assembly.

Aspose.Note.License license =
       new Aspose.Note.License();
   license.SetLicense("Aspose.Note.lic");

Shows how to load a license for Aspose.Note from embedded file resource.

Aspose.Note.License license = new Aspose.Note.License();
       license.SetLicense("Aspose.Note.lic");

Remarks

Tries to find the license in the following locations:

  1. Explicit path.

  2. The folder that contains the Aspose component assembly.

  3. The folder that contains the client’s calling assembly.

  4. The folder that contains the entry (startup) assembly.

  5. An embedded resource in the client’s calling assembly.

On the .NET Compact Framework, tries to find the license only in these locations:

  1. Explicit path.

  2. An embedded resource in the client’s calling assembly.

SetLicense(Stream)

Licenses the component.

public void SetLicense(Stream stream)
   {
       licensor.License = new License();
       licensor.License.Load(stream);
   }

Parameters

stream Stream

A stream that contains the license.

Examples

using System;
   using System.IO;
   using Aspose.Words;
   namespace YourNamespace
   {
       public class YourClass
       {
           private License license;
           private Stream myStream;
           public void YourMethod()
           {
               this.license = new License();
               this.myStream.Seek(0, SeekOrigin.Begin); // Added semi-colon for proper syntax
               this.license.SetLicense(this.myStream);
           }
       }
   }
Dim license as License = new License
license.SetLicense(myStream)

Shows how to load a license for Aspose.Note from a stream.

Aspose.Note.License license = new Aspose.Note.License();using (FileStream myStream = new FileStream(“Aspose.Note.lic”, FileMode.Open)){license.SetLicense(myStream);}


#### Remarks

<p>Use this method to load a license from a stream.</p>
 English