public CharacterDatabase(Player player) { pData = player; db = new CharacterDB(); dbError = db.Open(); if (dbError.Number != 0) { Global.WriteLog(LogType.System, $"Cannot connect to database", LogColor.Red); Global.WriteLog(LogType.System, $"Error Number: {dbError.Number}", LogColor.Red); Global.WriteLog(LogType.System, $"Error Message: {dbError.Message}", LogColor.Red); } }
private static void SavePlayer(int index) { var pData = Players[index]; var db = new CharacterDB(); var dbError = db.Open(); if (dbError.Number != 0) { Global.WriteLog(LogType.System, $"Cannot connect to database", LogColor.Red); Global.WriteLog(LogType.System, $"Error Number: {dbError.Number}", LogColor.Red); Global.WriteLog(LogType.System, $"Error Message: {dbError.Message}", LogColor.Red); } else { db.UpdateCharacter(pData); db.Close(); } }