private
static
void
PatchAsposeEmail()
{
string
name = Assembly.CreateQualifiedName(
typeof
(Aspose.Email.License).Assembly.FullName,
"\u0008\u2002\u2005"
);
Type licType = Type.GetType(name,
false
,
false
);
if
(licType ==
null
) {
throw
new
NotSupportedException(
"Unsupported version of Aspose.Email"
);
}
object
lic = Activator.CreateInstance(licType);
int
findCount = 0;
foreach
(FieldInfo field
in
licType.GetFields(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)) {
if
(field.FieldType ==
typeof
(
int
) && field.Name ==
"\u0002"
) {
field.SetValue(lic, (
int
)256);
++findCount;
}
else
if
(field.FieldType.Name ==
"\u0002\u2000"
&& field.Name ==
"\u0008"
) {
field.SetValue(lic, (
int
)1);
++findCount;
}
else
if
(field.FieldType.Name ==
"\u0006\u2002\u2005"
&& field.Name ==
"\u0002\u2000"
) {
field.SetValue(lic, (
int
)1);
++findCount;
}
else
if
(field.FieldType.Name ==
"\u0008\u2002\u2005"
&& field.Name ==
"\u0005\u2000"
) {
field.SetValue(
null
, lic);
++findCount;
}
}
if
(findCount < 4) {
throw
new
NotSupportedException(
"Unsupported version of Aspose.Email"
);
}
}