<commit_before>﻿using System;
using System.IO;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using SimpleDnsCrypt.Config;
using SimpleDnsCrypt.Models;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

namespace SimpleDnsCrypt.Tools
{
    public static class ApplicationUpdater
    {
        public static async Task<RemoteUpdate> CheckForRemoteUpdateAsync()
        {
            var remoteUpdate = new RemoteUpdate();
            try
            {
                var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

                remoteUpdate.CanUpdate = false;
                var remoteUpdateData = await DownloadRemoteUpdateFileAsync().ConfigureAwait(false);

                if (remoteUpdateData != null)
                {
                    using (var remoteUpdateDataStream = new MemoryStream(remoteUpdateData))
                    {
                        using (var serverConfigFile = new StreamReader(remoteUpdateDataStream))
                        {
                            var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
                            remoteUpdate = deserializer.Deserialize<RemoteUpdate>(serverConfigFile);
                        }
                    }
                }<commit_msg>Fix YAML deserializer (will deprecate)<commit_after>﻿using System;
using System.IO;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using SimpleDnsCrypt.Config;
using SimpleDnsCrypt.Models;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

namespace SimpleDnsCrypt.Tools
{
    public static class ApplicationUpdater
    {
        public static async Task<RemoteUpdate> CheckForRemoteUpdateAsync()
        {
            var remoteUpdate = new RemoteUpdate();
            try
            {
                var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

                remoteUpdate.CanUpdate = false;
                var remoteUpdateData = await DownloadRemoteUpdateFileAsync().ConfigureAwait(false);

                if (remoteUpdateData != null)
                {
                    using (var remoteUpdateDataStream = new MemoryStream(remoteUpdateData))
                    {
                        using (var serverConfigFile = new StreamReader(remoteUpdateDataStream))
                        {
							var deserializer = new DeserializerBuilder().WithNamingConvention(new PascalCaseNamingConvention()).Build();
							remoteUpdate = deserializer.Deserialize<RemoteUpdate>(serverConfigFile);
                        }
                    }
                }
{'fraction_non_alphanumeric': 0.0693620178041543, 'fraction_numerical': 0.0, 'mean_word_length': 2.1433566433566433, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5313372', 'n_tokens_mistral': 657, 'n_tokens_neox': 614, 'n_words': 131}