Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 3a1bfa5

Browse files
committed
Add revokedSubs
1 parent 71341d8 commit 3a1bfa5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Generic;
66
using System.Globalization;
77
using System.IO;
8+
using System.Linq;
89
using System.Text.RegularExpressions;
910
using System.Threading;
1011
using ServiceStack.Text;
@@ -159,20 +160,26 @@ public static void AssertEvaluationLicense()
159160
"See https://servicestack.net to upgrade to a valid license.").Trace();
160161
}
161162

163+
private static readonly int[] revokedSubs = new[] { 4018, 4019, 4041 };
164+
162165
private static LicenseKey __activatedLicense;
163166
public static void RegisterLicense(string licenseKeyText)
164167
{
165168
JsConfig.InitStatics();
166169

167-
string cutomerId = null;
170+
string subId = null;
168171
#if !PCL
169172
var hold = Thread.CurrentThread.CurrentCulture;
170173
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
171174
#endif
172175
try
173176
{
174177
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);
176183

177184
var key = PclExport.Instance.VerifyLicenseKeyText(licenseKeyText);
178185

@@ -193,8 +200,8 @@ public static void RegisterLicense(string licenseKeyText)
193200
throw;
194201

195202
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);
198205

199206
throw new LicenseException(msg).Trace();
200207
}

0 commit comments

Comments
 (0)