Exemple #1
0
        private Dictionary <string, byte> Filter(IDataPlayerForChart allData, short countDay, FootballPosition positon)
        {
            DateTime date = (DateTime.Now).Subtract(new TimeSpan(countDay - 1, 0, 0, 0));

            Data data = allData.GetDataFromCurrentToSpecifiedDate(date);

            Dictionary <string, byte> filteredData = new Dictionary <string, byte>();


            foreach (var d in data)
            {
                filteredData.Add(d.Key.ToString("dd/MM/yy"), d.Value[positon]);
            }

            return(filteredData);
        }
        public void SaveDataForChart(IDataPlayerForChart data)
        {
            if (!Directory.Exists(_chartsDataPath))
            {
                Directory.CreateDirectory(_chartsDataPath);
            }

            string dataForPlayerPaht = _chartsDataPath + data.PlayerKeyName + _fileExtension;

            BinaryFormatter formatter = new BinaryFormatter();

            using (FileStream fs = new FileStream(dataForPlayerPaht, FileMode.OpenOrCreate))
            {
                formatter.Serialize(fs, data);
            }
        }
Exemple #3
0
        public IReadOnlyDictionary <string, byte> GetData(IFootballPlayer player, short countDay, FootballPosition positon)
        {
            if (positon != FootballPosition.Default)
            {
                ChartsDataLoader loader = new ChartsDataLoader();

                IDataPlayerForChart allData = loader.LoadDataForChart(player);

                if (allData == null)
                {
                    return(null);
                }

                return(Filter(allData, countDay, positon));
            }

            return(null);
        }