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 XMessage DeserializeMessage(this byte[] message) { var m = new XMessage(); var ser = PocoSerializer.GetDeserializer(message); m.Id = ser.MakeString(0); m.MetaCipher = ser.MakeByteArray(1); m.TextCipher = ser.MakeByteArray(2); m.ImageCipher = ser.MakeByteArray(3); m.DynamicPublicKey = ser.MakeByteArray(4); m.DynamicPublicKeyId = ser.MakeInt64(5); m.PrivateKeyHint = ser.MakeInt64(6); try { m.IsDownloaded = ser.MakeBoolean(7); // backwards compat } catch { m.IsDownloaded = false; } m.SerializedPayload = message; return(m); }
public static XIdentity DeserializeXIdentityCore(this byte[] messagePart) { var xIdentity = new XIdentity(); var ser = PocoSerializer.GetDeserializer(messagePart); xIdentity.Id = ser.MakeString(0); xIdentity.PublicIdentityKey = ser.MakeByteArray(1); xIdentity.FirstSeenUTC = ser.MakeDateTime(2); xIdentity.LastSeenUTC = ser.MakeDateTime(3); xIdentity.ContactState = (ContactState)ser.MakeByte(4); return(xIdentity); }