예제 #1
0
        /// <summary>
        /// Deserializes the configuration for the header field.
        /// </summary>
        /// <param name="configuration">
        /// The serialized configuration.
        /// </param>
        /// <returns>
        /// The deserialized configuration.
        /// </returns>
        public object DeserializeConfiguration(string configuration)
        {
            // Variables.
            var config = new HeaderConfiguration()
            {
                Text = null
            };
            var configData = JsonHelper.Deserialize<JObject>(configuration);
            var dynamicConfig = configData as dynamic;
            var properties = configData.Properties().Select(x => x.Name);
            var propertySet = new HashSet<string>(properties);

            // Text value exists?
            if (propertySet.Contains("text"))
            {
                config.Text = dynamicConfig.text.Value as string;
            }

            // Return the configuration.
            return config;
        }
예제 #2
0
        /// <summary>
        /// Deserializes the configuration for the header field.
        /// </summary>
        /// <param name="configuration">
        /// The serialized configuration.
        /// </param>
        /// <returns>
        /// The deserialized configuration.
        /// </returns>
        public object DeserializeConfiguration(string configuration)
        {
            // Variables.
            var config = new HeaderConfiguration()
            {
                Text = null
            };
            var configData    = JsonHelper.Deserialize <JObject>(configuration);
            var dynamicConfig = configData as dynamic;
            var properties    = configData.Properties().Select(x => x.Name);
            var propertySet   = new HashSet <string>(properties);


            // Text value exists?
            if (propertySet.Contains("text"))
            {
                config.Text = dynamicConfig.text.Value as string;
            }


            // Return the configuration.
            return(config);
        }