public static object Deserialize(byte[] bytes) { CT_PlayerSummary customObject = new CT_PlayerSummary(); using (var s = new MemoryStream(bytes)) { using (var br = new BinaryReader(s)) { customObject.actor = br.ReadString(); customObject.imageURL = br.ReadString(); customObject.isRule = br.ReadBoolean(); customObject.winAllPlayer = br.ReadBoolean(); customObject.loseAllPlayer = br.ReadBoolean(); customObject.pointTotal = br.ReadInt32(); customObject.currencyAmount = br.ReadInt64(); customObject.gameCurrency = br.ReadByte(); } } return(customObject); }
public static byte[] Serialize(object o) { CT_PlayerSummary customType = o as CT_PlayerSummary; if (customType == null) { return(null); } using (var s = new MemoryStream()) { using (var bw = new BinaryWriter(s)) { bw.Write(customType.actor); bw.Write(customType.imageURL); bw.Write(customType.isRule); bw.Write(customType.winAllPlayer); bw.Write(customType.loseAllPlayer); bw.Write(customType.pointTotal); bw.Write(customType.currencyAmount); bw.Write(customType.gameCurrency); return(s.ToArray()); } } }