<commit_before>using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;

namespace Telegraph.ViewModels
{
    public abstract class MainViewModel : PropertyChangedNotification
    {
        protected struct TlgRegex
        {
            private const string footerRegex = @"^([\s]+[\.])*[\s]?([-ߨ\1]+){1}[\s]*([\s\d\.\-\/\:]+)?[\s]*$[\s\-]+^([\s]+[\.])*[\s]?([-ߨ\1]+){1}[\s]*([\s\d\.\-\/\:]+)?[\s]*$[\s\-]+^([\s]+[\.])*[\s]?([-ߨ\1]+)*[\s]*([\s\d\.\/\:]+)*$";
            private const string mainRegex = @".[\s\.]+([0-9]*)?[-ߨ\s\d\W]+^([-ߨ\s\d]*).[\s\.]+([0-9]*)?[\s]?$[\s]+^([-ߨ\d\/\s\(\)]+)[\s\n\r]+^([-ߨ\w\W\s]+)^[\s]*[\.]?[\s]*([\d\/\s\-]+[\s]*[\d]+)[\s]+([-ߨ\s\.\-0-9]+)[\r\n]^([\d]+[\s\.\\\/]+[\d]+[\s\.\\\/]+[\d]+)[\s]+([-ߨ\s\-\1]+)$[\s]+([-ߨ\-\1]+)?[\s]+([-ߨ\s\1\.]+)$[\r\n]?[\s\-]+";
            private const string urgencyRegex = @"[\s\d]{10,}....(̲.)";

            public static string FooterRegex => footerRegex;
            public static string MainRegex => mainRegex;
            public static string UrgencyRegex => urgencyRegex;
        }

        private ApplicationContext db;
        private Task dbTask;

        protected string GetTempFile(string fileExtension)
        {
            string res = string.Empty;

            while (true)
            {
                res = System.IO.Path.ChangeExtension(System.IO.Path.GetTempFileName(), fileExtension);
                if (!System.IO.File.Exists(res))
                {
                    try
                    {
                        System.IO.File.Create(res).Close();
                        break;
                    }
                    catch (Exception)
                    {

                    }
                }
            }
            return res;
        }

        protected bool isMSWordInstalled()
        {
            using (var regWord = Registry.ClassesRoot.OpenSubKey("Word.Application"))
            {
                return (regWord == null) ? false : true;
            }
        }

        protected bool CheckData(Telegram data) => ((data.IncNum < 1) ||
                string.IsNullOrWhiteSpace(data.From) ||
                string.IsNullOrWhiteSpace(data.To) ||
                string.IsNullOrWhiteSpace(data.Text) ||
                string.IsNullOrWhiteSpace(data.SubNum) ||
                string.IsNullOrWhiteSpace(data.Date) ||
                string.IsNullOrWhiteSpace(data.SenderPos) ||
                string.IsNullOrWhiteSpace(data.SenderRank) ||
                string.IsNullOrWhiteSpace(data.SenderName) ||
                string.IsNullOrWhiteSpace(data.Executor) ||
                string.IsNullOrWhiteSpace(data.HandedBy))
            ? false : true;

        public IEnumerable<Telegram> Telegrams
        {
            get { return GetValue(() => Telegrams); }
            set { SetValue(() => Telegrams, value); }
        }

        public CollectionViewSource TelegramsViewSource
        {
            get { return GetValue(() => TelegramsViewSource); }
            set { SetValue(() => TelegramsViewSource, value); }
        }

        public ICollectionView SourceCollection
        {
            get { return TelegramsViewSource.View; }
        }

        public bool IsBusy
        {
            get { return GetValue(() => IsBusy); }
            set { SetValue(() => IsBusy, value); }
        }

        protected Task DbTask { get => dbTask; set => dbTask = value; }
        protected ApplicationContext Db { get => db; set => db = value; }
    }
}<commit_msg>Реализовал метод конвертации в тип IList<><commit_after>using Microsoft.Win32;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;

