<commit_before>﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ColorFont;

namespace KeySpriteGenerator
{
  public partial class MainWindow : Window
  {
    FontInfo _selectedFont;
    BitmapSource _smallTemplateImage;
    BitmapSource _mediumTemplateImage;
    int _templatePadding = 70;

    public MainWindow()
    {
      InitializeComponent();
    }

    void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
    {
      _selectedFont = FontInfo.GetControlFont(this.DummyTextBox);

      _smallTemplateImage = new BitmapImage(new Uri("Data/Small.png", UriKind.Relative));
      _mediumTemplateImage = new BitmapImage(new Uri("Data/Medium.png", UriKind.Relative));

      Lines.Text = File.ReadAllText("Data/Default.txt");

      RedrawPreview();
    }

    ColorFontDialog GetColorFontDialog()
    {
      return new ColorFontDialog
      {
        Owner = this,
        Font = _selectedFont,
      };
    }

    void ChooseFont_Click(object sender, RoutedEventArgs e)
    {
      var dialog = GetColorFontDialog();
      if (dialog.ShowDialog() == true)
      {
        _selectedFont = dialog.Font;
        RedrawPreview();
      }
    }

    void RedrawPreview()
    {
      if (_selectedFont == null)
        return;
<commit_msg>Create output folder so on load so it doesn't explode.<commit_after>﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ColorFont;

namespace KeySpriteGenerator
{
  public partial class MainWindow : Window
  {
    FontInfo _selectedFont;
    BitmapSource _smallTemplateImage;
    BitmapSource _mediumTemplateImage;
    int _templatePadding = 70;

    public MainWindow()
    {
      InitializeComponent();
    }

    void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
    {
      _selectedFont = FontInfo.GetControlFont(this.DummyTextBox);

      _smallTemplateImage = new BitmapImage(new Uri("Data/Small.png", UriKind.Relative));
      _mediumTemplateImage = new BitmapImage(new Uri("Data/Medium.png", UriKind.Relative));

      Lines.Text = File.ReadAllText("Data/Default.txt");

      Directory.CreateDirectory("./Output");

      RedrawPreview();
    }

    ColorFontDialog GetColorFontDialog()
    {
      return new ColorFontDialog
      {
        Owner = this,
        Font = _selectedFont,
      };
    }

    void ChooseFont_Click(object sender, RoutedEventArgs e)
    {
      var dialog = GetColorFontDialog();
      if (dialog.ShowDialog() == true)
      {
        _selectedFont = dialog.Font;
        RedrawPreview();
      }
    }

    void RedrawPreview()
    {
      if (_selectedFont == null)
        return;

{'fraction_non_alphanumeric': 0.09325326739667962, 'fraction_numerical': 0.001412928293889085, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1993314', 'n_tokens_mistral': 834, 'n_tokens_neox': 790, 'n_words': 178}