diff --git a/FFXIVClassic Lobby Server/ClientConnection.cs b/FFXIVClassic Lobby Server/ClientConnection.cs index 76e77fd9..fb103a5b 100644 --- a/FFXIVClassic Lobby Server/ClientConnection.cs +++ b/FFXIVClassic Lobby Server/ClientConnection.cs @@ -1,14 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Net.Sockets; using FFXIVClassic_Lobby_Server.packets; -using System.Diagnostics; using FFXIVClassic_Lobby_Server.common; using System.Collections.Concurrent; -using System.IO; using Cyotek.Collections.Generic; using System.Net; diff --git a/FFXIVClassic Lobby Server/ConfigConstants.cs b/FFXIVClassic Lobby Server/ConfigConstants.cs index 7968aa5e..75d96000 100644 --- a/FFXIVClassic Lobby Server/ConfigConstants.cs +++ b/FFXIVClassic Lobby Server/ConfigConstants.cs @@ -1,18 +1,16 @@ -using FFXIVClassic_Lobby_Server.common; -using STA.Settings; +using STA.Settings; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FFXIVClassic_Lobby_Server { class ConfigConstants { public static String OPTIONS_BINDIP; - public static bool OPTIONS_TIMESTAMP = false; + public static String OPTIONS_PORT; + public static bool OPTIONS_TIMESTAMP = false; + public static String OPTIONS_LOGPATH; + public static String OPTIONS_LOGFILE; public static String DATABASE_HOST; public static String DATABASE_PORT; @@ -22,20 +20,23 @@ namespace FFXIVClassic_Lobby_Server public static bool load() { - Console.Write("Loading config.ini file... "); + Console.Write("Loading lobby_config.ini file... "); - if (!File.Exists("./config.ini")) + if (!File.Exists("./lobby_config.ini")) { Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine("[FILE NOT FOUND]"); + Console.WriteLine(String.Format("[FILE NOT FOUND]")); Console.ForegroundColor = ConsoleColor.Gray; return false; } - INIFile configIni = new INIFile("./config.ini"); + INIFile configIni = new INIFile("./lobby_config.ini"); ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1"); - ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true"); + ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "54994"); + ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true"); + ConfigConstants.OPTIONS_LOGPATH = configIni.GetValue("General", "log_path", "./logs/"); + ConfigConstants.OPTIONS_LOGFILE = configIni.GetValue("General", "log_file_name", String.Format("lobby_{0}_{1}.log", OPTIONS_BINDIP, OPTIONS_PORT)); ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", ""); ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", ""); @@ -44,7 +45,7 @@ namespace FFXIVClassic_Lobby_Server ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", ""); Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine("[OK]"); + Console.WriteLine(String.Format("[OK]")); Console.ForegroundColor = ConsoleColor.Gray; return true; diff --git a/FFXIVClassic Lobby Server/Database.cs b/FFXIVClassic Lobby Server/Database.cs index 1f7ec710..fcf706d9 100644 --- a/FFXIVClassic Lobby Server/Database.cs +++ b/FFXIVClassic Lobby Server/Database.cs @@ -1,14 +1,11 @@ using FFXIVClassic_Lobby_Server.dataobjects; using MySql.Data.MySqlClient; using Dapper; -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.utils; +using FFXIVClassic_Lobby_Server.common; namespace FFXIVClassic_Lobby_Server { @@ -35,7 +32,10 @@ namespace FFXIVClassic_Lobby_Server } } catch (MySqlException e) - { Console.WriteLine(e); } + { + Log.error(e.ToString()); + + } finally { conn.Dispose(); @@ -88,6 +88,10 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + + Log.error(e.ToString()); + pid = 0; cid = 0; } @@ -179,6 +183,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + conn.Dispose(); return; } @@ -202,6 +208,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + conn.Dispose(); return; } @@ -222,6 +230,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + } finally @@ -267,6 +277,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + } finally @@ -298,6 +310,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + } finally @@ -320,7 +334,9 @@ namespace FFXIVClassic_Lobby_Server worldList = conn.Query("SELECT * FROM servers WHERE isActive=true").ToList(); } catch (MySqlException e) - { worldList = new List(); } + { + Log.error(e.ToString()); + worldList = new List(); } finally { conn.Dispose(); @@ -340,7 +356,9 @@ namespace FFXIVClassic_Lobby_Server world = conn.Query("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault(); } catch (MySqlException e) - { + { + Log.error(e.ToString()); + } finally { @@ -476,6 +494,8 @@ namespace FFXIVClassic_Lobby_Server } catch (MySqlException e) { + Log.error(e.ToString()); + } finally { @@ -497,7 +517,9 @@ namespace FFXIVClassic_Lobby_Server nameList = conn.Query("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList(); } catch (MySqlException e) - { nameList = new List(); } + { + Log.error(e.ToString()); + nameList = new List(); } finally { conn.Dispose(); @@ -517,7 +539,9 @@ namespace FFXIVClassic_Lobby_Server retainerList = conn.Query("SELECT * FROM retainers WHERE id=@UserId ORDER BY characterId, slot", new { UserId = userId }).ToList(); } catch (MySqlException e) - { retainerList = new List(); } + { + Log.error(e.ToString()); + retainerList = new List(); } finally { conn.Dispose(); diff --git a/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj b/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj index b3ade4da..00c7db3a 100644 --- a/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj +++ b/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj @@ -11,6 +11,21 @@ FFXIVClassic_Lobby_Server v4.5 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true AnyCPU @@ -94,9 +109,21 @@ + + + False + Microsoft .NET Framework 4.5 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + - copy "$(SolutionDir)data\config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" + copy "$(SolutionDir)data\lobby_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"