<commit_before>﻿using System;
using System.Windows;
using System.Windows.Data;
using Certify.Locales;

namespace Certify.UI.Utils
{
    public class ExpiryDateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetDescription((DateTime?)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }

        public static string GetDescription(DateTime? expiry)
        {
            if (expiry == null)
            {
                return SR.ExpiryDateConverter_NoCurrentCertificate;
            }

            var days = (int)(expiry - DateTime.Now).Value.TotalDays;

            if (days < 0)
            {
                return string.Format(SR.ExpiryDateConverter_CertificateExpiredNDaysAgo, -days);
            }
            else
            {
                return string.Format(SR.ExpiryDateConverter_CertificateExpiresIn, days);
            }

        }
    }

    public class ExpiryDateColourConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return DependencyProperty.UnsetValue;
            }

            return GetColour((DateTime?)value);
        }
<commit_msg>Fix text colour for certs not yet requested<commit_after>﻿using System;
using System.Windows;
using System.Windows.Data;
using Certify.Locales;

namespace Certify.UI.Utils
{
    public class ExpiryDateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetDescription((DateTime?)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }

        public static string GetDescription(DateTime? expiry)
        {
            if (expiry == null)
            {
                return SR.ExpiryDateConverter_NoCurrentCertificate;
            }

            var days = (int)(expiry - DateTime.Now).Value.TotalDays;

            if (days < 0)
            {
                return string.Format(SR.ExpiryDateConverter_CertificateExpiredNDaysAgo, -days);
            }
            else
            {
                return string.Format(SR.ExpiryDateConverter_CertificateExpiresIn, days);
            }

        }
    }

    public class ExpiryDateColourConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetColour((DateTime?)value);
        }

{'fraction_non_alphanumeric': 0.07269021739130435, 'fraction_numerical': 0.0006793478260869565, 'mean_word_length': 2.029835390946502, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5618542', 'n_tokens_mistral': 750, 'n_tokens_neox': 719, 'n_words': 168}