internal void Inner(int port, string dir, ASCServer ascws) { if (ascws == null) // running from service { "Please avoid running the ASC server from service due to possibly incorrect initialization".Warn(); Main(new string[] { ARG_IGNMTX }); return; } "Connecting to the internal database ...".Msg(); using (database = Database.Instance) try { #region DATABASE INIT ascws.tSQL = database; #if DEBUG database.DebugMode = true; #endif $"Connected to the database with the connection ID {{{database.Connection.ClientConnectionId}}}".Ok(); foreach (string table in new string[] { "ChatMembers", "ChatMessages", "Chats", "Messages", "Users", "UserAuthentifications" }) { if (!database.Exists(table)) { $"Table '{table}' could not be found. It will be re-created ...".Warn(); database.CreateNew(table); } $"Table '{table}' loaded.".Ok(); } foreach (string function in new string[] { "Trim" }) { if (!database.ContainsFunction(function)) { $"Function '{function}' could not be found. It will be re-created ...".Warn(); database.CreateFunction(function); } $"Function '{function}' loaded.".Ok(); } database.Cleanup(); $"{database.UserCount} registered user(s) have been found inside the database.".Msg(); $"{database.AdminCount} registered administrator(s) have been found inside the database.".Msg(); $"{database.MessageCount} sent message(s) have been found inside the database.".Msg(); $"{database.ChatCount} chat(s)/group(s) have been found inside the database.".Msg(); Authentification.Start(); #endregion #region LOCATION UPDATER $"Starting the location caching service with a cache-time of {HTTPServer.LOCATION_CACHE_TIME / 1000f:F1} seconds ...".Msg(); HTTPServer._locuptmr = new Timer(delegate { "Updating the location cache ...".Msg(); (string IP, GeoIPResult Result)[] ips;