<commit_before>﻿using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using MangaReader.Core.Account;
using MangaReader.Core.NHibernate;
using MangaReader.Core.Services;
using MangaReader.ViewModel.Primitive;

namespace MangaReader.ViewModel.Setting
{
  public class ProxySettingSelectorModel : BaseViewModel
  {
    public ProxySettingModel SelectedProxySettingModel
    {
      get => selectedProxySettingModel;
      set
      {
        if (!Equals(selectedProxySettingModel, value))
        {
          if (value != null && value.Id == default)
          {
            lastValidProxySettingModel = selectedProxySettingModel;
            CreateNew().LogException();
          }
          selectedProxySettingModel = value;
          OnPropertyChanged();
        }
      }
    }

    private ProxySettingModel selectedProxySettingModel;
    private ProxySettingModel lastValidProxySettingModel;

    public ObservableCollection<ProxySettingModel> ProxySettingModels { get; private set; }

    public async Task CreateNew()
    {
      using (var context = Repository.GetEntityContext())
      {
        var setting = new ProxySetting(ProxySettingType.Manual);
        await context.Save(setting).ConfigureAwait(true);
<commit_msg>Fix appveyor build.<commit_after>﻿using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using MangaReader.Core.Account;
using MangaReader.Core.NHibernate;
using MangaReader.Core.Services;
using MangaReader.ViewModel.Primitive;

namespace MangaReader.ViewModel.Setting
{
  public class ProxySettingSelectorModel : BaseViewModel
  {
    public ProxySettingModel SelectedProxySettingModel
    {
      get => selectedProxySettingModel;
      set
      {
        if (!Equals(selectedProxySettingModel, value))
        {
          if (value != null && value.Id == default(int))
          {
            lastValidProxySettingModel = selectedProxySettingModel;
            CreateNew().LogException();
          }
          selectedProxySettingModel = value;
          OnPropertyChanged();
        }
      }
    }

    private ProxySettingModel selectedProxySettingModel;
    private ProxySettingModel lastValidProxySettingModel;

    public ObservableCollection<ProxySettingModel> ProxySettingModels { get; private set; }

    public async Task CreateNew()
    {
      using (var context = Repository.GetEntityContext())
      {
        var setting = new ProxySetting(ProxySettingType.Manual);
        await context.Save(setting).ConfigureAwait(true);

{'fraction_non_alphanumeric': 0.07831562377016922, 'fraction_numerical': 0.0, 'mean_word_length': 3.2086092715231787, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737591', 'n_tokens_mistral': 659, 'n_tokens_neox': 648, 'n_words': 134}