예제 #1
0
        /// <summary>
        /// Parses the response object.
        /// </summary>
        /// <param name="apiResponse">raw response from the GW2 Server</param>
        /// <returns>Parsed object</returns>
        public RenderServiceAssetEntry Parse(object apiResponse)
        {
            byte[] rawBytes = ParserResponseHelper.GetResponseRaw(apiResponse);
            var    bitmap   = new Bitmap(new MemoryStream(rawBytes));

            return(new RenderServiceAssetEntry
            {
                Asset = bitmap,
            });
        }
예제 #2
0
        public Task <RenderServiceAssetEntry> ParseAsync(object apiResponse)
        {
            byte[] rawBytes = ParserResponseHelper.GetResponseRaw(apiResponse);
            var    tsk      = new TaskCompletionSource <RenderServiceAssetEntry>();
            var    bitmap   = new Bitmap(new MemoryStream(rawBytes));

            tsk.TrySetResult(new RenderServiceAssetEntry
            {
                Asset = bitmap,
            });
            return(tsk.Task);
        }