Ejemplo n.º 1
0
        private static bool IsBadMetadata(MetadataItem item)
        {
            // skip data that is already available in other
            // database fields or unreliable.
            if ((item.Type == MetadataType.MIMETYPE) ||
                (item.Type == MetadataType.THUMBNAILS) ||
                (item.Type == MetadataType.THUMBNAIL_DATA) ||
                (item.Type == MetadataType.CONTENT_TYPE)
                )
            {
                return(true);
            }

            // skip 0-length durations.
            if ((item.Type == MetadataType.DURATION) && (item.Value == "0"))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private static bool IsBadMetadata(MetadataItem item)
        {
            // skip data that is already available in other
            // database fields or unreliable.
            if (	(item.Type == MetadataType.MIMETYPE) ||
                    (item.Type == MetadataType.THUMBNAILS) ||
                    (item.Type == MetadataType.THUMBNAIL_DATA) ||
                    (item.Type == MetadataType.CONTENT_TYPE)
                )
                return true;

            // skip 0-length durations.
            if ((item.Type == MetadataType.DURATION) && (item.Value == "0"))
                return true;

            return false;
        }
Ejemplo n.º 3
0
        public MetadataItem[] ToArray()
        {
            if (packedString == null) {
                return new MetadataItem[0];
            }

            int headerEndIdx	= packedString.IndexOf(']');
            string strHeader	= packedString.Substring(1,  headerEndIdx - 1);
            string strData		= packedString.Remove(0, headerEndIdx + 1);

            string[] headerVals = strHeader.Split(new char[] { ':' });
            MetadataItem[] metadata = new MetadataItem[headerVals.Length / 2];
            int pos = 0;

            for (int i = 0; i < headerVals.Length; i += 2) {
                MetadataType type	= (MetadataType)int.Parse(headerVals[i]);
                int valueLen		= int.Parse(headerVals[i + 1]);

                metadata[i / 2] = new MetadataItem(type, strData.Substring(pos, valueLen));
                pos += valueLen;
            }

            return metadata;
        }