<commit_before>﻿// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using Core2D;

namespace Dependencies
{
    /// <summary>
    /// Xaml serializer.
    /// </summary>
    public class CoreXamlSerializer : ISerializer
    {
        /// <inheritdoc/>
        public string Serialize<T>(T value)
        {
            throw new NotImplementedException(nameof(Serialize));
        }

        /// <inheritdoc/>
        public T Deserialize<T>(string text)
        {
            using (var textReader = new StringReader(text))
            {
                return (T)CoreXamlReader.Load(textReader);
            }
        }
    }<commit_msg>Implemented Serialize method<commit_after>﻿// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Text;
using System.Xml;
using Core2D;

namespace Dependencies
{
    /// <summary>
    /// Xaml serializer.
    /// </summary>
    public class CoreXamlSerializer : ISerializer
    {
        internal static readonly XmlWriterSettings settings = new XmlWriterSettings()
        {
            OmitXmlDeclaration = true,
            Encoding = Encoding.UTF8,
            Indent = true,
            IndentChars = "    ",
            NewLineChars = Environment.NewLine,
            NewLineHandling = NewLineHandling.None,
            NewLineOnAttributes = false,
            NamespaceHandling = NamespaceHandling.OmitDuplicates
        };

        /// <inheritdoc/>
        public string Serialize<T>(T value)
        {
            using (var textWriter = new StringWriter())
            {
                using (var xmlWriter = XmlWriter.Create(textWriter, settings))
                {
                    CoreXamlWriter.Save(xmlWriter, value);
                    return textWriter.ToString();
                }
            }
        }

        /// <inheritdoc/>
        public T Deserialize<T>(string text)
        {
            using (var textReader = new StringReader(text))
            {
                return (T)CoreXamlReader.Load(textReader);
            }
        }
    }
{'fraction_non_alphanumeric': 0.09358523725834798, 'fraction_numerical': 0.0013181019332161687, 'mean_word_length': 1.776829268292683, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '819905', 'n_tokens_mistral': 594, 'n_tokens_neox': 576, 'n_words': 157}