public override DataSet Clone() { ReplayStore cln = ((ReplayStore)(base.Clone())); cln.InitVars(); return(cln); }
/// <summary> /// Creates a DataView of the Player details which can be sorted, filtered and adjusted /// </summary> /// <param name="storeReader"></param> /// <param name="recs"></param> /// <returns>DataView of all Players sorted by Games DESC</returns> public static DataView CreatePlayerDataView(StoreReader storeReader, ReplayStore recs) { DataTable table = new DataTable("Players"); table.Columns.Add("Player", typeof(string)); table.Columns.Add("Games", typeof(int)); table.Columns.Add("ReplayID", typeof(int)); Debug.WriteLine(table); DataRow dvRow = null; //create a hash table to store the unique player names foreach (ReplayStore.PlayerRow row in recs.Player) { object reps = storeReader.PlayerReplays(row.Name); if (reps != System.DBNull.Value) { dvRow = table.NewRow(); dvRow["Player"] = row.Name; dvRow["Games"] = (int)reps; dvRow["ReplayID"] = row.ReplayID; table.Rows.Add(dvRow); } } DataView dvPlayers = new DataView(table, "", "Games DESC", DataViewRowState.CurrentRows); dvPlayers.Table.CaseSensitive = false; return dvPlayers; }
public void ReadReplays() { recs = new ReplayStore(); recs.ReadXml(ReplaysFilename); }
/// <summary> /// Attempts to read both the Categories and Replays store /// </summary> public bool Read() { try { cats = new CategoryStore(); cats.ReadXml(CategoriesFilename); recs = new ReplayStore(); recs.ReadXml(ReplaysFilename); return true; } catch { } return false; }
public static DataView CreateReplayDataView(StoreReader storeReader, ReplayStore recs) { DataTable table = new DataTable("Replays"); table.Columns.Add("ReplayID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Modified", typeof(DateTime)); table.Columns.Add("Added", typeof(DateTime)); table.Columns.Add("Filename", typeof(string)); table.Columns.Add("CategoryID", typeof(int)); DataRow dvRow; foreach (ReplayStore.ReplayRow row in recs.Replay) { dvRow = table.NewRow(); dvRow["ReplayID"] = row.ID; dvRow["Name"] = row.Name; dvRow["Modified"] = row.DateModified; dvRow["Added"] = row.DateAdded; dvRow["Filename"] = row.Filename; dvRow["CategoryID"] = row.CategoryID; table.Rows.Add(dvRow); } DataView dvReplays = new DataView(table, "", "Added DESC", DataViewRowState.CurrentRows); dvReplays.Table.CaseSensitive = false; return dvReplays; }
/// <summary> /// Creates a DataView of the Player details which can be sorted, filtered and adjusted /// </summary> /// <param name="storeReader"></param> /// <param name="recs"></param> /// <returns>DataView of all Maps sorted by Games DESC</returns> public static DataView CreateMapDataView(StoreReader storeReader, ReplayStore recs) { DataTable table = new DataTable("Maps"); table.Columns.Add("Map", typeof(string)); table.Columns.Add("Games", typeof(int)); table.Columns.Add("ReplayID", typeof(int)); DataRow dvRow; foreach (ReplayStore.MapRow row in recs.Map) { object reps = storeReader.MapReplays(row.Name); if (reps != System.DBNull.Value) { dvRow = table.NewRow(); dvRow["Map"] = row.Name; dvRow["Games"] = (int)reps; dvRow["ReplayID"] = row.ReplayID; table.Rows.Add(dvRow); } } DataView dvMaps = new DataView(table, "", "Games DESC", DataViewRowState.CurrentRows); dvMaps.Table.CaseSensitive = false; return dvMaps; }