Exemple #1
0
 public StoreView(StoreEntry entry)
 {
     Stage = entry.Stage;
     Player = entry.Player;
     Type = entry.Type;
     Group = entry.Group;
     View = entry.View;
     TimeEnter = entry.TimeEnter;
     TimeExit = entry.TimeExit;
     TotalPayoff = entry.TotalPayoff;
     Payoff = entry.Payoff;
     Offer = entry.Offer;
     Accepted = entry.Accepted;
     //ExtendedStore = entry.ExtendedStore;
 }
Exemple #2
0
        /// <summary>
        /// Transforms a CSV file to an IOnEx Game Store
        /// </summary>
        /// <param name="url">Url of the CSV file</param>
        /// <returns>List of GameStore rows</returns>
        private List<StoreEntry> Csv2Store(string url)
        {
            StoreEntry row;
            List<StoreEntry> store = new List<StoreEntry>();
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            StreamReader sr = new StreamReader(resp.GetResponseStream());
            CsvConfiguration config = new CsvConfiguration { Delimiter = ";" };
            CsvReader csvr = new CsvReader(sr, config);
            var rows = csvr.GetRecords<StoreEntryIo>().ToList();

            // Transform to standard store
            foreach (var r in rows)
            {
                row = new StoreEntry
                {
                    Stage = r.Stage,
                    Player = r.Player,
                    Type = r.Type,
                    Group = r.Group,
                    View = r.View,
                    TotalPayoff = r.TotalPayoff,
                    Payoff = r.Payoff,
                    TimeEnter = DateTime.MinValue,
                    TimeExit = DateTime.MinValue
                };
                store.Add(row);
            }
            return store;
        }