public override UberstrikeUserView OnGetMember(string authToken) { // Get loaded member in memory using the auth token. var member = Context.Users.GetMember(authToken); if (member == null) { Log.Error("An unidentified AuthToken was passed."); return(null); } var view = new UberstrikeUserView { CmuneMemberView = member, UberstrikeMemberView = new UberstrikeMemberView { PlayerStatisticsView = new PlayerStatisticsView { Cmid = member.PublicProfile.Cmid, PersonalRecord = new PlayerPersonalRecordStatisticsView(), WeaponStatistics = new PlayerWeaponStatisticsView() } } }; return(view); }
public static void Serialize(Stream stream, UberstrikeUserView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.CmuneMemberView != null) { MemberViewProxy.Serialize(bytes, instance.CmuneMemberView); } else { mask |= 1; } if (instance.UberstrikeMemberView != null) { UberstrikeMemberViewProxy.Serialize(bytes, instance.UberstrikeMemberView); } else { mask |= 2; } Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public static UberstrikeUserView Deserialize(Stream bytes) { int mask = Int32Proxy.Deserialize(bytes); var view = new UberstrikeUserView(); if ((mask & 1) != 0) { view.CmuneMemberView = MemberViewProxy.Deserialize(bytes); } if ((mask & 2) != 0) { view.UberstrikeMemberView = UberstrikeMemberViewProxy.Deserialize(bytes); } return(view); }