<commit_before>﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;

using PolarisServer.Database;
using PolarisServer.Packets.Handlers;

namespace PolarisServer
{
    class PolarisApp
    {
        private static PolarisApp instance;
        public static PolarisApp Instance { get { return instance; } }

        public PolarisEF Database { get { return database; } }
        private PolarisEF database;

        public static IPAddress BindAddress = IPAddress.Parse("127.0.0.1");
        public List<QueryServer> queryServers = new List<QueryServer>();

        public Server server;

        public static Config Config;
        public static ConsoleSystem ConsoleSystem;

        public static void Main(string[] args)
        {
            Config = new Config();

            ConsoleSystem = new ConsoleSystem();
            ConsoleSystem.thread = new Thread(new ThreadStart(ConsoleSystem.StartThread));
            ConsoleSystem.thread.Start();

            // Setup function exit handlers to guarentee Exit() is run before closing
            Console.CancelKeyPress += Exit;
            AppDomain.CurrentDomain.ProcessExit += Exit;

            try
            {
                for (int i = 0; i < args.Length; i++)
                {
                    switch (args[i].ToLower())
                    {
                        default:
                            break;

                        case "-b":
                        case "--bind-address":
                            if (++i < args.Length)
                                BindAddress = IPAddress.Parse(args[i]);
                            break;

                        case "-s":
                        case "--size":
                            string[] splitArgs = args[++i].Split(',');
                            int width = int.Parse(splitArgs[0]);
                            int height = int.Parse(splitArgs[1]);
                            if (width < ConsoleSystem.width)
                            {
                                Logger.WriteWarning("[ARG] Capping console width to {0} columns", ConsoleSystem.width);
                                width = ConsoleSystem.width;
                            }
                            if (height < ConsoleSystem.height)
                            {
                                Logger.WriteWarning("[ARG] Capping console height to {0} rows", ConsoleSystem.height);
                                height = ConsoleSystem.height;
                            }
                            ConsoleSystem.width = width;
                            ConsoleSystem.height = height;
                            Console.SetWindowSize(ConsoleSystem.width, ConsoleSystem.height);
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException("An error has occurred while parsing command line parameters", ex);
            }

            // Check for settings.txt [AIDA]
            if (!File.Exists("settings.txt"))
            {
                // If it doesn't exist, throw an error and quit [AIDA]
                Logger.WriteError("[ERR] Failed to load settings.txt. Press any key to quit.");
                Console.ReadKey();
                Environment.Exit(0);
            }

            // Check for Private Key BLOB [AIDA]
            if (!File.Exists("privateKey.blob"))
            {
                // If it doesn't exist, throw an error and quit [AIDA]
                Logger.WriteError("[ERR] Failed to load privateKey.blob. Press any key to quit.");
                Console.ReadKey();
                Environment.Exit(0);
            }

            Logger.Write("Arf. Polaris Server version GIT.\nCreated by PolarisTeam (http://github.com/PolarisTeam) and licenced under AGPL.");
            System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseIfModelChanges<PolarisEF>());
            instance = new PolarisApp();
            instance.Start();
        }

        public void Start()
        {<commit_msg>Change the startup message to reflect the new versioning scheme.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;

using PolarisServer.Database;
using PolarisServer.Packets.Handlers;

namespace PolarisServer
{
    class PolarisApp
    {
        private static PolarisApp instance;
        public static PolarisApp Instance { get { return instance; } }

        public PolarisEF Database { get { return database; } }
        private PolarisEF database;

        public static IPAddress BindAddress = IPAddress.Parse("127.0.0.1");
        public List<QueryServer> queryServers = new List<QueryServer>();

        public Server server;

        public static Config Config;
        public static ConsoleSystem ConsoleSystem;

        public static void Main(string[] args)
        {
            Config = new Config();

            ConsoleSystem = new ConsoleSystem();
            ConsoleSystem.thread = new Thread(new ThreadStart(ConsoleSystem.StartThread));
            ConsoleSystem.thread.Start();

            // Setup function exit handlers to guarentee Exit() is run before closing
            Console.CancelKeyPress += Exit;
            AppDomain.CurrentDomain.ProcessExit += Exit;

            try
            {
                for (int i = 0; i < args.Length; i++)
                {
                    switch (args[i].ToLower())
                    {
                        default:
                            break;

                        case "-b":
                        case "--bind-address":
                            if (++i < args.Length)
                                BindAddress = IPAddress.Parse(args[i]);
                            break;

                        case "-s":
                        case "--size":
                            string[] splitArgs = args[++i].Split(',');
                            int width = int.Parse(splitArgs[0]);
                            int height = int.Parse(splitArgs[1]);
                            if (width < ConsoleSystem.width)
                            {
                                Logger.WriteWarning("[ARG] Capping console width to {0} columns", ConsoleSystem.width);
                                width = ConsoleSystem.width;
                            }
                            if (height < ConsoleSystem.height)
                            {
                                Logger.WriteWarning("[ARG] Capping console height to {0} rows", ConsoleSystem.height);
                                height = ConsoleSystem.height;
                            }
                            ConsoleSystem.width = width;
                            ConsoleSystem.height = height;
                            Console.SetWindowSize(ConsoleSystem.width, ConsoleSystem.height);
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException("An error has occurred while parsing command line parameters", ex);
            }

            // Check for settings.txt [AIDA]
            if (!File.Exists("settings.txt"))
            {
                // If it doesn't exist, throw an error and quit [AIDA]
                Logger.WriteError("[ERR] Failed to load settings.txt. Press any key to quit.");
                Console.ReadKey();
                Environment.Exit(0);
            }

            // Check for Private Key BLOB [AIDA]
            if (!File.Exists("privateKey.blob"))
            {
                // If it doesn't exist, throw an error and quit [AIDA]
                Logger.WriteError("[ERR] Failed to load privateKey.blob. Press any key to quit.");
                Console.ReadKey();
                Environment.Exit(0);
            }

            Logger.Write("Polaris Server v0.1.0-pre \"Corsac Fox\".\nCreated by PolarisTeam (http://github.com/PolarisTeam) and licenced under AGPL."); // also, arf.
            Thread.Sleep(1000);
            System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseIfModelChanges<PolarisEF>());
            instance = new PolarisApp();
            instance.Start();
        }

        public void Start()
        {
{'fraction_non_alphanumeric': 0.08948361235557652, 'fraction_numerical': 0.003890591841546805, 'mean_word_length': 1.3133351513498772, 'pattern_counts': {'":': 8, '<': 17, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5361127', 'n_tokens_mistral': 1988, 'n_tokens_neox': 1890, 'n_words': 520}