<commit_before>﻿using SimpleLogger;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;

namespace Simocracy.CLSim
{
    /// <summary>
    /// Interaktionslogik für "App.xaml"
    /// </summary>
    public partial class App
    {

        #region Members

        private static bool _IsLogging = true;

        #endregion

        #region Main methods

        [STAThread]
        public static void Main(params string[] args)
        {
            // get args
            SetArgs();

            // Setup logger
            if(_IsLogging)
            {
                SimpleLog.SetLogFile(logDir: "CLSim-Log", writeText: true, check: false);
                SimpleLog.Check($"{Globals.ProgramName} {Globals.ProgramVersion} started.");
            }

            // Load Settings
            //Settings.LoadSettings();

            // Open MainWindow
            App app = new App();
            try
            {
                app.InitializeComponent();
                MainWindow window = new MainWindow();
                app.Run(window);
            }
            catch(Exception e)
            {
                //SimpleLog.Error(e.ToString());
                SimpleLog.Log(e, framesToSkip: 1);
            }

            app.Shutdown();
            SimpleLog.Info($"{Globals.ProgramName} {Globals.ProgramVersion} closed");
            SimpleLog.Flush();
            SimpleLog.StopLogging();
        }

        /// <summary>
        /// Sets the arguments
        /// </summary>
        /// <param name="args">arguments</param>
        public static void SetArgs(params string[] args)
        {
            foreach(var arg in args)
            {
                switch(arg.ToLower())
                {
                    case "-nolog":<commit_msg>added exit code on fatal error<commit_after>﻿using SimpleLogger;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;

namespace Simocracy.CLSim
{
    /// <summary>
    /// Interaktionslogik für "App.xaml"
    /// </summary>
    public partial class App
    {

        #region Members

        private static bool _IsLogging = true;

        #endregion

        #region Main methods

        [STAThread]
        public static void Main(params string[] args)
        {
            // get args
            SetArgs();

            // Setup logger
            if(_IsLogging)
            {
                SimpleLog.SetLogFile(logDir: "CLSim-Log", writeText: true, check: false);
                SimpleLog.Check($"{Globals.ProgramName} {Globals.ProgramVersion} started.");
            }

            // Load Settings
            //Settings.LoadSettings();

            // Open MainWindow
            App app = new App();
            try
            {
                app.InitializeComponent();
                MainWindow window = new MainWindow();
                app.Run(window);
            }
            catch(Exception e)
            {
                //SimpleLog.Error(e.ToString());
                SimpleLog.Log(e, framesToSkip: 1);
                Environment.ExitCode = 1;
            }

            app.Shutdown();
            SimpleLog.Info($"{Globals.ProgramName} {Globals.ProgramVersion} closed");
            SimpleLog.Flush();
            SimpleLog.StopLogging();
        }

        /// <summary>
        /// Sets the arguments
        /// </summary>
        /// <param name="args">arguments</param>
        public static void SetArgs(params string[] args)
        {
            foreach(var arg in args)
            {
                switch(arg.ToLower())
                {
                    case "-nolog":
{'fraction_non_alphanumeric': 0.10822735530755255, 'fraction_numerical': 0.0007786140669608098, 'mean_word_length': 1.4485387547649302, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 15, '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': '759293', 'n_tokens_mistral': 1005, 'n_tokens_neox': 964, 'n_words': 226}