//Uploading and analyzing data line by line public void UploadAndCountDistinctSongCountSingular(string line) { try { //Create and object from line pSong = new PlayedSongsModel(line); //Check play time stamp for specific date if (pSong.PLAY_TS.Date == August10.Date) { //Check for repeated songs and add distinct song - client matchs if (clientHashSet.Add(pSong)) { //Check the dictionary for client if (countOfPlayedClientSongsDic.TryGetValue(pSong.CLIENT_ID, out int countOfSong)) { //If it is in dictionary increase counter countOfSong++; countOfPlayedClientSongsDic.Remove(pSong.CLIENT_ID); countOfPlayedClientSongsDic.Add(pSong.CLIENT_ID, countOfSong); } else { //If it is not in dictionary, add it countOfPlayedClientSongsDic.Add(pSong.CLIENT_ID, 1); } } } } catch (Exception) { throw; } }
//Uploading data to an object list public void UploadFileToList(string line) { pSong = new PlayedSongsModel(line); playedSongsList.Add(pSong); }