<commit_before>﻿using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using MangaReader.Account;
using MangaReader.Services;

namespace MangaReader
{
  /// <summary>
  /// Логика взаимодействия для App.xaml
  /// </summary>
  public partial class App : Application
  {
    private void App_OnExit(object sender, ExitEventArgs e)
    {
      Settings.Save();
      Environment.Exit(0);
    }

    private void App_OnStartup(object sender, StartupEventArgs e)
    {
      this.DispatcherUnhandledException += (o, a) => Log.Exception(a.Exception);
      AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
      if (Environment.GetCommandLineArgs().Contains("-t"))
        ShowConsoleWindow();

      Mapping.Environment.Initialize();
      Converter.Convert(true);
      Update.Initialize();
      Grouple.LoginWhile();

      var mainwindow = new Random().Next(0) == 0 ? new Table() as Window : new UI.MainForm.Blazard();
      mainwindow.ShowDialog();
    }

    static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
    {
      var thisAssembly = Assembly.GetExecutingAssembly();
      var resourceNames = thisAssembly.GetManifestResourceNames();
      var assemblyFile = string.Format(".{0}.dll", args.Name.Substring(0, args.Name.IndexOf(',')));
      var resourceName = resourceNames.FirstOrDefault(s => s.EndsWith(assemblyFile));<commit_msg>Запретил запускать несколько экземпляров. #42<commit_after>﻿using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using MangaReader.Account;
using MangaReader.Services;

namespace MangaReader
{
  /// <summary>
  /// Логика взаимодействия для App.xaml
  /// </summary>
  public partial class App : Application
  {
    private void App_OnExit(object sender, ExitEventArgs e)
    {
      Settings.Save();
      Environment.Exit(0);
    }

    private void App_OnStartup(object sender, StartupEventArgs e)
    {
      var isSingle = false;
      var mtx = new System.Threading.Mutex(true, "5197317b-a6f6-4a6c-a336-6fbf8642b7bc", out isSingle);
      if (!isSingle)
      {
        Log.Add("Программа уже запущена.");
        Environment.Exit(1);
      }

      this.DispatcherUnhandledException += (o, a) => Log.Exception(a.Exception);
      AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
      if (Environment.GetCommandLineArgs().Contains("-t"))
        ShowConsoleWindow();

      Mapping.Environment.Initialize();
      Converter.Convert(true);
      Update.Initialize();
      Grouple.LoginWhile();

      var mainwindow = new Random().Next(0) == 0 ? new Table() as Window : new UI.MainForm.Blazard();
      mainwindow.ShowDialog();
    }

    static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
    {
      var thisAssembly = Assembly.GetExecutingAssembly();
      var resourceNames = thisAssembly.GetManifestResourceNames();
      var assemblyFile = string.Format(".{0}.dll", args.Name.Substring(0, args.Name.IndexOf(',')));
      var resourceName = resourceNames.FirstOrDefault(s => s.EndsWith(assemblyFile));
{'fraction_non_alphanumeric': 0.12021177203363438, 'fraction_numerical': 0.010277172220492058, 'mean_word_length': 3.6017191977077365, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '4899358', 'n_tokens_mistral': 964, 'n_tokens_neox': 959, 'n_words': 201}