예제 #1
0
        /// <summary>
        /// Create the template code for the given object
        /// </summary>
        /// <param name="source">The object data</param>
        /// <returns>The template code</returns>
        public string CreateTemplateCode(T source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            return(Base64BinaryConverter.ConvertBitSetsToBase64(GetValues(source)));
        }
예제 #2
0
        /// <summary>
        /// Parse a template code and create a object from it
        /// </summary>
        /// <param name="templateCode">Template code to parse</param>
        /// <returns>The resulting object with data from the template</returns>
        public T ParseTemplateCode(string templateCode)
        {
            if (!Base64BinaryConverter.ValidateBase64String(templateCode))
            {
                return(default(T));
            }

            string binaryString = Base64BinaryConverter.GetBinaryString(templateCode);

            return(ParseBinary(new BinaryIterator(binaryString)));
        }
예제 #3
0
        public bool CanParseTemplateCode(string templateCode)
        {
            if (!Base64BinaryConverter.ValidateBase64String(templateCode))
            {
                return(false);
            }

            var binaryString = Base64BinaryConverter.GetBinaryString(templateCode);

            return(CanParseTemplateCodeImpl(new BinaryIterator(binaryString)));
        }
예제 #4
0
        /// <summary>
        /// Create the template code for the given object
        /// </summary>
        /// <param name="source">The object data</param>
        /// <returns>The template code</returns>
        public string CreateTemplateCode(T source)
        {
            Utility.ThrowIfNull(source, "source");

            return(Base64BinaryConverter.ConvertBitSetsToBase64(GetValues(source)));
        }