diff --git a/src/Exact Types/MultiplayerSummary.cs b/src/Exact Types/MultiplayerSummary.cs new file mode 100644 index 0000000..b5e4d38 --- /dev/null +++ b/src/Exact Types/MultiplayerSummary.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class MultiplayerSummary + { + public bool InMultiplayerSession { get; set; } + public bool InParty { get; set; } + + public static MultiplayerSummary DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static MultiplayerSummary DeserializeJSON(JToken token) + { + MultiplayerSummary c = new MultiplayerSummary() + { + InMultiplayerSession = ((int)token.SelectToken("InMultiplayerSession") > 0), + InParty = ((int)token.SelectToken("InParty") > 0) + }; + return c; + } + } +} diff --git a/src/Exact Types/Person.cs b/src/Exact Types/Person.cs new file mode 100644 index 0000000..30fcab5 --- /dev/null +++ b/src/Exact Types/Person.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Person + { + public string xuid { get; set; } + public bool isFavorite { get; set; } + public bool isFollowingCaller { get; set; } + public bool isFollowedByCaller { get; set; } + public bool isIdentityShared { get; set; } + public string addedDateTimeUtc { get; set; } + public string displayName { get; set; } + public string realName { get; set; } + public string displayPicRaw { get; set; } + public bool useAvatar { get; set; } + public string gamertag { get; set; } + public string gamerScore { get; set; } + public string xboxOneRep { get; set; } + public string presenceState { get; set; } + public string presenceText { get; set; } + public string presenceDevices { get; set; } + public bool isBroadcasting { get; set; } + public bool? isCloaked { get; set; } + public bool isQuarantined { get; set; } + public object suggestion { get; set; } + public object recommendation { get; set; } + public object titleHistory { get; set; } + public MultiplayerSummary multiplayerSummary { get; set; } + public object recentPlayer { get; set; } + public object follower { get; set; } + public PreferredColor preferredColor { get; set; } + public object presenceDetails { get; set; } + public object titlePresence { get; set; } + public object titleSummaries { get; set; } + public object presenceTitleIds { get; set; } + public object detail { get; set; } + public object communityManagerTitles { get; set; } + public SocialManager socialManager { get; set; } + public object[] broadcast { get; set; } + public object tournamentSummary { get; set; } + public object avatar { get; set; } + + public static Person DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static Person DeserializeJSON(JToken token) + { + Person p = new Person() + { + xuid = (string)token.SelectToken("xuid"), + isFavorite = (bool)token.SelectToken("isFavorite"), + isFollowingCaller = (bool)token.SelectToken("isFollowingCaller"), + isFollowedByCaller = (bool)token.SelectToken("isFollowedByCaller"), + isIdentityShared = (bool)token.SelectToken("isIdentityShared"), + addedDateTimeUtc = (string)token.SelectToken("addedDateTimeUtc"), + displayName = (string)token.SelectToken("displayName"), + realName = (string)token.SelectToken("realName"), + displayPicRaw = (string)token.SelectToken("displayPicRaw"), + gamertag = (string)token.SelectToken("gamertag"), + gamerScore = (string)token.SelectToken("gamerScore"), + xboxOneRep = (string)token.SelectToken("xboxOneRep"), + presenceState = (string)token.SelectToken("presenceState"), + presenceText = (string)token.SelectToken("presenceText"), + multiplayerSummary = MultiplayerSummary.DeserializeJSON(token.SelectToken("multiplayerSummary")), + preferredColor = PreferredColor.DeserializeJSON(token.SelectToken("preferredColor")) + }; + return p; + } + } +} diff --git a/src/Exact Types/PreferredColor.cs b/src/Exact Types/PreferredColor.cs new file mode 100644 index 0000000..588c72b --- /dev/null +++ b/src/Exact Types/PreferredColor.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class PreferredColor + { + public string PrimaryColor { get; set; } + public string SecondaryColor { get; set; } + public string TertiaryColor { get; set; } + + public static PreferredColor DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static PreferredColor DeserializeJSON(JToken token) + { + PreferredColor c = new PreferredColor() + { + PrimaryColor = (string)token.SelectToken("primaryColor"), + SecondaryColor = (string)token.SelectToken("secondaryColor"), + TertiaryColor = (string)token.SelectToken("tertiaryColor") + }; + return c; + } + } +} diff --git a/src/Exact Types/ProfileUser.cs b/src/Exact Types/ProfileUser.cs new file mode 100644 index 0000000..f5842e3 --- /dev/null +++ b/src/Exact Types/ProfileUser.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class ProfileUser + { + public string id { get; set; } + public string hostId { get; set; } + public Setting[] settings { get; set; } + public bool isSponsoredUser { get; set; } + + public static ProfileUser DeserializeJSON(string JSON) + { + JToken token = JObject.Parse(JSON); + token = token.First.First.First; + + ProfileUser u = new ProfileUser() + { + id = (string)token.SelectToken("id"), + hostId = (string)token.SelectToken("hostId"), + isSponsoredUser = (bool)token.SelectToken("isSponsoredUser") + }; + + u.settings = Setting.DeserializeJSON(token.SelectToken("settings")); + + return u; + } + } +} diff --git a/src/Exact Types/Setting.cs b/src/Exact Types/Setting.cs new file mode 100644 index 0000000..5606895 --- /dev/null +++ b/src/Exact Types/Setting.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Setting + { + public string id { get; set; } + public string value { get; set; } + + public static Setting[] DeserializeJSON(JToken token) + { + //JToken token = JObject.Parse(JSON); + List settings = new List(); + //Setting[] settings = new Setting[token.Children().Count()]; + foreach (JToken t in token.Children()) + { + settings.Add( + new Setting() + { + id = (string)t.SelectToken("id"), + value = (string)t.SelectToken("value") + }); + } + return settings.ToArray(); + } + } +} diff --git a/src/Exact Types/SocialManager.cs b/src/Exact Types/SocialManager.cs new file mode 100644 index 0000000..52c1563 --- /dev/null +++ b/src/Exact Types/SocialManager.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class SocialManager + { + public object[] titleIds { get; set; } + public object[] pages { get; set; } + } +} diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9d9f82c --- /dev/null +++ b/src/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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 +// associated with an assembly. +[assembly: AssemblyTitle("Kalakoi.Xbox.OpenXBL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Kalakoi.Xbox.OpenXBL")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c1a3c6a1-4817-42c7-986a-2f51f223cfea")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/REST/RestServices.cs b/src/REST/RestServices.cs new file mode 100644 index 0000000..d32b33f --- /dev/null +++ b/src/REST/RestServices.cs @@ -0,0 +1,152 @@ +using System; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; + +namespace Kalakoi.Xbox.OpenXBL +{ + /// + /// Provides easy access to GET and POST functionality for REST services. + /// + internal static class RestServices + { + /// + /// Sends GET request to REST service and returns response asynchronously. + /// + /// Address to send request to. + /// API key to use with the request. + /// JSON data as string. + internal static async Task GetResponseAsync(Uri uri, string APIKey) + { + //Create client to send GET request + using (HttpClient client = new HttpClient()) + { + //Add request headers + client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome / 58.0.3029.110 Safari / 537.36"); + client.DefaultRequestHeaders.Add("X-Authorization", APIKey); + //Send request and await response + string response = await client.GetStringAsync(uri).ConfigureAwait(false); + return response; + } + } + + /// + /// Sends GET request to REST service and returns response asynchronously. + /// + /// Address to send request to. + /// JSON data as string. + internal static async Task GetResponseAsync(Uri uri) + { + //Create client to send GET request + using (HttpClient client = new HttpClient()) + { + //Add request headers + client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome / 58.0.3029.110 Safari / 537.36"); + //Send request and await response + string response = await client.GetStringAsync(uri).ConfigureAwait(false); + return response; + } + } + + /// + /// Sends GET request to REST service and returns response. + /// + /// Address to send request to. + /// API key to use with the request. + /// JSON data as string. + internal static string GetResponse(Uri uri, string APIKey) + { + //Create client to send GET request + using (WebClient client = new WebClient()) + { + //Add request headers + client.Headers.Add(string.Format("X-Authorization: {0}", APIKey)); + client.Headers.Add(HttpRequestHeader.Accept, "application/json"); + client.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-US"); + //Send request and await response + using (Stream ReqStream = client.OpenRead(uri)) + using (StreamReader Reader = new StreamReader(ReqStream)) + { + string response = Reader.ReadToEnd(); + return response; + } + } + } + + /// + /// Sends GET request to REST service and returns response. + /// + /// Address to send request to. + /// JSON data as string. + internal static string GetResponse(Uri uri) + { + //Create client to send GET request + using (WebClient client = new WebClient()) + { + //Add request headers + client.Headers.Add(HttpRequestHeader.Accept, "application/json"); + client.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-US"); + //Send request and await response + using (Stream ReqStream = client.OpenRead(uri)) + using (StreamReader Reader = new StreamReader(ReqStream)) + { + string response = Reader.ReadToEnd(); + return response; + } + } + } + + /// + /// Sends POST request to REST service with JSON data and returns response asynchronously. + /// + /// Web address to send request. + /// JSON data to send with request. + /// API key to use with the request. + /// JSON data as string. + internal static async Task GetPostResponseAsync(Uri uri, string Data, string APIKey) + { + //Create Client to send and receive data from REST service + using (HttpClient client = new HttpClient()) + { + //Add headers for request + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome / 58.0.3029.110 Safari / 537.36"); + client.DefaultRequestHeaders.Add("X-Authorization", APIKey); + client.DefaultRequestHeaders.Host = uri.Host; + //Create content to send from JSON string + HttpContent content = new StringContent(Data, Encoding.UTF8, @"application/json"); + //Send POST request and await response + HttpResponseMessage response = await client.PostAsync(uri, content).ConfigureAwait(false); + response.EnsureSuccessStatusCode(); + //Return response JSON as string + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + } + + /// + /// Sends POST request to REST service with JSON data and returns response. + /// + /// Web address to send request. + /// JSON data to send with request. + /// API key to use with the request. + /// JSON data as string. + internal static string GetPostResponse(Uri uri, string Data, string APIKey) + { + //Create client to send POST request + using (WebClient client = new WebClient()) + { + //Add request headers + client.Headers.Add(string.Format("X-Authorization: {0}", APIKey)); + client.Headers.Add(HttpRequestHeader.Accept, "application/json"); + client.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-US"); + client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); + //Send POST request and await response + string response = client.UploadString(uri, Data); + return response; + } + } + } +} diff --git a/src/Readable Types/Alert.cs b/src/Readable Types/Alert.cs new file mode 100644 index 0000000..a488e43 --- /dev/null +++ b/src/Readable Types/Alert.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Alert + { + public string ID { get; set; } + public string Action { get; set; } + public string Path { get; set; } + public string ActorXuid { get; set; } + public string ActorGamertag { get; set; } + public string ParentType { get; set; } + public string ParentPath { get; set; } + public string OwnerXuid { get; set; } + public string OwnerGamertag { get; set; } + public DateTime Timestamp { get; set; } + public bool Seen { get; set; } + public string RootPath { get; set; } + + public static Alert DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static Alert DeserializeJSON(JToken Token) + { + if (Token == null || !Token.HasValues) return new Alert(); + Alert a = new Alert() + { + ID = (string)Token.SelectToken("id"), + Action = (string)Token.SelectToken("action"), + Path = (string)Token.SelectToken("path"), + ActorXuid = (string)Token.SelectToken("actorXuid"), + ActorGamertag = (string)Token.SelectToken("actorGamertag"), + ParentType = (string)Token.SelectToken("parentType"), + ParentPath = (string)Token.SelectToken("parentPath"), + OwnerXuid = (string)Token.SelectToken("ownerXuid"), + OwnerGamertag = (string)Token.SelectToken("ownerGamertag"), + Timestamp = (DateTime)Token.SelectToken("timestamp"), + Seen = (bool)Token.SelectToken("seen"), + RootPath = (string)Token.SelectToken("rootPath") + }; + return a; + } + } +} diff --git a/src/Readable Types/Conversation.cs b/src/Readable Types/Conversation.cs new file mode 100644 index 0000000..ce908a3 --- /dev/null +++ b/src/Readable Types/Conversation.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Conversation + { + public ConversationSummary Summary { get; set; } + public List Messages { get; set; } + + public static Conversation DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static Conversation DeserializeJSON(JToken Token) + { + Conversation c = new Conversation() + { + Summary = ConversationSummary.DeserializeJSON(Token.SelectToken("conversation").SelectToken("summary")), + Messages = new List() + }; + foreach (JToken t in Token.First.First.SelectToken("messages").Children()) + c.Messages.Add(Message.DeserializeJSON(t)); + return c; + } + } +} diff --git a/src/Readable Types/ConversationSummary.cs b/src/Readable Types/ConversationSummary.cs new file mode 100644 index 0000000..c368d0d --- /dev/null +++ b/src/Readable Types/ConversationSummary.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class ConversationSummary + { + public long SenderXUID { get; set; } + public string SenderGamertag { get; set; } + public DateTime LastUpdated { get; set; } + public DateTime LastSent { get; set; } + public int MessageCount { get; set; } + public int UnreadMessageCount { get; set; } + public Message LastMessage { get; set; } + + public static ConversationSummary DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + + public static ConversationSummary DeserializeJSON(JToken Token) + { + ConversationSummary c = new ConversationSummary() + { + SenderXUID = (long)Token.SelectToken("senderXuid"), + SenderGamertag = (string)Token.SelectToken("senderGamerTag"), + LastUpdated = (DateTime)Token.SelectToken("lastUpdated"), + LastSent = (DateTime)Token.SelectToken("lastSent"), + MessageCount = (int)Token.SelectToken("messageCount"), + UnreadMessageCount = (int)Token.SelectToken("unreadMessageCount"), + LastMessage = Message.DeserializeJSON(Token.SelectToken("lastMessage")) + }; + return c; + } + } +} diff --git a/src/Readable Types/Friend.cs b/src/Readable Types/Friend.cs new file mode 100644 index 0000000..a1d383f --- /dev/null +++ b/src/Readable Types/Friend.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Friend + { + public string xuid { get; set; } + public bool Favorite { get; set; } + public bool IsFriend { get; set; } + public bool IsFollower { get; set; } + public bool SharedIdentity { get; set; } + public DateTime DateAdded { get; set; } + public string DisplayName { get; set; } + public string RealName { get; set; } + public Uri ProfilePicture { get; set; } + public string Gamertag { get; set; } + public int Gamerscore { get; set; } + public string Reputation { get; set; } + public string PresenceState { get; set; } + public string PresenceText { get; set; } + public MultiplayerSummary Summary { get; set; } + public PreferredColor Color { get; set; } + + public Friend(string JSON) : this(Person.DeserializeJSON(JSON)) { } + + public Friend(Person person) + { + xuid = person.xuid; + Favorite = person.isFavorite; + IsFriend = person.isFollowedByCaller; + IsFollower = person.isFollowingCaller; + SharedIdentity = person.isIdentityShared; + DateAdded = Convert.ToDateTime(person.addedDateTimeUtc); + DisplayName = person.displayName; + RealName = person.realName; + ProfilePicture = new Uri(person.displayPicRaw); + Gamertag = person.gamertag; + Gamerscore = Convert.ToInt32(person.gamerScore); + Reputation = person.xboxOneRep; + PresenceState = person.presenceState; + PresenceText = person.presenceText; + Summary = person.multiplayerSummary; + Color = person.preferredColor; + } + + public static async Task> GetFriendsAsync() => await XboxConnection.GetFriendsAsync().ConfigureAwait(false); + + public static List GetFriends() => new List(XboxConnection.GetFriends()); + } +} diff --git a/src/Readable Types/Message.cs b/src/Readable Types/Message.cs new file mode 100644 index 0000000..1113e52 --- /dev/null +++ b/src/Readable Types/Message.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class Message + { + public int MessageID { get; set; } + public int SenderTitleID { get; set; } + public long SenderXUID { get; set; } + public string SenderGamertag { get; set; } + public DateTime SentTime { get; set; } + public string MessageType { get; set; } + public string MessageFolder { get; set; } + public bool Read { get; set; } + public bool HasPhoto { get; set; } + public bool HasAudio { get; set; } + public string Text { get; set; } + + public static Message DeserializeJSON(string JSON) => DeserializeJSON(JObject.Parse(JSON)); + public static Message DeserializeJSON(JToken Token) + { + if (Token == null || !Token.HasValues) return new Message(); + Message m = new Message() + { + MessageID = (int)Token.SelectToken("messageId"), + SenderTitleID = (int)Token.SelectToken("senderTitleId"), + SenderXUID = (long)Token.SelectToken("senderXuid"), + SenderGamertag = (string)Token.SelectToken("senderGamerTag"), + SentTime = (DateTime)Token.SelectToken("sentTime"), + MessageType = (string)Token.SelectToken("messageType"), + MessageFolder = (string)Token.SelectToken("messageFolder"), + Read = (bool)Token.SelectToken("isRead"), + HasPhoto = (bool)Token.SelectToken("hasPhoto"), + HasAudio = (bool)Token.SelectToken("hasAudio"), + Text = (string)Token.SelectToken("messageText") + }; + return m; + } + } +} diff --git a/src/Readable Types/XboxProfile.cs b/src/Readable Types/XboxProfile.cs new file mode 100644 index 0000000..43b1ddb --- /dev/null +++ b/src/Readable Types/XboxProfile.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kalakoi.Xbox.OpenXBL +{ + public class XboxProfile + { + public long ID { get; set; } + public long HostID { get; set; } + public Uri GamerPic { get; set; } + public int Gamerscore { get; set; } + public string Gamertag { get; set; } + public string AccountTier { get; set; } + public string Reputation { get; set; } + public PreferredColor PreferredColor { get; set; } + public string RealName { get; set; } + public string Bio { get; set; } + public string Location { get; set; } + //public bool SponsoredUser { get; set; } + + public XboxProfile(string JSON) : this(ProfileUser.DeserializeJSON(JSON)) { } + public XboxProfile(ProfileUser User) + { + ID = Convert.ToInt64(User.id); + HostID = Convert.ToInt64(User.hostId); + //SponsoredUser = User.isSponsoredUser; + foreach (Setting s in User.settings) + { + switch (s.id) + { + case "GameDisplayPicRaw": + GamerPic = new Uri(s.value); + break; + case "Gamerscore": + Gamerscore = Convert.ToInt32(s.value); + break; + case "Gamertag": + Gamertag = s.value; + break; + case "AccountTier": + AccountTier = s.value; + break; + case "XboxOneRep": + Reputation = s.value; + break; + case "PreferredColor": + string ColorJSON = RestServices.GetResponse(new Uri(s.value)); + PreferredColor = PreferredColor.DeserializeJSON(ColorJSON); + break; + case "RealName": + RealName = s.value; + break; + case "Bio": + Bio = s.value; + break; + case "Location": + Location = s.value; + break; + default: + break; + } + } + } + + public static async Task GetProfileAsync() => await XboxConnection.GetProfileAsync().ConfigureAwait(false); + public static async Task GetProfileAsync(string Gamertag) => await XboxConnection.GetProfileAsync(Gamertag).ConfigureAwait(false); + public static XboxProfile GetProfile() => XboxConnection.GetProfile(); + public static XboxProfile GetProfile(string Gamertag) => XboxConnection.GetProfile(Gamertag); + } +}