public StarboundHandler(Configuration configuration) { this.Configuration = configuration; //Initialize the threaded logger string outputFilename = Configuration.GetString("output", ""); if (!string.IsNullOrEmpty(outputFilename)) { OutputLogQueue.Initialize(outputFilename, Configuration.GetBool("output_append", false)); } //Initialize the default logger this.Logger = new Logger("SWC"); Logger.Log("Logger Initialized"); //Setup the database var settings = Configuration.GetObject <ConnectionSettings>("SQL", new ConnectionSettings() { Host = "localhost", Database = "starwatch", Username = "******", Password = "******", Prefix = "sb_", }); DbContext = new DbContext(settings, Logger.Child("SQL")); //Make sure we actually encrypt if (string.IsNullOrEmpty(settings.Passphrase)) { throw new Exception("SQL Passphrase cannot be empty. This is used to encrypt sensitive player data!"); } //Initialize the region export directory PythonScriptsDirectory = Configuration.GetString("python_parsers", "Resources/py"); //Save the configuration with the defaults Configuration.Save(); //Setup the unhandled exception handler AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler); }
public StarboundHandler(Configuration configuration) { this.Configuration = configuration; //Initialize the threaded logger string outputFilename = Configuration.GetString("output", ""); if (!string.IsNullOrEmpty(outputFilename)) { OutputLogQueue.Initialize(outputFilename, Configuration.GetBool("output_append", false)); } //Initialize the region export directory PythonScriptsDirectory = Configuration.GetString("python_parsers", "Resources/py"); //Initialize the default logger this.Logger = new Logger("SWC"); //Setup the unhandled exception handler AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler); }