说明:由于人很懒,并且时间的关系。我不一一说明前因后果。一般blog上的都是代码实例。如果你们认为有用,自己看一下注释:)
/**/
/// <summary>
/// 试用警告
/// </summary>
public class EvaluationMonitor : IDisposable
... {
private RegistryKey _baseKey;
private static byte[] _desIV = new byte[] ...{ 0xa3, 0xef, 0xd6, 0x21, 0x37, 0x80, 0xcc, 0xb1 };
private static byte[] _desKey = new byte[] ...{ 0x12, 0x75, 0xa8, 0xf1, 50, 0xed, 0x13, 0xf2 };
private DateTime _firstUseDate;
private string _firstUseKeyName;
private bool _invalid;
private DateTime _lastUseDate;
private string _lastUseKeyName;
private byte[] _productData;
private RegistryKey _rootKey;
private int _usageCount;
private string _usageKeyName;
private const string classFirstUseKey = "Cobainsoft";
private const string classLastUseKey = "Control";
private const string classUsageKey = "TypeLib";
private const string userFirstUseKey = @"SoftwareMicrosoftWABWAB Sort State";
private const string userLastUseKey = @"SoftwareMicrosoftWABWAB4LastFind";
private const string userUsageKey = @"SoftwareMicrosoftWABWAB4";
/**//// <summary>
/// 初始化一个试用警告。
/// </summary>
/// <param name="productID"></param>
public EvaluationMonitor(string productID)
...{
RegistryKey key1;
this._usageCount = 0;
this._firstUseDate = DateTime.MinValue;
this._lastUseDate = DateTime.MinValue;
this._invalid = false;
this._productData = this.Encrypt(productID);
try
...{
Registry.ClassesRoot.CreateSubKey(productID);
Registry.ClassesRoot.DeleteSubKey(productID, false);
this._rootKey = Registry.ClassesRoot;
key1 = this._rootKey.OpenSubKey("CLSID", true);
this._usageKeyName = "TypeLib";
this._firstUseKeyName = "Cobainsoft";
this._lastUseKeyName = "Control";
}
catch
...{
this._rootKey =
/// 试用警告
/// </summary>
public class EvaluationMonitor : IDisposable
... {
private RegistryKey _baseKey;
private static byte[] _desIV = new byte[] ...{ 0xa3, 0xef, 0xd6, 0x21, 0x37, 0x80, 0xcc, 0xb1 };
private static byte[] _desKey = new byte[] ...{ 0x12, 0x75, 0xa8, 0xf1, 50, 0xed, 0x13, 0xf2 };
private DateTime _firstUseDate;
private string _firstUseKeyName;
private bool _invalid;
private DateTime _lastUseDate;
private string _lastUseKeyName;
private byte[] _productData;
private RegistryKey _rootKey;
private int _usageCount;
private string _usageKeyName;
private const string classFirstUseKey = "Cobainsoft";
private const string classLastUseKey = "Control";
private const string classUsageKey = "TypeLib";
private const string userFirstUseKey = @"SoftwareMicrosoftWABWAB Sort State";
private const string userLastUseKey = @"SoftwareMicrosoftWABWAB4LastFind";
private const string userUsageKey = @"SoftwareMicrosoftWABWAB4";
/**//// <summary>
/// 初始化一个试用警告。
/// </summary>
/// <param name="productID"></param>
public EvaluationMonitor(string productID)
...{
RegistryKey key1;
this._usageCount = 0;
this._firstUseDate = DateTime.MinValue;
this._lastUseDate = DateTime.MinValue;
this._invalid = false;
this._productData = this.Encrypt(productID);
try
...{
Registry.ClassesRoot.CreateSubKey(productID);
Registry.ClassesRoot.DeleteSubKey(productID, false);
this._rootKey = Registry.ClassesRoot;
key1 = this._rootKey.OpenSubKey("CLSID", true);
this._usageKeyName = "TypeLib";
this._firstUseKeyName = "Cobainsoft";
this._lastUseKeyName = "Control";
}
catch
...{
this._rootKey =