Esempio n. 1
0
        public object DeserializeObject(XSerializerXmlReader reader, ISerializeOptions options)
        {
            if (ValueTypes.IsRegistered(typeof(T)))
            {
                while (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                }
            }

            if (reader.IsNil())
            {
                return(default(T));
            }

            var setIsDecryptionEnabledBackToFalse = reader.MaybeSetIsDecryptionEnabledToTrue(_encryptAttribute, options);

            var value = reader.ReadString();

            if (setIsDecryptionEnabledBackToFalse)
            {
                reader.IsDecryptionEnabled = false;
            }

            return(_valueConverter.ParseString(value, options));
        }
Esempio n. 2
0
        public object DeserializeObject(XSerializerXmlReader reader, ISerializeOptions options)
        {
            var setIsDecryptionEnabledBackToFalse = reader.MaybeSetIsDecryptionEnabledToTrue(_encryptAttribute, options);

            var value = _valueConverter.ParseString(reader.Value, options);

            if (setIsDecryptionEnabledBackToFalse)
            {
                reader.IsDecryptionEnabled = false;
            }

            return(value);
        }
Esempio n. 3
0
        public object ParseString(string value)
        {
            string plainTextValue;

            try
            {
                plainTextValue = _encryptionAlgorithm.Decrypt(value);
            }
            catch
            {
                plainTextValue = value;
            }

            return(_decoratedValueConverter.ParseString(plainTextValue));
        }