|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | - |
4 | | -namespace NetLicensingClient.Entities |
5 | | -{ |
6 | | - public class ValidationParameters : IEntity |
7 | | - { |
8 | | - private String productNumber; |
9 | | - private String licenseeName; |
10 | | - private String licenseeSecret; |
11 | | - private Dictionary<String, Dictionary<String, String>> parameters; |
12 | | - |
13 | | - public void setProductNumber(String productNumber) |
14 | | - { |
15 | | - this.productNumber = productNumber; |
16 | | - } |
17 | | - |
18 | | - public String getProductNumber () |
19 | | - { |
20 | | - return productNumber; |
21 | | - } |
22 | | - |
23 | | - public void setLicenseeName (String licenseeName) |
24 | | - { |
25 | | - this.licenseeName = licenseeName; |
26 | | - } |
27 | | - |
28 | | - public String getLicenseeName () |
29 | | - { |
30 | | - return licenseeName; |
31 | | - } |
32 | | - |
33 | | - [System.Obsolete("setLicenseeSecret() is obsolete, use NodeLocked licensing model instead")] |
34 | | - public void setLicenseeSecret (String licenseeSecret) |
35 | | - { |
36 | | - this.licenseeSecret = licenseeSecret; |
37 | | - } |
38 | | - |
39 | | - [System.Obsolete("getLicenseeSecret() is obsolete, use NodeLocked licensing model instead")] |
40 | | - public String getLicenseeSecret () |
41 | | - { |
42 | | - return licenseeSecret; |
43 | | - } |
44 | | - |
45 | | - public ValidationParameters () |
46 | | - { |
47 | | - parameters = new Dictionary<String, Dictionary<String, String>>(); |
48 | | - } |
49 | | - |
50 | | - public Dictionary<String, Dictionary<String, String>> getParameters() |
51 | | - { |
52 | | - return parameters; |
53 | | - } |
54 | | - |
55 | | - public Dictionary<String, String> getProductModuleValidationParameters(String productModuleNumber) { |
56 | | - try |
57 | | - { |
58 | | - return parameters[productModuleNumber]; |
59 | | - } |
60 | | - catch (KeyNotFoundException) |
61 | | - { |
62 | | - Dictionary<String, String> productModuleValidationParametes = new Dictionary<String, String> (); |
63 | | - parameters.Add(productModuleNumber, productModuleValidationParametes); |
64 | | - return productModuleValidationParametes; |
65 | | - } |
66 | | - } |
67 | | - |
68 | | - internal void setProductModuleValidation(String productModuleNumber, Dictionary<String, String> productModuleValidationParametes) |
69 | | - { |
70 | | - parameters.Add(productModuleNumber, productModuleValidationParametes); |
71 | | - } |
72 | | - |
73 | | - public void put(String productModuleNumber, String key, String value) |
74 | | - { |
75 | | - getProductModuleValidationParameters(productModuleNumber).Add(key, value); |
76 | | - } |
77 | | - } |
78 | | -} |
79 | | - |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | + |
| 4 | +namespace NetLicensingClient.Entities |
| 5 | +{ |
| 6 | + public class ValidationParameters : IEntity |
| 7 | + { |
| 8 | + private String productNumber; |
| 9 | + private Dictionary<String, String> licenseeProperties; |
| 10 | + private Dictionary<String, Dictionary<String, String>> parameters; |
| 11 | + |
| 12 | + public void setProductNumber(String productNumber) |
| 13 | + { |
| 14 | + this.productNumber = productNumber; |
| 15 | + } |
| 16 | + |
| 17 | + public String getProductNumber () |
| 18 | + { |
| 19 | + return productNumber; |
| 20 | + } |
| 21 | + |
| 22 | + public Dictionary<String, String> getLicenseeProperties() { |
| 23 | + return licenseeProperties; |
| 24 | + } |
| 25 | + |
| 26 | + public void setLicenseeProperty(String key, String value) { |
| 27 | + licenseeProperties.Add(key, value); |
| 28 | + } |
| 29 | + |
| 30 | + public void setLicenseeName (String licenseeName) |
| 31 | + { |
| 32 | + setLicenseeProperty(Constants.Licensee.PROP_LICENSEE_NAME, licenseeName); |
| 33 | + } |
| 34 | + |
| 35 | + public String getLicenseeName () |
| 36 | + { |
| 37 | + return licenseeProperties.TryGetValue(Constants.Licensee.PROP_LICENSEE_NAME, out string value) |
| 38 | + ? value |
| 39 | + : null; |
| 40 | + } |
| 41 | + |
| 42 | + [System.Obsolete("setLicenseeSecret() is obsolete, use NodeLocked licensing model instead")] |
| 43 | + public void setLicenseeSecret (String licenseeSecret) |
| 44 | + { |
| 45 | + setLicenseeProperty(Constants.Licensee.PROP_LICENSEE_SECRET, licenseeSecret); |
| 46 | + } |
| 47 | + |
| 48 | + [System.Obsolete("getLicenseeSecret() is obsolete, use NodeLocked licensing model instead")] |
| 49 | + public String getLicenseeSecret () |
| 50 | + { |
| 51 | + return licenseeProperties.TryGetValue(Constants.Licensee.PROP_LICENSEE_SECRET, out string value) |
| 52 | + ? value |
| 53 | + : null; |
| 54 | + } |
| 55 | + |
| 56 | + public ValidationParameters () |
| 57 | + { |
| 58 | + parameters = new Dictionary<String, Dictionary<String, String>>(); |
| 59 | + licenseeProperties = new Dictionary<String, String>(); |
| 60 | + } |
| 61 | + |
| 62 | + public Dictionary<String, Dictionary<String, String>> getParameters() |
| 63 | + { |
| 64 | + return parameters; |
| 65 | + } |
| 66 | + |
| 67 | + public Dictionary<String, String> getProductModuleValidationParameters(String productModuleNumber) { |
| 68 | + try |
| 69 | + { |
| 70 | + return parameters[productModuleNumber]; |
| 71 | + } |
| 72 | + catch (KeyNotFoundException) |
| 73 | + { |
| 74 | + Dictionary<String, String> productModuleValidationParametes = new Dictionary<String, String> (); |
| 75 | + parameters.Add(productModuleNumber, productModuleValidationParametes); |
| 76 | + return productModuleValidationParametes; |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + internal void setProductModuleValidation(String productModuleNumber, Dictionary<String, String> productModuleValidationParametes) |
| 81 | + { |
| 82 | + parameters.Add(productModuleNumber, productModuleValidationParametes); |
| 83 | + } |
| 84 | + |
| 85 | + public void put(String productModuleNumber, String key, String value) |
| 86 | + { |
| 87 | + getProductModuleValidationParameters(productModuleNumber).Add(key, value); |
| 88 | + } |
| 89 | + } |
| 90 | +} |
| 91 | + |
0 commit comments