internal void Parse(TorrentsList TorrentsToParse, bool IsFresh) { List <string> ListOfHashes = new List <string>(); foreach (string[] TorrentArray in TorrentsToParse) { if (TorrentArray.Length == 0) { throw new FormatException("The array of torrent data was not in the expected format, it contains 0 elements."); } ListOfHashes.Add(TorrentArray[0]); Torrent NewTorrent = GetByHashCode(TorrentArray[0]); if (NewTorrent == null) { NewTorrent = new Torrent(TorrentArray, this); _torrentCollectionInternal.Add(NewTorrent); if (!IsFresh) { ParentClient.CallEvent(UTorrentWebClient.EventType.Added, NewTorrent); } CallCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, NewTorrent)); } else { NewTorrent.UpdateValuesFromStringArray(TorrentArray); } } IEnumerable <Torrent> RemovedTorrents = RemoveWhereHashCodeIsNotInList(ListOfHashes); foreach (Torrent RemovedTorrent in RemovedTorrents) { CallCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, RemovedTorrent)); } }