public static ProductKeyConfigurationConfigurationsConfiguration TryGetEpidPkConfig(EPid pid, out IOrderedEnumerable <KmsItem> kmsItems, out CsvlkItem csvlkRule) { kmsItems = null; csvlkRule = null; try { if (pid.KeyId > 999999999 || pid.GroupId > 99999) { return(null); } } catch { return(null); } var configs = MainWindow.CsvlkConfigs.Where(c => c.RefGroupId == pid.GroupId).ToArray(); var configIds = configs.Select(c => c.ActConfigGuid); var range = MainWindow.CsvlkRanges.SingleOrDefault(r => configIds.Contains(r.RefActConfigGuid) && r.Start <= pid.KeyId && pid.KeyId <= r.End); if (range == null) { return(null); } var config = configs.First(c => c.ActConfigGuid == range.RefActConfigGuid); if (KmsLists.CsvlkItemList[config.ActConfigGuid] == null) { return(config); } csvlkRule = KmsLists.CsvlkItemList[config.ActConfigGuid]; kmsItems = csvlkRule.Activates.Select(g => MainWindow.KmsProductList[g.Guid]).Where(k => k != null).OrderBy(k => k.DisplayName); return(config); }
public ProductKeyConfigurationConfigurationsConfiguration TryGetEpidPkConfig(out IOrderedEnumerable <KmsItem> kmsItems, out CsvlkItem csvlkRule) { return(TryGetEpidPkConfig(this, out kmsItems, out csvlkRule)); }