public string BuildExternalRef()
        {
            switch (this.AssetType)
            {
            case AssetType.MasterCoverArt:
            case AssetType.MasterArtistArt:
            case AssetType.MasterLabelArt:
            {
                return(String.Format("{0}/{1}", this.AssetType, this.MasterSha256Checksum).ToLower());
            }

            case AssetType.TrackProduct:
            case AssetType.TrackPreview:
            {
                var externalOwnerRef = Urn.Parse(this.ExternalOwnerUrn).IdValue;
                return(String.Format("{0}/{1}/{2}/{3}/{4}/{5}", this.AssetType, this.MasterSha256Checksum, externalOwnerRef, this.FileExtension.ToLower(), this.BitRateKbps ?? 0, this.DurationMs ?? 0).ToLower());
            }

            default:
            {
                var message = String.Format("AssetType not supported: {0}-{1}-{2}", AssetType, FileExtension.ToLower(), MasterSha256Checksum);
                throw new Exception(message);
            }
            }
        }
        public static bool TryParse(string urnString, out Urn urn)
        {
            var fields = urnString.Split(':');

            if ((fields.Length == 3 || fields.Length == 4) && String.CompareOrdinal(fields[0], "urn") == 0)
            {
                if (fields.Length == 4)
                {
                    urn = new Urn(fields[1], fields[2], fields[3]);
                }
                else
                {
                    urn = new Urn(fields[1], fields[2]);
                }

                return(true);
            }

            urn = new Urn();
            return(false);
        }
 public bool Equals(Urn obj)
 {
     return(String.CompareOrdinal(obj.urnString, this.urnString) == 0);
 }