public void AddData(IGameSessionData data) { using (SqliteConnection connection = GetConnection()) { connection.Open(); AddData(data, connection); } }
private void AddData(IGameSessionData data, SqliteConnection connection) { if (!IsValidGame(data.GetGameName()) || currentUser == null) { throw new ArgumentException(); } string sql = data.GetInsertionString(); using (SqliteCommand command = new SqliteCommand(sql, connection)) { command.ExecuteNonQuery(); } }
public void AddGraph(IGameSessionData[] data, string col, int[] discludeStages = null, string title = "Graph", int difficulty = 0) { List <float> colData = new List <float>(); List <DateTime> dateData = new List <DateTime>(); if (discludeStages != null) { data = data.Where((d) => !discludeStages.Contains(int.Parse(d.GetStringRepresentation("stage")))).ToArray(); } data = data.Where((d) => int.Parse(d.GetStringRepresentation("level")) == difficulty).ToArray(); for (int i = data.Length - 1; i >= 0; i--) { IGameSessionData gameData = data[i]; colData.Add(float.Parse(gameData.GetStringRepresentation(col))); dateData.Add((DateTime)gameData.GetSessionDate()); } graphViewer.AddGraphData(dateData, colData, title); }