예제 #1
0
        public Onix5SchemaConverter(IEPubIdentifier identifier)
        {
            // if isbn
            bool bISBN = false;
            if (string.Compare(identifier.Scheme, "isbn", CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) == 0)
            {
                string stripped = identifier.ID.Replace("-", string.Empty);
                if (stripped.Length == 13)
                {
                    _type = OnixType.ISBN_13;
                    bISBN = true;
                }
                else if (stripped.Length == 10)
                {
                    _type = OnixType.ISBN_10;
                    bISBN = true;
                }
            }
            else if (string.Compare(identifier.Scheme, "uri", CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) == 0)
            {
                _type = OnixType.URN;
                _parsedId = string.Format("{0}", identifier.ID);
            }
            if (bISBN)
            {
                _parsedId = string.Format("urn:isbn:{0}", identifier.ID.Replace("-", string.Empty));
            }

            if (_type == OnixType.Proprietary)
            {
                _parsedId = identifier.ID;
            }
        }
예제 #2
0
        public Onix5SchemaConverter(IEPubIdentifier identifier)
        {
            // if isbn
            bool bISBN = false;

            if (string.Compare(identifier.Scheme, "isbn", CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) == 0)
            {
                string stripped = identifier.ID.Replace("-", string.Empty);
                if (stripped.Length == 13)
                {
                    _type = OnixType.ISBN_13;
                    bISBN = true;
                }
                else if (stripped.Length == 10)
                {
                    _type = OnixType.ISBN_10;
                    bISBN = true;
                }
            }
            else if (string.Compare(identifier.Scheme, "uri", CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) == 0)
            {
                _type     = OnixType.URN;
                _parsedId = string.Format("{0}", identifier.ID);
            }
            if (bISBN)
            {
                _parsedId = string.Format("urn:isbn:{0}", identifier.ID.Replace("-", string.Empty));
            }

            if (_type == OnixType.Proprietary)
            {
                _parsedId = identifier.ID;
            }
        }