<commit_before>﻿using System;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Input;
using CramTool.Formats.Html;
using CramTool.Models;
using Microsoft.Win32;

namespace CramTool.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void CanCreateNewDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void CreateNewDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            if (!ConfirmChangesSaved())
            {
                return;
            }
            CramToolModel.Instance.CreateNewDictionary();
        }

        private void CanOpenDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void OpenDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            if (!ConfirmChangesSaved())
            {
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog();
            dlg.DefaultExt = ".dictz";
            dlg.Filter = "All Supported Files|*.dictz;*.dictx|Cram Tool Compressed Dictionaries (.dictz)|*.dictz|Cram Tool Dictionaries (.dictx)|*.dictx";
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            if (dlg.ShowDialog(this) == true)
            {
                CramToolModel.Instance.OpenDictionary(dlg.FileName);
            }
        }

        private void CanSaveDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = CramToolModel.Instance.WordList != null;
        }

        private void SaveDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            SaveDictionary();
        }

        private bool SaveDictionary()
        {
            if (string.IsNullOrEmpty(CramToolModel.Instance.DictPath))
            {<commit_msg>Fixed list of extensions in open dictionary dialog.<commit_after>﻿using System;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Input;
using CramTool.Formats.Html;
using CramTool.Models;
using Microsoft.Win32;

namespace CramTool.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void CanCreateNewDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void CreateNewDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            if (!ConfirmChangesSaved())
            {
                return;
            }
            CramToolModel.Instance.CreateNewDictionary();
        }

        private void CanOpenDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void OpenDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            if (!ConfirmChangesSaved())
            {
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog();
            dlg.DefaultExt = ".dictz";
            dlg.Filter = "All Supported Files|*.dictz;*.dictx|Cram Tool Compressed Dictionaries|*.dictz|Cram Tool Dictionaries|*.dictx";
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            if (dlg.ShowDialog(this) == true)
            {
                CramToolModel.Instance.OpenDictionary(dlg.FileName);
            }
        }

        private void CanSaveDictionary(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = CramToolModel.Instance.WordList != null;
        }

        private void SaveDictionary(object sender, ExecutedRoutedEventArgs e)
        {
            SaveDictionary();
        }

        private bool SaveDictionary()
        {
            if (string.IsNullOrEmpty(CramToolModel.Instance.DictPath))
            {
{'fraction_non_alphanumeric': 0.08526216343882853, 'fraction_numerical': 0.000944733112895607, 'mean_word_length': 1.9761068165846802, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1999601', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1063, 'n_words': 227}