// Data Transfer Methods private void sendAchievement(Achievement achv) { Response response = new Response(); response.achievementData = new AchievementData(); Bitmap background = (Bitmap)achv.GetBackground(); if (background != null && achv.ignoreDefaultBackground == true) { MemoryStream ms = new MemoryStream(); background.Save(ms, background.RawFormat); response.achievementData.Background = ms.GetBuffer(); } Bitmap icon = (Bitmap)achv.GetIcon(); if (icon != null) { MemoryStream ms = new MemoryStream(); icon.Save(ms, icon.RawFormat); response.achievementData.Icon = ms.GetBuffer(); } response.achievementData.Title = achv.GetLastTitle(); response.achievementData.Description = achv.GetLastDescription(); var result = JsonConvert.SerializeObject(response); foreach (WebSocketSession session in m_sessions) { session.Send(result); } }