예제 #1
0
 public SpotifyURI(string uri)
 {
     try
     {
         Match regexpMatch = Regex.Match(uri, "spotify:(artist|album|track):([0-9A-Za-z]{22})");
         if (regexpMatch.Success)
         {
             string type = regexpMatch.Groups[1].Value;
             this._type = (SpotifyURIType)Enum.Parse(typeof(SpotifyURIType), type, true);
             this._id = regexpMatch.Groups[2].Value;
         }
         else
             throw new InvalidSpotifyURIException();
     }
     catch (Exception ex)
     {
         throw new InvalidSpotifyURIException(ex);
     }
 }
예제 #2
0
 public SpotifyURI(string uri)
 {
     try
     {
         Match regexpMatch = Regex.Match(uri, "spotify:(artist|album|track):([0-9A-Za-z]{22})");
         if (regexpMatch.Success)
         {
             string type = regexpMatch.Groups[1].Value;
             this._type = (SpotifyURIType)Enum.Parse(typeof(SpotifyURIType), type, true);
             this._id   = regexpMatch.Groups[2].Value;
         }
         else
         {
             throw new InvalidSpotifyURIException();
         }
     }
     catch (Exception ex)
     {
         throw new InvalidSpotifyURIException(ex);
     }
 }