//------------------------------------------------------------- public void GotTorrentStatus(DTO_TorrentStatus torrentStatus) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(torrentStatus.key)).FirstOrDefault(); if (suggestedGameControl == null) { Log.Get().Write("KobberLan DTO_TorrentStatus unknown title: " + torrentStatus.key, Log.LogType.Error); } else { //Remove game if (torrentStatus.status == TorrentStatusType.Remove) { Torrent.Get().StopSharing(torrentStatus.key); suggestedGameControl.Remove(); suggestedGameControl.Dispose(); suggestedGames.Remove(suggestedGameControl); flowLayoutPanel_SuggestedGames.Controls.Remove(suggestedGameControl); } else //Update controller status { suggestedGameControl.UpdateStats(torrentStatus); } } }
//------------------------------------------------------------- public void GotAlreadyOwnIt(DTO_AlreadyOwnIt alreadyOwnIt) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(alreadyOwnIt.key) && L.GetType() == typeof(SuggestedGameOwnerControl)).FirstOrDefault(); if (suggestedGameControl == null) { Log.Get().Write("KobberLan DTO_AlreadyOwnIt unknown title: " + alreadyOwnIt.key, Log.LogType.Error); } else { ((SuggestedGameOwnerControl)suggestedGameControl).IncreasePeer(alreadyOwnIt.address.ToString()); } }
//------------------------------------------------------------- public void GotLike(DTO_Like like) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(like.key)).FirstOrDefault(); if (suggestedGameControl == null) { Log.Get().Write("KobberLan DTO_Like unknown title: " + like.key, Log.LogType.Error); } else { suggestedGameControl.UpdateLike(like); } }
//------------------------------------------------------------- public void GotTorrent(DTO_Torrent torrent) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(torrent.key)).FirstOrDefault(); if (suggestedGameControl == null) { Log.Get().Write("KobberLan DTO_Torrent unknown title: " + torrent.key, Log.LogType.Error); } else { suggestedGameControl.UpdateTorrent(torrent); } }
//------------------------------------------------------------- public void GotGameStatus(DTO_GameStatus gameStatus) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(gameStatus.key)).FirstOrDefault(); if (suggestedGameControl == null) { Log.Get().Write("KobberLan DTO_GameStatus unknown title: " + gameStatus.key, Log.LogType.Error); } else { suggestedGameControl.UpdateGameStatus(gameStatus); } }
//------------------------------------------------------------- public bool UpdateProgressBar(MonoTorrent.Client.TorrentState type, int progress, string title) //------------------------------------------------------------- { SuggestedGame suggestedGameControl = suggestedGames.Where(L => L.GetKey().Equals(title)).FirstOrDefault(); if (suggestedGameControl == null) { if (type != MonoTorrent.Client.TorrentState.Stopped && type != MonoTorrent.Client.TorrentState.Stopping) { Log.Get().Write("KobberLan UpdateProgressbar unknown title: " + title, Log.LogType.Error); } return(false); } else { suggestedGameControl.UpdateProgressBar(type, progress); return(true); } }