<commit_before>﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace Torch
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if(!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Editor());
        }

        static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
        {
            var mbox = MessageBox.Show(
                "Unhandled exception: " + Environment.NewLine + 
                (e.ExceptionObject as Exception).Message + Environment.NewLine + Environment.NewLine +
                "Copy the stack trace to the clipboard?"
                , "Unhandled Exception",
                MessageBoxButtons.YesNo);
            if (mbox == DialogResult.Yes)
            {
                Clipboard.SetText((e.ExceptionObject as Exception).StackTrace);
            }
        }
    }
}
<commit_msg>Torch will now use OpenGL by default on Mac/Linux. Command line switches are also supported.<commit_after>﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace Torch
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // TODO: Make argument/config handling better.
            var useOpenGl = false;
            var useWinForm = false;

            foreach(var arg in Environment.GetCommandLineArgs()) {
                switch(arg.ToLower()) {
                    case "-opengl":
                        useOpenGl = true;
                        break;
                    case "-winform":
                        useWinForm = true;
                        break;
                }
            }

            // Default to using OpenGL in Mac/Linux if no value was specified.
            if(!useOpenGl && !useWinForm) {
                switch(Environment.OSVersion.Platform) {
                    case PlatformID.MacOSX:
                    case PlatformID.Unix:
                        useOpenGl = true;
                        useWinForm = false;
                        break;
                    default:
                        useOpenGl = false;
                        useWinForm = true;
                        break;
                }
            }

            if(!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Editor(useOpenGl));
        }

        static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
        {
            var mbox = MessageBox.Show(
                "Unhandled exception: " + Environment.NewLine + 
                (e.ExceptionObject as Exception).Message + Environment.NewLine + Environment.NewLine +
                "Copy the stack trace to the clipboard?"
                , "Unhandled Exception",
                MessageBoxButtons.YesNo);
            if (mbox == DialogResult.Yes)
            {
                Clipboard.SetText((e.ExceptionObject as Exception).StackTrace);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.07994389901823282, 'fraction_numerical': 0.0, 'mean_word_length': 1.4542326221610462, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '5852700', 'n_tokens_mistral': 854, 'n_tokens_neox': 816, 'n_words': 197}