コード例 #1
0
ファイル: Serialization.cs プロジェクト: waffle-iron/nequeo
        /// <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));
        }
コード例 #2
0
ファイル: Serialization.cs プロジェクト: waffle-iron/nequeo
        /// <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));
        }
コード例 #3
0
ファイル: Serialization.cs プロジェクト: waffle-iron/nequeo
        /// <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));
        }
コード例 #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);
        }
コード例 #5
0
ファイル: Serialization.cs プロジェクト: waffle-iron/nequeo
        /// <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));
        }