public static XGroup DeserializeXGroup(this byte[] xGroupBytes) { var xGroup = new XGroup(); var ser = PocoSerializer.GetDeserializer(xGroupBytes); // IID members xGroup.Id = ser.MakeString(0); // IPeerIdentity members xGroup.PeerIdentityType = (PeerIdentityType)ser.MakeInt32(1); xGroup.PrivateKey = ser.MakeByteArray(2); xGroup.PublicKey = ser.MakeByteArray(3); xGroup.PublicKeyHash = ser.MakeByteArray(4); xGroup.ShortId = ser.MakeString(5); // More local properties for management of the item xGroup.LocalName = ser.MakeString(6); xGroup.LocalImage = ser.MakeByteArray(7); xGroup.LocalCreatedDate = ser.MakeDateTime(8); xGroup.LocalModifiedDate = ser.MakeDateTime(9); xGroup.LocalContactState = (ContactState)ser.MakeByte(10); return(xGroup); }
public static byte[] SerializeXGroup(this XGroup xGroup) { byte[] serialized = PocoSerializer.Begin() // IID members .Append(xGroup.Id) // IPeerIdentity members .Append((int)xGroup.PeerIdentityType) .Append(xGroup.PrivateKey) .Append(xGroup.PublicKey) .Append(xGroup.PublicKeyHash) .Append(xGroup.ShortId) // More local properties for management of the item .Append(xGroup.LocalName) .Append(xGroup.LocalImage) .Append(xGroup.LocalCreatedDate) .Append(xGroup.LocalModifiedDate) .Append((byte)xGroup.LocalContactState) .Finish(); return(serialized); }