Code tidying

- pressed a few buttons in ReSharper
This commit is contained in:
Rikki Tooley 2016-05-22 23:34:03 +01:00
parent bdec7c9a35
commit 60ea301d1f
51 changed files with 64 additions and 97 deletions

View File

@ -1,5 +1,4 @@
using System;
using System.Net.Http;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
@ -29,7 +28,7 @@ public override void SetParameters()
Parameters.Add("message", Message);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -46,7 +46,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<LastResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -35,7 +35,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -39,7 +39,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -47,7 +47,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -23,7 +23,7 @@ public override void SetParameters()
Parameters.Add("message", Message);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -41,7 +41,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<LastResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -35,7 +35,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
Parameters.Add("autocorrect", Convert.ToInt32(Autocorrect).ToString());
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -33,7 +33,7 @@ public override void SetParameters()
Parameters.Add("password", Password);
}
public async override Task<LastResponse<LastUserSession>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastUserSession>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -19,7 +19,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -19,7 +19,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -40,7 +40,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -2,10 +2,6 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace IF.Lastfm.Core.Api.Commands.Library {
[ApiMethodName("library.removeScrobble")]
@ -28,7 +24,7 @@ public override void SetParameters() {
Parameters.Add( "timestamp", Timestamp.AsUnixTime().ToString() );
}
public async override Task<LastResponse> HandleResponse( HttpResponseMessage response ) {
public override async Task<LastResponse> HandleResponse( HttpResponseMessage response ) {
return await LastResponse.HandleResponse( response );
}
}

View File

@ -20,7 +20,7 @@ public override void SetParameters() {
Parameters.Add( "track", Track );
}
public async override Task<LastResponse> HandleResponse( HttpResponseMessage response ) {
public override async Task<LastResponse> HandleResponse( HttpResponseMessage response ) {
return await LastResponse.HandleResponse( response );
}
}

View File

@ -26,7 +26,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<LastResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -26,7 +26,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
@ -29,7 +25,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
@ -12,12 +8,12 @@
namespace IF.Lastfm.Core.Api.Commands.Tag
{
[ApiMethodName("tag.getTopTracks")]
internal class GetTopTracksCommand: GetAsyncCommandBase<PageResponse<LastTrack>>
[ApiMethodName("tag.getTopArtists")]
internal class GetTopArtistsCommand : GetAsyncCommandBase<PageResponse<LastArtist>>
{
public string TagName { get; set; }
public GetTopTracksCommand(ILastAuth auth, string tagName) : base(auth)
public GetTopArtistsCommand(ILastAuth auth, string tagName) : base(auth)
{
TagName = tagName;
}
@ -29,7 +25,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();
@ -37,14 +33,14 @@ public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseM
if (LastFm.IsResponseValid(json, out status) && response.IsSuccessStatusCode)
{
var jtoken = JsonConvert.DeserializeObject<JToken>(json);
var resultsToken = jtoken.SelectToken("toptracks");
var itemsToken = resultsToken.SelectToken("track");
var resultsToken = jtoken.SelectToken("topartists");
var itemsToken = resultsToken.SelectToken("artist");
return PageResponse<LastTrack>.CreateSuccessResponse(itemsToken, resultsToken, LastTrack.ParseJToken, LastPageResultsType.Attr);
return PageResponse<LastArtist>.CreateSuccessResponse(itemsToken, resultsToken, LastArtist.ParseJToken, LastPageResultsType.Attr);
}
else
{
return LastResponse.CreateErrorResponse<PageResponse<LastTrack>>(status);
return LastResponse.CreateErrorResponse<PageResponse<LastArtist>>(status);
}
}
}

View File

@ -21,7 +21,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTag>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
@ -12,12 +8,12 @@
namespace IF.Lastfm.Core.Api.Commands.Tag
{
[ApiMethodName("tag.getTopArtists")]
internal class GetTopArtistsCommand: GetAsyncCommandBase<PageResponse<LastArtist>>
[ApiMethodName("tag.getTopTracks")]
internal class GetTopTracksCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public string TagName { get; set; }
public GetTopArtistsCommand(ILastAuth auth, string tagName) : base(auth)
public GetTopTracksCommand(ILastAuth auth, string tagName) : base(auth)
{
TagName = tagName;
}
@ -29,7 +25,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();
@ -37,15 +33,15 @@ public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponse
if (LastFm.IsResponseValid(json, out status) && response.IsSuccessStatusCode)
{
var jtoken = JsonConvert.DeserializeObject<JToken>(json);
var resultsToken = jtoken.SelectToken("topartists");
var itemsToken = resultsToken.SelectToken("artist");
var resultsToken = jtoken.SelectToken("toptracks");
var itemsToken = resultsToken.SelectToken("track");
return PageResponse<LastArtist>.CreateSuccessResponse(itemsToken, resultsToken, LastArtist.ParseJToken, LastPageResultsType.Attr);
return PageResponse<LastTrack>.CreateSuccessResponse(itemsToken, resultsToken, LastTrack.ParseJToken, LastPageResultsType.Attr);
}
else
{
return LastResponse.CreateErrorResponse<PageResponse<LastArtist>>(status);
return LastResponse.CreateErrorResponse<PageResponse<LastTrack>>(status);
}
}
}
}
}

