예제 #1
0
        /// <summary>
        /// Deserializes an object from a textual KeyValues representation.
        /// </summary>
        /// <param name="text">The text to deserialize.</param>
        /// <param name="options">Options to use that can influence the deserialization process.</param>
        /// <returns>A <see cref="KVObject"/> representing the KeyValues structure in the stream.</returns>
        public static KVObject Deserialize(string text, KVSerializerOptions options = null)
        {
            Require.NotNull(text, nameof(text));

            using (var reader = new KVTextReader(new StringReader(text), options ?? KVSerializerOptions.DefaultOptions))
            {
                return(reader.ReadObject());
            }
        }
예제 #2
0
        void HandleIncludeAndAppend(string filePath)
        {
            KVObject includedKeyValues;

            using (var stream = OpenFileForInclude(filePath))
                using (var reader = new KVTextReader(new StreamReader(stream), options))
                {
                    includedKeyValues = reader.ReadObject();
                }

            stateMachine.AddItemForAppending(includedKeyValues);
        }