AVBlocks™

How to set license string in AVBlocks

This post assumes that you are using AVBlocks for .NET and you have purchased a license from the License Management site.

When you license a Primo Software product you usually get a license file in the email. The license file is basically a signed XML string that describes the products and features you have licensed. Then you have to provide the license to AVBlocks with the Library.SetLicense method.

Here is a code snippet in C#:

const string license = 
    @"<primoSoftware>
      <license version='1.0'>
        <token>abcdefghijklmnop</token>
        <revision>1</revision>
        <issueDate>2013-05-23</issueDate>
        <expireDate>2014-05-24</expireDate>
        <updateTime>2013-05-23 21:02:44</updateTime>
        <item id='avb-win'>
          <product>avb</product>
          <feature id='h264-enc' />
          <feature id='pcm' />
        </item>    
    	<signature>abcd-long-signature-string-here</signature>
      </license>
    </primoSoftware>";
    
Library.SetLicense(license);

The license above is for AVBlocks for Windows (avb-win) and includes the AVC / H.264 Encoder (h264-enc) and PCM Audio (pcm) features.

Then the following calls should return true for the license above:

Library.IsLicensed(null, null);
Library.IsLicensed(null, "h264-enc");
Library.IsLicensed(null, "pcm");
Library.IsLicensed("avb", "h264-enc");
Library.IsLicensed("avb", "pcm");

NOTES:

  1. Calling Library.SetLicense on any of the AVBlocks Demo libraries will fail. The Demo version cannot be licensed. If you downloaded AVBlocks from www.avblocks.com then you have the Demo product. You need to get your AVBlocks copy from the Downloads section of the License Manager site.

  2. You should be careful when formatting the license XML as it may become invalid.

Here are the rules: