You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB
C#

9 months ago
namespace com.azkoss.excellite
{
using System;
using System.ComponentModel;
internal class OfficeLicenseProvider : LicenseProvider
{
// Methods
static OfficeLicenseProvider()
{
OfficeLicenseProvider.rndGen = new Random();
}
public OfficeLicenseProvider()
{
}
public override License GetLicense(LicenseContext context, Type type, object instance, bool allowExceptions)
{
ExcelFile file1 = instance as ExcelFile;
if (file1 == null)
{
if (allowExceptions)
{
throw new Exception("Internal error: Unrecognized caller.");
}
return null;
}
file1.HashFactorA = OfficeLicenseProvider.rndGen.Next(0x458, 0x3117);
file1.HashFactorB = file1.HashFactorA - 150;
return new OfficeLicense("Valid");
}
// Fields
private static Random rndGen;
}
}