这里的DateTime(2004, 7, 11)就是控件的过期时间。说来简单,其实要找到它还是费了一番周折的。根据上面的线索,我在用ildasm工具反汇编出的NineRays.Web.UI.WebControls.FlyTreeView.IL文件中找到了对应的IL代码如下:
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// 代码大小 19 (0x13)
.maxstack 4
IL_0000: ldsflda valuetype [mscorlib]System.DateTime Global::TRIAL_EXPIRE_DATE
IL_0005: ldc.i4 0x7d4
IL_000a: ldc.i4.7
IL_000b: ldc.i4.s 11
IL_000d: call instance void [mscorlib]System.DateTime::.ctor(int32, int32,int32)
IL_0012: ret
} // end of method Global::.cctor
代码中的0x7d4 便是十六进制的年号2004,我不想太贪,就把它改成2050年吧,十六进制是0x802F
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// 代码大小 19 (0x13)
.maxstack 4
IL_0000: ldsflda valuetype [mscorlib]System.DateTime Global::TRIAL_EXPIRE_DATE
IL_0005: ldc.i4 0x802F
IL_000a: ldc.i4.7
IL_000b: ldc.i4.s 11
IL_000d: call instance void [mscorlib]System.DateTime::.ctor(int32, int32,int32)
IL_0012: ret
} // end of method Global::.cctor
保存前别忘了删除IL代码起始部分类似下面的代码
.publickey =(00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 // .$..............
00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 // .$..RSA1........
CD 62 12 05 0E 7C CD 6F 51 AF 2C 41 FD CC 65 44 // .b...|.oQ.,A..eD