First Implementation of SpotifyUri

Following JohnnyCrazy's directives.
This commit is contained in:
eltoncezar 2016-03-20 01:02:15 -03:00
parent a13aadc986
commit 1c5f6899eb
4 changed files with 29 additions and 5 deletions

View File

@ -13,5 +13,10 @@ namespace SpotifyAPI.Local.Models
[JsonProperty("location")] [JsonProperty("location")]
public TrackResourceLocation Location { get; set; } public TrackResourceLocation Location { get; set; }
public SpotifyUri ParseUri()
{
return new SpotifyUri(this.Uri);
}
} }
} }

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SpotifyAPI.Local.Models
{
public class SpotifyUri
{
public string Base { get; internal set; }
public string Type { get; internal set; }
public string Id { get; internal set; }
public SpotifyUri(string Uri)
{
string[] props = Uri.Split(':');
this.Base = props[0];
this.Type = props[1];
this.Id = props[2];
}
}
}

View File

@ -157,10 +157,5 @@ namespace SpotifyAPI.Local.Models
return wc.DownloadData(url); return wc.DownloadData(url);
} }
} }
public string GetId()
{
return this.TrackResource.Uri.Substring(14);
}
} }
} }

View File

@ -56,6 +56,7 @@
<Compile Include="Local\ExtendedWebClient.cs"> <Compile Include="Local\ExtendedWebClient.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Local\Models\SpotifyUri.cs" />
<Compile Include="Local\VolumeMixerControl.cs" /> <Compile Include="Local\VolumeMixerControl.cs" />
<Compile Include="Web\IClient.cs" /> <Compile Include="Web\IClient.cs" />
<Compile Include="Local\Models\CFID.cs" /> <Compile Include="Local\Models\CFID.cs" />