<commit_before>package de.idrinth.waraddonclient;

import de.idrinth.waraddonclient.gui.FrameRestorer;
import de.idrinth.waraddonclient.gui.ThemeManager;
import de.idrinth.waraddonclient.gui.Window;
import de.idrinth.waraddonclient.model.CmdAddonList;
import de.idrinth.waraddonclient.model.GuiAddonList;
import de.idrinth.waraddonclient.model.TrustManager;
import de.idrinth.waraddonclient.service.Backup;
import de.idrinth.waraddonclient.service.FileLogger;
import de.idrinth.waraddonclient.service.FileSystem;
import de.idrinth.waraddonclient.service.FileWatcher;
import de.idrinth.waraddonclient.service.Request;
import de.idrinth.waraddonclient.service.Shedule;
import de.idrinth.waraddonclient.service.Version;
import de.idrinth.waraddonclient.service.XmlParser;
import java.io.File;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Arrays;
import javax.swing.JOptionPane;
import javax.xml.parsers.ParserConfigurationException;

public final class Main {

    private Main() {
        //not to be used
    }

    public static void main(String[] args) {
        try {
            Config config = new Config();
            FileLogger logger = new FileLogger(config.getLogFile());
            ThemeManager themes = new ThemeManager(logger, config);
            new FileSystem(config).processPosition();
            Shedule schedule = new Shedule();
            Request client = new Request(new TrustManager(logger), logger, config);
            if (Arrays.asList(args).contains("--updateonly")) {
                new CmdAddonList(client, logger, new XmlParser(), config).run();
                Runtime.getRuntime().exit(0);
            }
            GuiAddonList addonList = new GuiAddonList(client, logger, new XmlParser(), config);
            FileWatcher watcher = new FileWatcher(addonList, logger, config);
            schedule.register(30, watcher);
            java.awt.EventQueue.invokeLater(() -> {
                Version version = new Version(client, logger);
                Window window = new Window(addonList, version, themes, logger, schedule, config, new Backup(config));
                new FrameRestorer(config).restore(window);
                window.setVisible(true);
            });

        } catch (ParserConfigurationException |FileSystem.FileSystemException|IOException|CertificateException|KeyManagementException|KeyStoreException|NoSuchAlgorithmException ex) {
            JOptionPane.showMessageDialog(null, ex.getLocalizedMessage());
            Runtime.getRuntime().exit(0);
        }
    }

    public static void restart() throws IOException {
        try {
            File jar = new File("WARAddonClient.jar");
            File exe = new File("WARAddonClient.exe");
            if (exe.exists()) {
                Runtime.getRuntime().addShutdownHook(new Thread() {
                    @Override
                    public void run() {
                        try {
                            Runtime.getRuntime().exec(exe.getAbsolutePath());
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                });
                System.exit(0);
            } else if (jar.exists()) {
                Runtime.getRuntime().addShutdownHook(new Thread() {
                    @Override
                    public void run() {
                        try {
                            Runtime.getRuntime().exec("java -jar "+jar.getAbsolutePath());
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                });
                System.exit(0);
            }
            throw new IOException("Executable not found, did you replace it?");
        } catch (IOException e) {
            throw new IOException("Error while trying to restart the application", e);
        }
    }
}
<commit_msg>added option to set ROR loc from cmdline<commit_after>package de.idrinth.waraddonclient;

import de.idrinth.waraddonclient.gui.FrameRestorer;
import de.idrinth.waraddonclient.gui.ThemeManager;
import de.idrinth.waraddonclient.gui.Window;
import de.idrinth.waraddonclient.model.CmdAddonList;
import de.idrinth.waraddonclient.model.GuiAddonList;
import de.idrinth.waraddonclient.model.TrustManager;
import de.idrinth.waraddonclient.service.Backup;
import de.idrinth.waraddonclient.service.FileLogger;
import de.idrinth.waraddonclient.service.FileSystem;
import de.idrinth.waraddonclient.service.FileWatcher;
import de.idrinth.waraddonclient.service.Request;
import de.idrinth.waraddonclient.service.Shedule;
import de.idrinth.waraddonclient.service.Version;
import de.idrinth.waraddonclient.service.XmlParser;
import java.io.File;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.JOptionPane;
import javax.xml.parsers.ParserConfigurationException;

public final class Main {

    private Main() {
        //not to be used
    }

    public static void main(String[] args) {
        try {
            Config config = new Config();
            FileLogger logger = new FileLogger(config.getLogFile());
            ThemeManager themes = new ThemeManager(logger, config);
            new FileSystem(config).processPosition();
            Shedule schedule = new Shedule();
            Request client = new Request(new TrustManager(logger), logger, config);
            List<String> options = Arrays.asList(args);
            if (options.contains("--setlocation")) {
                config.setWARPath(options.get(options.indexOf("--setlocation") + 1));
            }
            if (options.contains("--updateonly")) {
                new CmdAddonList(client, logger, new XmlParser(), config).run();
                Runtime.getRuntime().exit(0);
            }
            GuiAddonList addonList = new GuiAddonList(client, logger, new XmlParser(), config);
            FileWatcher watcher = new FileWatcher(addonList, logger, config);
            schedule.register(30, watcher);
            java.awt.EventQueue.invokeLater(() -> {
                Version version = new Version(client, logger);
                Window window = new Window(addonList, version, themes, logger, schedule, config, new Backup(config));
                new FrameRestorer(config).restore(window);
                window.setVisible(true);
            });

        } catch (ParserConfigurationException |FileSystem.FileSystemException|IOException|CertificateException|KeyManagementException|KeyStoreException|NoSuchAlgorithmException ex) {
            JOptionPane.showMessageDialog(null, ex.getLocalizedMessage());
            Runtime.getRuntime().exit(0);
        }
    }

    public static void restart() throws IOException {
        try {
            File jar = new File("WARAddonClient.jar");
            File exe = new File("WARAddonClient.exe");
            if (exe.exists()) {
                Runtime.getRuntime().addShutdownHook(new Thread() {
                    @Override
                    public void run() {
                        try {
                            Runtime.getRuntime().exec(exe.getAbsolutePath());
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                });
                System.exit(0);
            } else if (jar.exists()) {
                Runtime.getRuntime().addShutdownHook(new Thread() {
                    @Override
                    public void run() {
                        try {
                            Runtime.getRuntime().exec("java -jar "+jar.getAbsolutePath());
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                });
                System.exit(0);
            }
            throw new IOException("Executable not found, did you replace it?");
        } catch (IOException e) {
            throw new IOException("Error while trying to restart the application", e);
        }
    }
}

{'fraction_non_alphanumeric': 0.0980279091223619, 'fraction_numerical': 0.0014992503748125937, 'mean_word_length': 2.0038101835815727, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1364079', 'n_tokens_mistral': 2222, 'n_tokens_neox': 2186, 'n_words': 442}