<commit_before>using System;
using System.Linq;

public static class Afk
{
    private class AfkToken : IDisposable
    {
        public void Dispose()
        {
            Afk.Stop();
        }
    }

    public static string[] AfkNames { get; set; } =
    {
        "desttro", "elbereth", "finn", "gothmog", "houba", "iustus", "myke", "yavanna",
        "nightmare", "sirglorg", "ustus", "levtar", "lustus", "total", "tangata nui", "guardian"
    };

    public static string[] AfkMessages { get; set; } =
    {
        "afk", "kontrola", "makro", "maker", "jsi t",
        "gm", "halo", "lagr"
    };
    
    public static string[] IgnoredNames { get; set; } = { };
    
    private static SpeechJournal afkCheckJournal = UO.CreateSpeechJournal();
 
    public static IDisposable Start()
    {
        afkCheckJournal.Delete();
        
        return new AfkToken();
    }
    
    public static void Stop()
    {
        afkCheckJournal.Delete();
    }
 
    public static void Check()
    {
        if (IsAfkAlertRequired)
        {
            Alert();
        }
    }

    public static bool IsAfkAlertRequired
    {
        get
        {
            var afkAlertRequired = afkCheckJournal
                .ByAnyName(AfkNames).Any();

            afkAlertRequired |= afkCheckJournal
                .Where(x => !IgnoredNames.Any(ignored => x.Name.IndexOf(ignored, StringComparison.OrdinalIgnoreCase) >= 0))
                .Any(x => AfkMessages.Any(msg => x.Message.IndexOf(msg, StringComparison.OrdinalIgnoreCase) >= 0));

            afkCheckJournal.Delete();
        
            return afkAlertRequired;
        }
    }

    public static void Alert()
    {
        afkCheckJournal.Delete();
        while (true)
        {
            DoAlert();

            if (afkCheckJournal.Contains("tak zpet do prace"))
                break;
            afkCheckJournal.Delete();
        }
    }

    public static void DoAlert()
    {
        System.Media.SystemSounds.Asterisk.Play();
        UO.Alert("Afk kontrola");

        UO.Wait(1000);<commit_msg>Afk alert sound is configurable.<commit_after>using System;
using System.Linq;

public static class Afk
{
    private class AfkToken : IDisposable
    {
        public void Dispose()
        {
            Afk.Stop();
        }
    }

    public static string[] AfkNames { get; set; } =
    {
        "desttro", "elbereth", "finn", "gothmog", "houba", "iustus", "myke", "yavanna",
        "nightmare", "sirglorg", "ustus", "levtar", "lustus", "total", "tang<NAME>ui", "guardian"
    };

    public static string[] AfkMessages { get; set; } =
    {
        "afk", "kontrola", "makro", "maker", "jsi t",
        "gm", "halo", "lagr"
    };
    
    public static string[] IgnoredNames { get; set; } = { };
    
    public static string FileAlertPath { get; set; }
    
    private static SpeechJournal afkCheckJournal = UO.CreateSpeechJournal();
 
    public static IDisposable Start()
    {
        afkCheckJournal.Delete();
        
        return new AfkToken();
    }
    
    public static void Stop()
    {
        afkCheckJournal.Delete();
    }
 
    public static void Check()
    {
        if (IsAfkAlertRequired)
        {
            Alert();
        }
    }

    public static bool IsAfkAlertRequired
    {
        get
        {
            var afkAlertRequired = afkCheckJournal
                .ByAnyName(AfkNames).Any();

            afkAlertRequired |= afkCheckJournal
                .Where(x => !IgnoredNames.Any(ignored => x.Name.IndexOf(ignored, StringComparison.OrdinalIgnoreCase) >= 0))
                .Any(x => AfkMessages.Any(msg => x.Message.IndexOf(msg, StringComparison.OrdinalIgnoreCase) >= 0));

            afkCheckJournal.Delete();
        
            return afkAlertRequired;
        }
    }

    public static void Alert()
    {
        afkCheckJournal.Delete();
        while (true)
        {
            DoAlert();

            if (afkCheckJournal.Contains("tak zpet do prace"))
                break;
            afkCheckJournal.Delete();
        }
    }

    public static void DoAlert()
    {
        if(!string.IsNullOrEmpty(FileAlertPath))
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(FileAlertPath);    
            player.Play();
        }
        else
        {
            System.Media.SystemSounds.Asterisk.Play();
        }            

        
        UO.Alert("Afk kontrola");

        UO.Wait(1000);
{'fraction_non_alphanumeric': 0.12202247191011235, 'fraction_numerical': 0.002696629213483146, 'mean_word_length': 1.813527180783818, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, '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': '947371', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1335, 'n_words': 279}