Пример #1
0
        public static IEnumerable <XElement> MetaList(string containerName, IList <Metadata> metaList, string granularity)
        {
            if (string.IsNullOrEmpty(containerName) || metaList == null || metaList.Count == 0 || string.IsNullOrEmpty(granularity))
            {
                yield break;
            }

            foreach (var metaItem in metaList)
            {
                switch (FormatList.Int2Format(metaItem.MdFormat))
                {
                case Enums.MetadataFormats.DublinCore:
                    yield return(new XElement(containerName, DublinCore.Encode(metaItem, granularity)));

                    break;

                case Enums.MetadataFormats.PanSimple:
                    yield return(new XElement(containerName, PanSimple.Encode(metaItem, granularity)));

                    break;

                case Enums.MetadataFormats.Provenance:
                    yield return(new XElement(containerName, Provenance.Encode(metaItem, granularity)));

                    break;

                // TODO: Add format here

                case Enums.MetadataFormats.None:
                default:
                    break;
                }
            }
        }
Пример #2
0
        public static XElement Metadata(string containerName, Metadata metadata, string granularity)
        {
            if (string.IsNullOrEmpty(containerName) || metadata == null || string.IsNullOrEmpty(granularity))
            {
                return(null);
            }

            switch (FormatList.Int2Format(metadata.MdFormat))
            {
            case Enums.MetadataFormats.DublinCore:
                return(new XElement(containerName, DublinCore.Encode(metadata, granularity)));

            case Enums.MetadataFormats.PanSimple:
                return(new XElement(containerName, PanSimple.Encode(metadata, granularity)));

            case Enums.MetadataFormats.Provenance:
                return(new XElement(containerName, Provenance.Encode(metadata, granularity)));

            // TODO: Add format here

            case Enums.MetadataFormats.None:
            default:
                return(null);
            }
        }