コード例 #1
0
 public static int ParseReleaseIdFromUri(string uri)
 {
     SimpleRegex regex = new SimpleRegex("^http://(www\\.)?discogs\\.com/.*release/(?<releaseId>[1-9][0-9]+?)(\\?.*)?$");
     GroupCollection collection = regex.Match(uri);
     if (collection == null)
     {
         return 0;
     }
     return int.Parse(collection["releaseId"].Value);
 }
コード例 #2
0
        public static int ParseReleaseIdFromUri(string uri)
        {
            SimpleRegex     regex      = new SimpleRegex("^http://(www\\.)?discogs\\.com/.*release/(?<releaseId>[1-9][0-9]+?)(\\?.*)?$");
            GroupCollection collection = regex.Match(uri);

            if (collection == null)
            {
                return(0);
            }
            return(int.Parse(collection["releaseId"].Value));
        }
コード例 #3
0
        public static string ParseArtistNameFromUri(string uri)
        {
            SimpleRegex regex = new SimpleRegex("^http://(www\\.)?discogs\\.com/artist/(?<artistName>.+?)(\\?.*)?$");
            GroupCollection collection = regex.Match(uri);
            if (collection == null)
            {
                return null;
            }

            string artistName = collection["artistName"].Value.Replace('+', ' ');
            return Uri.UnescapeDataString(artistName);
        }
コード例 #4
0
        public static string ParseArtistNameFromUri(string uri)
        {
            SimpleRegex     regex      = new SimpleRegex("^http://(www\\.)?discogs\\.com/artist/(?<artistName>.+?)(\\?.*)?$");
            GroupCollection collection = regex.Match(uri);

            if (collection == null)
            {
                return(null);
            }

            string artistName = collection["artistName"].Value.Replace('+', ' ');

            return(Uri.UnescapeDataString(artistName));
        }