diff --git a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
index 68d08d3cdb..6cfa5ade55 100644
--- a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
@@ -1,13 +1,60 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Net;
+using MediaBrowser.Model.DTO;
+using System;
using System.IO;
+using System.Net;
namespace MediaBrowser.ApiInteraction.Portable
{
public class ApiClient : BaseApiClient
{
+ private HttpWebRequest GetNewRequest(string url)
+ {
+ return HttpWebRequest.CreateHttp(url);
+ }
+
+ ///
+ /// Gets all users
+ ///
+ public void GetAllUsersAsync(Action callback)
+ {
+ string url = ApiUrl + "/users";
+
+ GetDataAsync(url, callback);
+ }
+
+ private void GetDataAsync(string url, Action callback)
+ {
+ GetDataAsync(url, callback, SerializationFormat);
+ }
+
+ private void GetDataAsync(string url, Action callback, SerializationFormats serializationFormat)
+ {
+ if (url.IndexOf('?') == -1)
+ {
+ url += "?dataformat=" + serializationFormat.ToString();
+ }
+ else
+ {
+ url += "&dataformat=" + serializationFormat.ToString();
+ }
+
+ HttpWebRequest request = GetNewRequest(url);
+
+ request.BeginGetResponse(new AsyncCallback(result =>
+ {
+ T value;
+
+ using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
+ {
+ using (Stream stream = response.GetResponseStream())
+ {
+ value = DeserializeFromStream(stream);
+ }
+ }
+
+ callback(value);
+
+ }), request);
+ }
}
}
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs
index 55c30765d1..5de1750959 100644
--- a/MediaBrowser.ApiInteraction/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction/ApiClient.cs
@@ -1,13 +1,12 @@
-using System;
+using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.DTO;
+using MediaBrowser.Model.Weather;
+using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Weather;
namespace MediaBrowser.ApiInteraction
{
@@ -62,35 +61,6 @@ namespace MediaBrowser.ApiInteraction
}
}
- public void GetAllUsersAsync(Action callback)
- {
- string url = ApiUrl + "/users";
-
- HttpWebRequest request = HttpWebRequest.CreateHttp(url);
-
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- HttpWebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result) as HttpWebResponse;
-
- Stream stream = response.GetResponseStream();
-
- }), request);
- }
-
- public void GetData(string url, SerializationFormats serializationFormat, Action callback)
- {
- HttpWebRequest request = HttpWebRequest.CreateHttp(url);
- //request.AutomaticDecompression = DecompressionMethods.Deflate;
-
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- HttpWebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result) as HttpWebResponse;
-
- Stream stream = response.GetResponseStream();
-
- }), request);
- }
-
///
/// Gets all Genres
///
diff --git a/MediaBrowser.ApiInteraction/BaseApiClient.cs b/MediaBrowser.ApiInteraction/BaseApiClient.cs
index 805ba353a0..c218db0ae8 100644
--- a/MediaBrowser.ApiInteraction/BaseApiClient.cs
+++ b/MediaBrowser.ApiInteraction/BaseApiClient.cs
@@ -1,7 +1,7 @@
-using System;
-using System.IO;
-using MediaBrowser.Model.DTO;
+using MediaBrowser.Model.DTO;
using MediaBrowser.Model.Entities;
+using System;
+using System.IO;
namespace MediaBrowser.ApiInteraction
{
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index 7a37fc513c..6f9d636bb2 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -236,7 +236,7 @@ namespace MediaBrowser.Controller
user.Name = "Default User";
user.Id = Guid.Parse("5d1cf7fce25943b790d140095457a42b");
-
+ user.PrimaryImagePath = @"g:\Mel.jpg";
list.Add(user);
user = new User();
@@ -245,16 +245,19 @@ namespace MediaBrowser.Controller
user.LastLoginDate = DateTime.UtcNow.AddDays(-1);
user.LastActivityDate = DateTime.UtcNow.AddHours(-3);
user.Password = GetMD5("1234").ToString();
+ user.PrimaryImagePath = @"g:\abobader.jpg";
list.Add(user);
user = new User();
user.Name = "Scottisafool";
user.Id = Guid.NewGuid();
+ user.PrimaryImagePath = @"g:\Scott.jpg";
list.Add(user);
user = new User();
user.Name = "Redshirt";
user.Id = Guid.NewGuid();
+ user.PrimaryImagePath = @"g:\redshirt.png";
list.Add(user);
/*user = new User();
diff --git a/MediaBrowser.Model/DTO/DTOUser.cs b/MediaBrowser.Model/DTO/DTOUser.cs
index 06fcd0ae1d..aa066a3bd8 100644
--- a/MediaBrowser.Model/DTO/DTOUser.cs
+++ b/MediaBrowser.Model/DTO/DTOUser.cs
@@ -1,5 +1,5 @@
-using System;
-using ProtoBuf;
+using ProtoBuf;
+using System;
namespace MediaBrowser.Model.DTO
{
diff --git a/MediaBrowser.WebDashboard/Plugin.cs b/MediaBrowser.WebDashboard/Plugin.cs
index 3ee0e04a18..3317c7f16e 100644
--- a/MediaBrowser.WebDashboard/Plugin.cs
+++ b/MediaBrowser.WebDashboard/Plugin.cs
@@ -1,6 +1,6 @@
-using System.ComponentModel.Composition;
-using MediaBrowser.Common.Plugins;
+using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
+using System.ComponentModel.Composition;
namespace MediaBrowser.WebDashboard
{