private static void StartServer(VirtualTaluvaDataSection config) { try { var server = new BluffinServer(config.Port, typeof(Program).Assembly.FullName); server.Start(); } catch { DataTypes.Logger.LogError("Can't start server !!"); } }
public static void Init(VirtualTaluvaDataSection config) { var uri = new Uri(Assembly.GetExecutingAssembly().CodeBase); var path = $"{Path.GetDirectoryName(uri.LocalPath + uri.Fragment)}\\log"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var logName = DateTime.Now.ToString("yyyy-MM-dd.HH-mm-ss"); switch (config.Logging.File.Level) { case FileLoggerConfigElement.LVL_VERBOSE: { var sw = File.CreateText($"{path}\\server.{logName}.verbose.txt"); sw.AutoFlush = true; DataTypes.Logger.ErrorLogged += (sender, args) => LogError(sw, args.Info); DataTypes.Logger.WarningLogged += (sender, args) => LogWarning(sw, args.Info); DataTypes.Logger.InformationLogged += (sender, args) => LogInformation(sw, args.Info); DataTypes.Logger.DebugInformationLogged += (sender, args) => LogDebugInformation(sw, args.Info); DataTypes.Logger.VerboseInformationLogged += (sender, args) => LogDebugInformation(sw, args.Info); goto case FileLoggerConfigElement.LVL_DEBUG; } case FileLoggerConfigElement.LVL_DEBUG: { var sw = File.CreateText($"{path}\\server.{logName}.debug.txt"); sw.AutoFlush = true; DataTypes.Logger.ErrorLogged += (sender, args) => LogError(sw, args.Info); DataTypes.Logger.WarningLogged += (sender, args) => LogWarning(sw, args.Info); DataTypes.Logger.InformationLogged += (sender, args) => LogInformation(sw, args.Info); DataTypes.Logger.DebugInformationLogged += (sender, args) => LogDebugInformation(sw, args.Info); goto case FileLoggerConfigElement.LVL_NORMAL; } case FileLoggerConfigElement.LVL_NORMAL: { var sw = File.CreateText($"{path}\\server.{logName}.txt"); sw.AutoFlush = true; DataTypes.Logger.ErrorLogged += (sender, args) => LogError(sw, args.Info); DataTypes.Logger.WarningLogged += (sender, args) => LogWarning(sw, args.Info); DataTypes.Logger.InformationLogged += (sender, args) => LogInformation(sw, args.Info); break; } } }
public static void Init(VirtualTaluvaDataSection config) { DataTypes.Logger.ErrorLogged += (sender, args) => LogError(args.Info); DataTypes.Logger.WarningLogged += (sender, args) => LogWarning(args.Info); switch (config.Logging.Console.Level) { case ConsoleLoggerConfigElement.LVL_VERBOSE: DataTypes.Logger.VerboseInformationLogged += (sender, args) => LogVerboseInformation(args.Info); goto case ConsoleLoggerConfigElement.LVL_DEBUG; case ConsoleLoggerConfigElement.LVL_DEBUG: DataTypes.Logger.DebugInformationLogged += (sender, args) => LogDebugInformation(args.Info); goto case ConsoleLoggerConfigElement.LVL_NORMAL; case ConsoleLoggerConfigElement.LVL_NORMAL: DataTypes.Logger.InformationLogged += (sender, args) => LogInformation(args.Info); break; } }
//private static Logger.DBAccess.Server m_LogServer; //private static readonly Dictionary<int, Table> m_LogTables = new Dictionary<int, Table>(); //private static readonly Dictionary<int, Game> m_LogGames = new Dictionary<int, Game>(); //private static readonly Dictionary<int, bool> m_LogGamesStatus = new Dictionary<int, bool>(); //private static readonly Dictionary<IBluffinClient, Client> m_LogClients = new Dictionary<IBluffinClient, Client>(); public static void Init(VirtualTaluvaDataSection config) { if (!config.Logging.DbCommand.HasIt) { return; } //Database.InitDatabase(config.Logging.DbCommand.Url, config.Logging.DbCommand.User, config.Logging.DbCommand.Password, config.Logging.DbCommand.Database); DataTypes.Logger.CommandSent += OnLogCommandSent; DataTypes.Logger.CommandReceived += OnLogCommandReceived; DataTypes.Logger.TableCreated += OnLogTableCreated; DataTypes.Logger.GameCreated += OnLogGameCreated; DataTypes.Logger.GameEnded += OnLogGameEnded; DataTypes.Logger.ClientCreated += OnLogClientCreated; DataTypes.Logger.ClientIdentified += OnLogClientIdentified; DataTypes.Logger.ClientAdditionalInfo += OnLogClientAdditionalInfo; //m_LogServer = new Logger.DBAccess.Server($"{Assembly.GetEntryAssembly().GetName().Name} {Assembly.GetEntryAssembly().GetName().Version.ToString(3)}", Assembly.GetAssembly(typeof(AbstractCommand)).GetName().Version); //m_LogServer.RegisterServer(); }