コード例 #1
0
        public SerializeResult TrySerialize(IDictionary <string, object> data, EncryptionParameters encryption = null)
        {
            var result = new SerializeResult();

            switch (encryption)
            {
            case PasswordParameters p:
                result = SerializePasswordBlock(data, p);
                break;

            case PublicKeyParameters p:
                result = SerializePublicKeyHashBlock(data, p);
                break;

            default:
                result = SerializePlainDataBlock(data, true);
                break;
            }

            if (result.Status == SaveStatus.Success)
            {
                result.Data = compressor.Compress(result.Data);
            }

            return(result);
        }
コード例 #2
0
 public byte[] Serialize <T>(T obj)
 {
     return(_compressor.Compress(_serializer.Serialize(obj)));
 }