5
5
using System . Collections . Generic ;
6
6
using System . Globalization ;
7
7
using System . IO ;
8
+ using System . Linq ;
8
9
using System . Text . RegularExpressions ;
9
10
using System . Threading ;
10
11
using ServiceStack . Text ;
@@ -159,20 +160,26 @@ public static void AssertEvaluationLicense()
159
160
"See https://servicestack.net to upgrade to a valid license." ) . Trace ( ) ;
160
161
}
161
162
163
+ private static readonly int [ ] revokedSubs = new [ ] { 4018 , 4019 , 4041 } ;
164
+
162
165
private static LicenseKey __activatedLicense ;
163
166
public static void RegisterLicense ( string licenseKeyText )
164
167
{
165
168
JsConfig . InitStatics ( ) ;
166
169
167
- string cutomerId = null ;
170
+ string subId = null ;
168
171
#if ! PCL
169
172
var hold = Thread . CurrentThread . CurrentCulture ;
170
173
Thread . CurrentThread . CurrentCulture = CultureInfo . InvariantCulture ;
171
174
#endif
172
175
try
173
176
{
174
177
var parts = licenseKeyText . SplitOnFirst ( '-' ) ;
175
- cutomerId = parts [ 0 ] ;
178
+ subId = parts [ 0 ] ;
179
+
180
+ int subIdInt ;
181
+ if ( int . TryParse ( subId , out subIdInt ) && revokedSubs . Contains ( subIdInt ) )
182
+ throw new LicenseException ( "This subscription has been revoked. " + ContactDetails ) ;
176
183
177
184
var key = PclExport . Instance . VerifyLicenseKeyText ( licenseKeyText ) ;
178
185
@@ -193,8 +200,8 @@ public static void RegisterLicense(string licenseKeyText)
193
200
throw ;
194
201
195
202
var msg = "This license is invalid." + ContactDetails ;
196
- if ( ! string . IsNullOrEmpty ( cutomerId ) )
197
- msg += " The id for this license is '{0}'" . Fmt ( cutomerId ) ;
203
+ if ( ! string . IsNullOrEmpty ( subId ) )
204
+ msg += " The id for this license is '{0}'" . Fmt ( subId ) ;
198
205
199
206
throw new LicenseException ( msg ) . Trace ( ) ;
200
207
}
0 commit comments