예제 #1
0
        public static ReleaseLabel ReadReleaseLabel(XElement label)
        {
            label.AssertName("label");
            label.AssertNoElements();

            ReleaseLabel result = new ReleaseLabel();

            foreach (XAttribute attr in label.Attributes())
            {
                if (attr.Name == "catno")
                {
                    result.CatalogNumber = attr.Value;
                }
                else if (attr.Name == "name")
                {
                    result.Name = attr.Value;
                }
                else
                {
                    throw new Exception("Unknown release label attribute: " + attr.Name);
                }
            }

            return(result);
        }
예제 #2
0
        private ReleaseLabel ReadReleaseLabel()
        {
            this.XmlReader.AssertElementStart("label");
            this.XmlReader.AssertEmptyElement();

            ReleaseLabel label = new ReleaseLabel();

            label.CatalogNumber = this.XmlReader.GetAttribute("catno");
            label.Name          = this.XmlReader.GetAttribute("name");

            return(label);
        }
예제 #3
0
        private ReleaseLabel ReadReleaseLabel(JObject source)
        {
            ReleaseLabel releaseLabel = new ReleaseLabel();

            foreach (var item in source)
            {
                var v = item.Value;

                switch (item.Key)
                {
                case "name":
                    releaseLabel.Name = v.Value <string>();
                    break;

                case "entity_type":
                    break;

                case "entity_type_name":
                    if (v.Value <string>() != "Label")
                    {
                        this.ThrowIfStrict("Unknown entity type name.");
                    }
                    break;

                case "catno":
                    releaseLabel.CatalogNumber = v.Value <string>();
                    break;

                case "id":
                    releaseLabel.Id = v.Value <int>();
                    break;

                case "resource_url":
                    break;

                default:
                    this.ThrowIfStrict("Unknown key: " + item.Key);
                    break;
                }
            }
            return(releaseLabel);
        }
예제 #4
0
        public static ReleaseLabel ReadReleaseLabel(XElement label)
        {
            label.AssertName("label");
            label.AssertNoElements();

            ReleaseLabel result = new ReleaseLabel();

            foreach (XAttribute attr in label.Attributes())
            {
                if (attr.Name == "catno")
                {
                    result.CatalogNumber = attr.Value;
                }
                else if (attr.Name == "name")
                {
                    result.Name = attr.Value;
                }
                else
                {
                    throw new Exception("Unknown release label attribute: " + attr.Name);
                }
            }

            return result;
        }
예제 #5
0
        private ReleaseLabel ReadReleaseLabel()
        {
            this.XmlReader.AssertElementStart("label");
            this.XmlReader.AssertEmptyElement();

            ReleaseLabel label = new ReleaseLabel();
            label.CatalogNumber = this.XmlReader.GetAttribute("catno");
            label.Name = this.XmlReader.GetAttribute("name");

            return label;
        }
예제 #6
0
        private ReleaseLabel ReadReleaseLabel(JObject source)
        {
            ReleaseLabel releaseLabel = new ReleaseLabel();
            foreach (var item in source)
            {
                var v = item.Value;

                switch (item.Key)
                {
                    case "name":
                        releaseLabel.Name = v.Value<string>();
                        break;
                    case "entity_type":
                        break;
                    case "entity_type_name":
                        if (v.Value<string>() != "Label")
                        {
                            this.ThrowIfStrict("Unknown entity type name.");
                        }
                        break;
                    case "catno":
                        releaseLabel.CatalogNumber = v.Value<string>();
                        break;
                    case "id":
                        releaseLabel.Id = v.Value<int>();
                        break;
                    case "resource_url":
                        break;
                    default:
                        this.ThrowIfStrict("Unknown key: " + item.Key);
                        break;
                }
            }
            return releaseLabel;
        }