Beispiel #1
0
 public static byte[] SerializeXIdentity(this XIdentity xIdentity)
 {
     byte[] serialized = PocoSerializer.Begin()
                         .Append(xIdentity.Id)
                         .Append(xIdentity.PublicIdentityKey)
                         .Append(xIdentity.FirstSeenUTC)
                         .Append(xIdentity.LastSeenUTC)
                         .Append((byte)xIdentity.ContactState)
                         .Finish();
     return(serialized);
 }
 public static byte[] SerializeCore(this XMessage m)
 {
     byte[] serialized = PocoSerializer.Begin()
                         .Append(m.Id)
                         .Append(m.MetaCipher)
                         .Append(m.TextCipher)
                         .Append(m.ImageCipher)
                         .Append(m.DynamicPublicKey)
                         .Append(m.DynamicPublicKeyId)
                         .Append(m.PrivateKeyHint)
                         .Append(m.IsDownloaded) // append this new Property at the end, to avoid breaking compatibility with older code/data
                         .Finish();
     return(serialized);
 }
Beispiel #3
0
        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);
        }