<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using CM3D2.MaidFiddler.Hook;
using CM3D2.MaidFiddler.Plugin.Utils;
using UnityEngine;
using Debugger = CM3D2.MaidFiddler.Plugin.Utils.Debugger;

namespace CM3D2.MaidFiddler.Plugin.Gui
{
    public partial class MaidFiddlerGUI
    {
        public delegate int MaidCompareMethod(Maid x, Maid y);

        private const string NAME_FORMAT = "{0}{1}";
        private readonly MaidComparer comparer = new MaidComparer();
        private SortedList<Maid, MaidInfo> loadedMaids;
        private Dictionary<string, Image> maidThumbnails;
        private Dictionary<MaidChangeType, Action> valueUpdateQueue;

        public MaidInfo SelectedMaid
            =>
            listBox1.Items.Count == 0 || listBox1.SelectedIndex == -1
            ? null : (MaidInfo) listBox1.Items[listBox1.SelectedIndex];

        private MaidInfo GetMaidInfo(Maid maid)
        {
            return loadedMaids[maid];
        }

        private void InitMaids()
        {
            loadedMaids = new SortedList<Maid, MaidInfo>(comparer);
            maidThumbnails = new Dictionary<string, Image>();
            valueUpdateQueue = new Dictionary<MaidChangeType, Action>();
        }

        private bool IsMaidLoaded(Maid maid)
        {
            return loadedMaids.ContainsKey(maid);
        }

        public static int MaidCompareCreateTime(Maid x, Maid y)
        {
            int result;
            if (x.Param.status.create_time_num < y.Param.status.create_time_num)
                result = -1;
            else
                result = x.Param.status.create_time_num == y.Param.status.create_time_num ? 0 : 1;
            return MaidFiddler.MaidOrderDirection * result;
        }

        public static int MaidCompareFirstLastName(Maid x, Maid y)
        {
            return MaidFiddler.MaidOrderDirection<commit_msg>Pre-Beta 0.7 U3: Fixed CreationTime sorting<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using CM3D2.MaidFiddler.Hook;
using CM3D2.MaidFiddler.Plugin.Utils;
using UnityEngine;
using Debugger = CM3D2.MaidFiddler.Plugin.Utils.Debugger;

namespace CM3D2.MaidFiddler.Plugin.Gui
{
    public partial class MaidFiddlerGUI
    {
        public delegate int MaidCompareMethod(Maid x, Maid y);

        private const string NAME_FORMAT = "{0}{1}";
        private static readonly CultureInfo jaJpCultureInfo = new CultureInfo("ja-JP");
        private readonly MaidComparer comparer = new MaidComparer();
        private SortedList<Maid, MaidInfo> loadedMaids;
        private Dictionary<string, Image> maidThumbnails;
        private Dictionary<MaidChangeType, Action> valueUpdateQueue;

        public MaidInfo SelectedMaid
            =>
            listBox1.Items.Count == 0 || listBox1.SelectedIndex == -1
            ? null : (MaidInfo) listBox1.Items[listBox1.SelectedIndex];

        private MaidInfo GetMaidInfo(Maid maid)
        {
            return loadedMaids[maid];
        }

        private void InitMaids()
        {
            loadedMaids = new SortedList<Maid, MaidInfo>(comparer);
            maidThumbnails = new Dictionary<string, Image>();
            valueUpdateQueue = new Dictionary<MaidChangeType, Action>();
        }

        private bool IsMaidLoaded(Maid maid)
        {
            return loadedMaids.ContainsKey(maid);
        }

        public static int MaidCompareCreateTime(Maid x, Maid y)
        {
            try
            {
                return MaidFiddler.MaidOrderDirection
                       * DateTime.Compare(
                       DateTime.Parse(x.Param.status.create_time, jaJpCultureInfo),
                       DateTime.Parse(y.Param.status.create_time, jaJpCultureInfo));
            }
            catch (Exception)
            {
                return 0;
            }
        }

        public static int MaidCompareFirstLastName(Maid x, Maid y)
        {
            return MaidFiddler.MaidOrderDirection
{'fraction_non_alphanumeric': 0.08100289296046287, 'fraction_numerical': 0.009402121504339441, 'mean_word_length': 2.3325301204819278, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, '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': '1456182', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1186, 'n_words': 261}