10/06/19 21:45:18
単純に
public class MyLicence : License {
public override void Dispose() {}
public override string LicenseKey { get { return ""; } }
}
public class MyLicenceProvider : LicenseProvider {
public override License GetLicense(LicenseContext context, Type type, object instance, bool allowExceptions) {
if (allowExceptions) {
string exename = Path.GetFileName(Assembly.GetEntryAssembly().Location);
if (! exename.Equals("MyLicenceTest.exe")) {
throw new LicenseException(type, instance, "do't licenced");
}
}
return new MyLicence();
}
}
[LicenseProvider(typeof(MyLicenceProvider))]
public class TestClass {
License license;
public TestClass() {
license = LicenseManager.Validate(typeof(TestClass), this);
}
}
とかでもいいんじゃね?呼び出し元exe名縛り。