From 304437b834e8c87687f68333ae67a13ee1377a73 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Wed, 12 Jun 2019 21:47:51 +0200 Subject: Adjust Codestyle --- dsa/FireBase/Http/HttpClientExtensions.cs | 24 ++++++++---------------- dsa/FireBase/Http/PostResult.cs | 6 ++---- 2 files changed, 10 insertions(+), 20 deletions(-) (limited to 'dsa/FireBase/Http') diff --git a/dsa/FireBase/Http/HttpClientExtensions.cs b/dsa/FireBase/Http/HttpClientExtensions.cs index 6582769..a4f1c11 100644 --- a/dsa/FireBase/Http/HttpClientExtensions.cs +++ b/dsa/FireBase/Http/HttpClientExtensions.cs @@ -7,13 +7,11 @@ using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; -namespace Firebase.Database.Http -{ +namespace Firebase.Database.Http { /// /// The http client extensions for object deserializations. /// - internal static class HttpClientExtensions - { + internal static class HttpClientExtensions { /// /// The get object collection async. /// @@ -24,13 +22,11 @@ namespace Firebase.Database.Http /// The . public static async Task>> GetObjectCollectionAsync( this HttpClient client, string requestUri, - JsonSerializerSettings jsonSerializerSettings) - { + JsonSerializerSettings jsonSerializerSettings) { var responseData = string.Empty; var statusCode = HttpStatusCode.OK; - try - { + try { var response = await client.GetAsync(requestUri).ConfigureAwait(false); statusCode = response.StatusCode; responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false); @@ -44,8 +40,7 @@ namespace Firebase.Database.Http return dictionary.Select(item => new FirebaseObject(item.Key, item.Value)).ToList(); } - catch (Exception ex) - { + catch (Exception ex) { throw new FirebaseException(requestUri, string.Empty, responseData, statusCode, ex); } } @@ -96,21 +91,18 @@ namespace Firebase.Database.Http /// The json data. /// The type of entities the collection should contain. /// The . - public static IEnumerable> GetObjectCollection(this string data, Type elementType) - { + public static IEnumerable> GetObjectCollection(this string data, Type elementType) { var dictionaryType = typeof(Dictionary<,>).MakeGenericType(typeof(string), elementType); IDictionary dictionary = null; - if (data.StartsWith("[")) - { + if (data.StartsWith("[")) { var listType = typeof(List<>).MakeGenericType(elementType); var list = JsonConvert.DeserializeObject(data, listType) as IList; dictionary = Activator.CreateInstance(dictionaryType) as IDictionary; var index = 0; foreach (var item in list) dictionary.Add(index++.ToString(), item); } - else - { + else { dictionary = JsonConvert.DeserializeObject(data, dictionaryType) as IDictionary; } diff --git a/dsa/FireBase/Http/PostResult.cs b/dsa/FireBase/Http/PostResult.cs index 15a4894..b6b8f09 100644 --- a/dsa/FireBase/Http/PostResult.cs +++ b/dsa/FireBase/Http/PostResult.cs @@ -1,10 +1,8 @@ -namespace Firebase.Database.Http -{ +namespace Firebase.Database.Http { /// /// Represents data returned after a successful POST to firebase server. /// - public class PostResult - { + public class PostResult { /// /// Gets or sets the generated key after a successful post. /// -- cgit v1.2.3-54-g00ecf