Esempio n. 1
0
        /// <summary>
        /// Deserialise the current object type.
        /// </summary>
        /// <typeparam name="T">The type to examine.</typeparam>
        /// <param name="source">The current source object type.</param>
        /// <returns>The deserialised obejct type.</returns>
        public static T DeserialiseXml <T>(this string source)
        {
            GenericSerialisation <T> seril = new GenericSerialisation <T>();

            byte[] xml = Encoding.Default.GetBytes(source);
            return(seril.Deserialise(xml));
        }
Esempio n. 2
0
        /// <summary>
        /// Deserialise the current object type.
        /// </summary>
        /// <typeparam name="T">The type to examine.</typeparam>
        /// <param name="source">The current source object type.</param>
        /// <returns>The deserialised obejct type.</returns>
        public static T DeserialiseDataEntity <T>(this byte[] source)
            where T : class, new()
        {
            GenericSerialisation <T> seril = new GenericSerialisation <T>();

            return(seril.Deserialise(source));
        }
Esempio n. 3
0
        /// <summary>
        /// Deserialise the current object type.
        /// </summary>
        /// <typeparam name="T">The type to examine.</typeparam>
        /// <param name="source">The current source object type.</param>
        /// <returns>The deserialised obejct type.</returns>
        public static T DeserialiseDataEntity <T>(this string source)
            where T : class, new()
        {
            GenericSerialisation <T> seril = new GenericSerialisation <T>();

            byte[] xml = Encoding.Default.GetBytes(source);
            return(seril.Deserialise(xml));
        }
Esempio n. 4
0
        /// <summary>
        /// Get the current SHA1 hashcode for the data type
        /// </summary>
        /// <typeparam name="TData">The data type to examine</typeparam>
        /// <param name="data">The data to get the hash code for.</param>
        /// <returns>The hash code for the data.</returns>
        public static string GetHashCode <TData>(TData data)
        {
            GenericSerialisation <TData> serialise = new GenericSerialisation <TData>();
            string xml      = System.Text.Encoding.UTF8.GetString(serialise.Serialise(data));
            string hashCode = Nequeo.Cryptography.Hashcode.GetHashcodeSHA1(xml);

            return(hashCode);
        }
Esempio n. 5
0
        /// <summary>
        /// Deserialise the current object type.
        /// </summary>
        /// <typeparam name="T">The type to examine.</typeparam>
        /// <param name="source">The current source object type.</param>
        /// <returns>The deserialised obejct type.</returns>
        public static T DeserialiseXml <T>(this byte[] source)
        {
            GenericSerialisation <T> seril = new GenericSerialisation <T>();

            return(seril.Deserialise(source));
        }