public void add(BetTableEntry betTableEntry) { if (!entries.Contains(betTableEntry)) { entries.Add(betTableEntry); } }
public BetTableEntry[] readTableEntries() { List <BetTableEntry> table = new List <BetTableEntry>(); XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlNode tbody = doc.GetElementsByTagName("tbody")[0]; XmlNodeList rows = tbody.SelectNodes("tr"); foreach (XmlNode row in rows) { XmlNodeList data = row.SelectNodes("td"); if (data.Count == 3) { int nonce = int.Parse(data[0].InnerText); int winnerNo = int.Parse(data[1].InnerText); int pot = int.Parse(data[2].InnerText); BetTableEntry temp = new BetTableEntry(nonce, winnerNo, pot); table.Add(temp); } else { Console.Error.WriteLine("Invalid data length on row: " + row.InnerXml); } } return(table.ToArray()); }
public override bool Equals(Object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { BetTableEntry p = (BetTableEntry)obj; return(this.nonce == p.nonce); } }