View File

@ -28,7 +28,7 @@ public override void SetParameters()
Parameters.Add("message", Message);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -44,7 +44,7 @@ public override void SetParameters()
}
}
public async override Task<LastResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -35,7 +35,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -42,7 +42,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -24,7 +24,7 @@ public override void SetParameters()
Parameters.Add("artist", ArtistName);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
@ -51,7 +50,7 @@ public override void SetParameters()
}
}
public async override Task<ScrobbleResponse> HandleResponse(HttpResponseMessage response)
public override async Task<ScrobbleResponse> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -27,7 +27,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -24,7 +24,7 @@ public override void SetParameters()
Parameters.Add("artist", ArtistName);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -1,7 +1,6 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;

View File

@ -24,7 +24,7 @@ public override void SetParameters()
Parameters.Add("message", Message);
}
public async override Task<LastResponse> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}

View File

@ -25,7 +25,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<LastResponse<LastUser>> HandleResponse(HttpResponseMessage response)
public override async Task<LastResponse<LastUser>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -26,7 +26,7 @@ public override void SetParameters()
AddPagingParameters();
}
public async override Task<PageResponse<LastStation>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastStation>> HandleResponse(HttpResponseMessage response)
{
string json = await response.Content.ReadAsStringAsync();

View File

@ -34,7 +34,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastTrack>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -18,7 +18,7 @@ public override void SetParameters()
AddPagingParameters();
}
public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -26,7 +26,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastShout>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -28,7 +28,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastAlbum>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -30,7 +30,7 @@ public override void SetParameters()
DisableCaching();
}
public async override Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
public override async Task<PageResponse<LastArtist>> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

View File

@ -44,7 +44,7 @@ public static LastResponse CreateSuccessResponse()
return r;
}
public async static Task<LastResponse> HandleResponse(HttpResponseMessage response)
public static async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
var json = await response.Content.ReadAsStringAsync();

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;

View File

@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;

View File

@ -24,7 +24,7 @@ public void Enqueue(HttpResponseMessage message)
_queuedResponses.Enqueue(message);
}
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
Sent.Add(Tuple.Create(request, await request.Content.ReadAsStringAsync()));
var response = _queuedResponses.Dequeue()

View File

@ -1,6 +1,5 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace IF.Lastfm.Core.Json
{

View File

@ -7,7 +7,6 @@
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text;
using IF.Lastfm.Core.Api.Commands;
[assembly: InternalsVisibleTo("IF.Lastfm.Core.Tests")]
[assembly: InternalsVisibleTo("IF.Lastfm.Core.Tests.Integration")]

View File

@ -1,7 +1,5 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information