XHEO.com
Mar
3
2010

How-to: Display time remaining

After validating a license, get a TimeMonitor object. The TimeMonitor provides information about the state of a Time Limit. After obtaining a TimeMonitor you can use the exposed properties to query the state of the time limit.

var monitor = _license.GetTimeMonitor();
MessageBox.Show( 
    String.Format( "You have {0} of {1} remaining.", 
        monitor.TimeRemaining, 
        monitor.TotalTime ) );
Mar
3
2010

How-to: Display uses remaining

After validating a license, get a UseMonitor object. The TimeMonitor provides information about the state of a Use Limit. After obtaining a UseMonitor you can use the exposed properties to query the state of the time limit.

_license = SecureLicenseManager.Validate( this, null, null );
var monitor = _license.GetUseMonitor();
MessageBox.Show( 
    String.Format( "You have {0} of {1} uses remaining.", 
        monitor.UseCount, 
        monitor.UseLimit.Uses ) );
Mar
2
2010

Why Don't Serial Numbers Match My Code Masks?

Serial number masks are calculated by DeployLX when the license is edited in the DeployLX License Manager. As the license is modified and options changed, DeployLX will ask to recalculate the license masks. On occasion the serial numbers generated for the license will not match the masks. 

Aug
13
2009

Enabling Developer Mode

DeployLX Licensing supports a lightweight diagnostic mode that captures additional details and modifies behavior to make it easier during development to diagnose issues and test licenses.

Aug
10
2009

Get NHibernate Entities by Property, Part 2

In the previous post, I showed how to use the Session.Get<T> syntax against an arbitrary property on the entity. The primary limitation with that method is that it only works for constant values. The following will work with constants, local variables, return values from methods, etc.

Aug
7
2009

Get NHibernate Entities by Property

While many of my entity classes use surrogate primary keys, they also have natural keys (Product SKU for example). When I want one of those entities it's more natural to use the natural key, naturally. Normally that requires a CreateCriteria call, I'd rather just call Get<T> like I can with the surrogate keys. So I created an extension method that lets me do this:

Jun
3
2009

Easy, Fast, Thread-safe Dictionary with a Type Key

From time to time I'll want to perform some operation on a subset of properties of a Type. However reflecting over types can be costly exercise. Since Types don't change at runtime the natural solution is to parse them once and cache the results. For small sets this works well. However  with hundreds of types, the performance starts to degrade. I've also noticed that the typeof operator is rather slow when compared to intrinsic is and as operators.

Limitations

  • It's ready only. It's a great lazily initialized structure but the factors that make it thread safe.
  • It's never garbage collected. Type information is always retained in the AppDomain so any statics created this way will always remain live.
Mar
20
2009

How-to: Veil Using MSBuild

Being able to encorporate a veiling process into your MSBuild project is an easy way to veil as you develop. This can also be beneficial for testing, as you are not waiting until the end to begin your testing. 

Mar
18
2009

Manually Creating a Visual Studio .accessor File

Visual Studio 2008 offers a great suite of testing tools for developers. One of the the nicest things is the ability to generate reflection based accessor assemblies that let you access the private members of classes. There is still opendebate about the benefit of testing private methods but for some things -- especially security related -- where it makes a great deal of sense. Getting at those private methods however is not the easiest thing to do.

Feb
25
2009

Custom Limits with the Embeddable Source

The Creating a Custom Limit topic in the Developers Guide describes how to create your own custom license limit. If you are using the embeddable C# runtime, you will need to make a few changes. 

Subscribe Documents Tagged 'code'

Subscribe Subscribe

Search

Tags