namespace Telegraph.ViewModels
{
    public abstract class MainViewModel : PropertyChangedNotification
    {
        protected struct TlgRegex
        {
            private const string footerRegex = @"^([\s]+[\.])*[\s]?([-ߨ\1]+){1}[\s]*([\s\d\.\-\/\:]+)?[\s]*$[\s\-]+^([\s]+[\.])*[\s]?([-ߨ\1]+){1}[\s]*([\s\d\.\-\/\:]+)?[\s]*$[\s\-]+^([\s]+[\.])*[\s]?([-ߨ\1]+)*[\s]*([\s\d\.\/\:]+)*$";
            private const string mainRegex = @".[\s\.]+([0-9]*)?[-ߨ\s\d\W]+^([-ߨ\s\d]*).[\s\.]+([0-9]*)?[\s]?$[\s]+^([-ߨ\d\/\s\(\)]+)[\s\n\r]+^([-ߨ\w\W\s]+)^[\s]*[\.]?[\s]*([\d\/\s\-]+[\s]*[\d]+)[\s]+([-ߨ\s\.\-0-9]+)[\r\n]^([\d]+[\s\.\\\/]+[\d]+[\s\.\\\/]+[\d]+)[\s]+([-ߨ\s\-\1]+)$[\s]+([-ߨ\-\1]+)?[\s]+([-ߨ\s\1\.]+)$[\r\n]?[\s\-]+";
            private const string urgencyRegex = @"[\s\d]{10,}....(̲.)";

            public static string FooterRegex => footerRegex;
            public static string MainRegex => mainRegex;
            public static string UrgencyRegex => urgencyRegex;
        }

        private ApplicationContext db;
        private Task dbTask;

        protected string GetTempFile(string fileExtension)
        {
            string res = string.Empty;

            while (true)
            {
                res = System.IO.Path.ChangeExtension(System.IO.Path.GetTempFileName(), fileExtension);
                if (!System.IO.File.Exists(res))
                {
                    try
                    {
                        System.IO.File.Create(res).Close();
                        break;
                    }
                    catch (Exception)
                    {

                    }
                }
            }
            return res;
        }

        protected bool isMSWordInstalled()
        {
            using (var regWord = Registry.ClassesRoot.OpenSubKey("Word.Application"))
            {
                return (regWord == null) ? false : true;
            }
        }

        protected bool CheckData(Telegram data) => ((data.IncNum < 1) ||
                string.IsNullOrWhiteSpace(data.From) ||
                string.IsNullOrWhiteSpace(data.To) ||
                string.IsNullOrWhiteSpace(data.Text) ||
                string.IsNullOrWhiteSpace(data.SubNum) ||
                string.IsNullOrWhiteSpace(data.Date) ||
                string.IsNullOrWhiteSpace(data.SenderPos) ||
                string.IsNullOrWhiteSpace(data.SenderRank) ||
                string.IsNullOrWhiteSpace(data.SenderName) ||
                string.IsNullOrWhiteSpace(data.Executor) ||
                string.IsNullOrWhiteSpace(data.HandedBy))
            ? false : true;

        public IEnumerable<Telegram> Telegrams
        {
            get { return GetValue(() => Telegrams); }
            set { SetValue(() => Telegrams, value); }
        }

        public CollectionViewSource TelegramsViewSource
        {
            get { return GetValue(() => TelegramsViewSource); }
            set { SetValue(() => TelegramsViewSource, value); }
        }

        public ICollectionView SourceCollection
        {
            get { return TelegramsViewSource.View; }
        }

        public bool IsBusy
        {
            get { return GetValue(() => IsBusy); }
            set { SetValue(() => IsBusy, value); }
        }

        protected IList<t> ConvertListOfSelectedItem<t>(object param)
        {
            return (param as IList).Cast<t>().ToList();
        }

        protected Task DbTask { get => dbTask; set => dbTask = value; }
        protected ApplicationContext Db { get => db; set => db = value; }
    }
}
{'fraction_non_alphanumeric': 0.18730753782300175, 'fraction_numerical': 0.005087695809345294, 'mean_word_length': 1.686084142394822, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, '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': '2348572', 'n_tokens_mistral': 2361, 'n_tokens_neox': 2249, 'n_words': 349}