forked from classic130/VMProtect-Source
-
Notifications
You must be signed in to change notification settings - Fork 1
/
VmpLicenseKey.cs
36 lines (33 loc) · 1.18 KB
/
VmpLicenseKey.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
namespace ipn_sqlclr
{
public partial class UserDefinedFunctions
{
[SqlFunction]
public static SqlString VmpLicenseKeyGenerateNew(SqlInt32 productId, SqlString customerName, SqlString eMail, SqlDateTime maxBuildDt)
{
return new SqlString (Keygen.GenerateKey(productId.Value, customerName.Value, eMail.Value, maxBuildDt.Value));
}
[SqlFunction(FillRowMethodName = "FillRowVmpLicenseParseKey",
TableDefinition = "[productId] int,[customerName] nvarchar(max),[eMail] nvarchar(max),maxBuildDT datetime")]
public static IEnumerable VmpLicenseParseKey(String key)
{
yield return key;
}
public static void FillRowVmpLicenseParseKey(Object obj, out SqlInt32 productId, out SqlString customerName, out SqlString eMail, out SqlDateTime maxBuildDt)
{
var key = (string)obj;
int productIdTmp;
string customerNameTmp, eMailTmp;
DateTime maxBuildDtTmp;
Keygen.ParseKey(key, out productIdTmp, out customerNameTmp, out eMailTmp, out maxBuildDtTmp);
productId = productIdTmp;
customerName = customerNameTmp;
eMail = eMailTmp;
maxBuildDt = maxBuildDtTmp;
}
}
}