public ValidationResult(netlicensing source) { validations = new Dictionary <String, Composition>(); ttl = source.ttl; if (source.items.item == null) { return; } foreach (item i in source.items.item) { if (!Constants.ValidationResult.VALIDATION_RESULT_TYPE.Equals(i.type)) { throw new NetLicensingException(String.Format("Wrong object type '{0}', expected '{1}'", (i.type != null) ? i.type : "<null>", Constants.ValidationResult.VALIDATION_RESULT_TYPE)); } Composition pmValidateProperties = new Composition(); String productModuleNumber = null; if (i.property != null) { foreach (property p in i.property) { switch (p.name) { case Constants.ProductModule.PRODUCT_MODULE_NUMBER: productModuleNumber = p.Value; break; default: pmValidateProperties.put(p.name, p.Value); break; } } } if (i.list != null) { foreach (list l in i.list) { pmValidateProperties.properties.Add(l.name, convertFromList(l)); } } if (productModuleNumber == null) { throw new NetLicensingException(String.Format("Validation item does not contain property '{0}'", Constants.ProductModule.PRODUCT_MODULE_NUMBER)); } setProductModuleValidation(productModuleNumber, pmValidateProperties); } }
private Composition convertFromList(list l) { Composition result = new Composition(); if (l.property != null) { foreach (property p in l.property) { result.put(p.name, p.Value); } } if (l.list1 != null) { foreach (list l1 in l.list1) { result.properties.Add(l1.name, convertFromList(l1)); } } return(result); }
private Composition convertFromList(list l) { Composition result = new Composition(); if (l.property != null) { foreach (property p in l.property) { result.put(p.name, p.Value); } } if (l.list1 != null) { foreach (list l1 in l.list1) { result.properties.Add(l1.name, convertFromList(l1)); } } return result; }
public ValidationResult(netlicensing source) { validations = new Dictionary<String, Composition>(); if (source.items.item == null) { return; } foreach (item i in source.items.item) { if (!Constants.ValidationResult.VALIDATION_RESULT_TYPE.Equals(i.type)) { throw new NetLicensingException(String.Format("Wrong object type '{0}', expected '{1}'", (i.type != null) ? i.type : "<null>", Constants.ValidationResult.VALIDATION_RESULT_TYPE)); } Composition pmValidateProperties = new Composition(); String productModuleNumber = null; if (i.property != null) { foreach (property p in i.property) { switch (p.name) { case Constants.ProductModule.PRODUCT_MODULE_NUMBER: productModuleNumber = p.Value; break; default: pmValidateProperties.put(p.name, p.Value); break; } } } if (i.list != null) { foreach (list l in i.list) { pmValidateProperties.properties.Add(l.name, convertFromList(l)); } } if (productModuleNumber == null) { throw new NetLicensingException(String.Format("Validation item does not contain property '{0}'", Constants.ProductModule.PRODUCT_MODULE_NUMBER)); } setProductModuleValidation(productModuleNumber, pmValidateProperties); } }