Listings 13-13 and
13-14 contain the code for RsaLicenseCache and RsaLicenseProvider.
Listing 13-13. The RsaLicenseCache.cs Class File
using System;
using System.Collections;
namespace ControlsBook2Lib.CH12.LiveSearchControls
{
692 CHAPTER 13 ?– PACKAGING AND DEPLOYMENT
///
/// Custom cache collection built on Hashtable for storing RsaLicense instances
/// internal class RsaLicenseCache
{
private Hashtable hash = new Hashtable();
public void AddLicense(Type type, RsaLicense license)
{
hash.Add(type, license);
}
public RsaLicense GetLicense(Type type)
{
RsaLicense license = null;
if (hash.ContainsKey(type))
license = (RsaLicense)hash[type];
return license;
}
public void RemoveLicense(Type type)
{
hash.Remove(type);
}
}
}
Listing 13-14. The RsaLicenseProvider.cs Class File
using System;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Web;
namespace ControlsBook2Lib.CH12.LiveSearchControls
{
///
/// Custom license provider for LiveSearch Lib which use RSA crypto
/// public class RsaLicenseProvider : LicenseProvider
{
static RsaLicenseCache licenseCache = new RsaLicenseCache();
///
/// Called by LicenseManager to retrieve a license
CHAPTER 13 ?– P ACKAGI NG AND DEPLOYMENT 693
/// ///
Context of request (design/runtime)
///
Control type needing license
///
Control instance needing license
///
true if a LicenseException should be thrown
when the component cannot be granted a license; otherwise, false.
Pages:
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883