public Resolve ( Stream stream ) : |
||
stream | Stream | |
리턴 |
public void ResolveTest() { var resolver = new UserIdAndPlatformResolver(); resolver.Resolve(new MemoryStream(Encoding.UTF8.GetBytes(_dogtagsBlock))); resolver.Resolve(new MemoryStream(Encoding.UTF8.GetBytes(_unlocksBlock))); resolver.Resolve(new MemoryStream(Encoding.UTF8.GetBytes(_unknownBlock))); }
public async Task<BattlelogUser> ResolveUserIdAndPlatform(string url, UserIdAndPlatformResolver userIdAndPlatformResolver) { BattlelogUser user = null; var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; if (request == null) throw new ArgumentNullException(); request.Method = Common.HttpGetMethod; request.Accept = Common.HttpAccept; request.UserAgent = Common.HttpUserAgent; request.CookieContainer = CookieJar; var task = request.GetResponseAsync(); try { var response = (HttpWebResponse) await task.ConfigureAwait(false); var responseStream = response.GetResponseStream(); user = userIdAndPlatformResolver.Resolve(responseStream); response.Close(); } catch (WebException we) { Messenger.Default.Send(new NotificationMessage(this, we.Message)); } return user; }