public DrmPolicy(JToken node) : base(node)
 {
     if (node["id"] != null)
     {
         this._Id = ParseInt(node["id"].Value <string>());
     }
     if (node["partnerId"] != null)
     {
         this._PartnerId = ParseInt(node["partnerId"].Value <string>());
     }
     if (node["name"] != null)
     {
         this._Name = node["name"].Value <string>();
     }
     if (node["systemName"] != null)
     {
         this._SystemName = node["systemName"].Value <string>();
     }
     if (node["description"] != null)
     {
         this._Description = node["description"].Value <string>();
     }
     if (node["provider"] != null)
     {
         this._Provider = (DrmProviderType)StringEnum.Parse(typeof(DrmProviderType), node["provider"].Value <string>());
     }
     if (node["status"] != null)
     {
         this._Status = (DrmPolicyStatus)ParseEnum(typeof(DrmPolicyStatus), node["status"].Value <string>());
     }
     if (node["scenario"] != null)
     {
         this._Scenario = (DrmLicenseScenario)StringEnum.Parse(typeof(DrmLicenseScenario), node["scenario"].Value <string>());
     }
     if (node["licenseType"] != null)
     {
         this._LicenseType = (DrmLicenseType)StringEnum.Parse(typeof(DrmLicenseType), node["licenseType"].Value <string>());
     }
     if (node["licenseExpirationPolicy"] != null)
     {
         this._LicenseExpirationPolicy = (DrmLicenseExpirationPolicy)ParseEnum(typeof(DrmLicenseExpirationPolicy), node["licenseExpirationPolicy"].Value <string>());
     }
     if (node["duration"] != null)
     {
         this._Duration = ParseInt(node["duration"].Value <string>());
     }
     if (node["createdAt"] != null)
     {
         this._CreatedAt = ParseInt(node["createdAt"].Value <string>());
     }
     if (node["updatedAt"] != null)
     {
         this._UpdatedAt = ParseInt(node["updatedAt"].Value <string>());
     }
     if (node["licenseParams"] != null)
     {
         this._LicenseParams = new List <KeyValue>();
         foreach (var arrayNode in node["licenseParams"].Children())
         {
             this._LicenseParams.Add(ObjectFactory.Create <KeyValue>(arrayNode));
         }
     }
 }
Beispiel #2
0
        public DrmPolicy(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "id":
                    this._Id = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerId":
                    this._PartnerId = ParseInt(propertyNode.InnerText);
                    continue;

                case "name":
                    this._Name = propertyNode.InnerText;
                    continue;

                case "systemName":
                    this._SystemName = propertyNode.InnerText;
                    continue;

                case "description":
                    this._Description = propertyNode.InnerText;
                    continue;

                case "provider":
                    this._Provider = (DrmProviderType)StringEnum.Parse(typeof(DrmProviderType), propertyNode.InnerText);
                    continue;

                case "status":
                    this._Status = (DrmPolicyStatus)ParseEnum(typeof(DrmPolicyStatus), propertyNode.InnerText);
                    continue;

                case "scenario":
                    this._Scenario = (DrmLicenseScenario)StringEnum.Parse(typeof(DrmLicenseScenario), propertyNode.InnerText);
                    continue;

                case "licenseType":
                    this._LicenseType = (DrmLicenseType)StringEnum.Parse(typeof(DrmLicenseType), propertyNode.InnerText);
                    continue;

                case "licenseExpirationPolicy":
                    this._LicenseExpirationPolicy = (DrmLicenseExpirationPolicy)ParseEnum(typeof(DrmLicenseExpirationPolicy), propertyNode.InnerText);
                    continue;

                case "duration":
                    this._Duration = ParseInt(propertyNode.InnerText);
                    continue;

                case "createdAt":
                    this._CreatedAt = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAt":
                    this._UpdatedAt = ParseInt(propertyNode.InnerText);
                    continue;

                case "licenseParams":
                    this._LicenseParams = new List <KeyValue>();
                    foreach (XmlElement arrayNode in propertyNode.ChildNodes)
                    {
                        this._LicenseParams.Add(ObjectFactory.Create <KeyValue>(arrayNode));
                    }
                    continue;
                }
            }
        }