public void Fetch() { if (!_mutexFetch.WaitOne(0)) //try get mutex { //already a fetch in progress _mutexFetch.WaitOne(); //wait on finish _mutexFetch.ReleaseMutex(); return; } if (_providerData == null) { // InfoUrl = SjInfo.SearchSjDe(Name); ProviderData = ProviderManager.GetProvider().FindShow(Name); Status = "Unknown"; } if (_providerData != null) { ShowInformation si = ProviderManager.GetProvider().GetShowInformation(ProviderData, false, true); if (si != null) { Status = si.Status; PreviousEpisodeDate = si.PreviousEpisodeDate; PreviousEpisodeSeasonNr = si.PreviousEpisodeSeasonNr; PreviousEpisodeEpisodeNr = si.PreviousEpisodeEpisodeNr; NextEpisodeDate = si.NextEpisodeDate; NextEpisodeEpisodeNr = si.NextEpisodeEpisodeNr; NextEpisodeSeasonNr = si.NextEpisodeSeasonNr; } } try { IsLoading = true; String cover; var episodes = SjInfo.ParseSjOrgSite(_show, out cover, Settings.Instance.UploadCache); AllDownloads = episodes; if (cover != "") { Cover = cover; } _mutexFetch.ReleaseMutex(); if (_resetOnRefresh) { _resetOnRefresh = false; ApplyFilter(true); } else { ApplyFilter(false); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { IsLoading = false; } }
public static async void LogixStart(ShowInformation showInformation) { showInformation.Hide(); if (mShowInformation != null) { mShowInformation.ThisWindowClose = true; await Task.Delay(100); mShowInformation.Close(); } mShowInformation = showInformation; Users.Clear(); await CehckStartGame(); if (FileControl.AutoSearching) { GameSearchLogicStart(); await AddUsers(); } else { if (gameType != GameType.무작위_총력전) { BitmapSource capturedImage = ScreenCapture.GetGameType(gameWindowX, gameWindowY); gameType = ImageSearchClass.GetGameType(capturedImage); } Debug.WriteLine("게임 타입 : " + gameType); ShowInformationViewModel.viewModelObject.GameType = gameType; await Task.Delay(2000); NewAddUsers(); } GameLoop(); }
/// <summary> /// Permet de créer un nouveau ShowModel. /// </summary> /// <param name="serie"></param> /// <returns></returns> private async Task <ShowModel> CreateNewShowModel(ShowInformation serie) { ShowModel showModel = new ShowModel(); var temp = await ClientTmDb.SearchTvShowAsync(serie.Titre); await Task.Delay(500); if (temp.Results.Count > 0) { var tempSerieTrouve = temp.Results[0]; // Récupération des informations de TmDb. TvShow tvShow = await ClientTmDb.GetTvShowAsync(tempSerieTrouve.Id); await Task.Delay(500); TvSeason saison = await ClientTmDb.GetTvSeasonAsync(tempSerieTrouve.Id, serie.Saison); await Task.Delay(500); TvEpisode episode = await ClientTmDb.GetTvEpisodeAsync(tempSerieTrouve.Id, serie.Saison, serie.Episode); showModel.TvShow = tvShow; showModel.TvSeasons.Add(saison); showModel.TvEpisodes.Add(episode); showModel.ShowInformation.Add(serie); } return(showModel); }
private async Task GetSeasonAndEpisodeInformation(Guid idShow, ShowInformation serieLocal) { // Si la saison est connu. if (_serieCollection.HaveSeason(idShow, serieLocal.Saison)) { // Si Episode est non connu. if (!_serieCollection.HaveEpisode(idShow, serieLocal.Saison, serieLocal.Episode)) { int idSerie = _serieCollection.GetIdSerieTmDb(idShow); TvEpisode episode = await ClientTmDb.GetTvEpisodeAsync(idSerie, serieLocal.Saison, serieLocal.Episode); lock (_objetToLock) { _serieCollection.AddEpisode(idShow, episode, serieLocal); } } } else { // Cas ou il ne connait pas la saison. int idSerie = _serieCollection.GetIdSerieTmDb(idShow); TvSeason saison = await ClientTmDb.GetTvSeasonAsync(idSerie, serieLocal.Saison); await Task.Delay(500); TvEpisode episode = await ClientTmDb.GetTvEpisodeAsync(idSerie, serieLocal.Saison, serieLocal.Episode); lock (_objetToLock) { _serieCollection.AddSaison(idShow, saison, episode, serieLocal); } } }
/// <summary> /// Méthode permettant de récupérer les informations d'un fichier pour une série. /// </summary> /// <param name="title"></param> /// <param name="fileName"></param> /// <param name="sizeByte"></param> /// <returns></returns> public ShowInformation GetShow(string title, string fileName, long sizeByte) { ShowInformation result = new ShowInformation(); result.FileName = fileName; result.Size = sizeByte; title = RemoveExtraInformation(title); title = ReplaceCharacters(title); if (Regex.IsMatch(title, SAISON_PATTERN)) { result.Saison = GetSeasonOrEpisode(ref title, SAISON_PATTERN); } if (Regex.IsMatch(title, EPISODE_PATTERN)) { result.Episode = GetSeasonOrEpisode(ref title, EPISODE_PATTERN); } result.Resolution = GetResolution(ref title, RESOLUTION_PATTERN); result.Qualite = GetQuality(title, QUALITY_PATTERN); result.Langage = GetLanguage(title); result.Titre = GetTitle(title); return(result); }
/// <summary> /// Ajoute un épisode à la série donnée par l'id. /// </summary> /// <param name="idShow"></param> /// <param name="episode"></param> /// <param name="serieLocal"></param> public void AddEpisode(Guid idShow, TvEpisode episode, ShowInformation serieLocal) { ShowModel showModel = GetShowModel(idShow); showModel.TvEpisodes.Add(episode); showModel.ShowInformation.Add(serieLocal); AddNouveaute(showModel.TvSeasons.Where(x => x.SeasonNumber == episode.SeasonNumber).First(), episode); }
/// <summary> /// Ajoute la saison et un épisode à la série donnée par l'id. /// </summary> /// <param name="idShow"></param> /// <param name="saison"></param> /// <param name="episode"></param> /// <param name="serieLocal"></param> public void AddSaison(Guid idShow, TvSeason saison, TvEpisode episode, ShowInformation serieLocal) { ShowModel showModel = GetShowModel(idShow); showModel.TvSeasons.Add(saison); showModel.TvEpisodes.Add(episode); showModel.ShowInformation.Add(serieLocal); AddNouveaute(saison, episode); }
/// <summary> /// Récupère les informations sur les séries du chemin donnée. /// </summary> /// <param name="path"></param> /// <returns></returns> public IEnumerable <ShowInformation> GetShowsInformation(string path) { List <ShowInformation> retourInformations = new List <ShowInformation>(); FileInfo[] videoFiles = GetAllVideoFiles(path); foreach (var file in videoFiles) { string fileName = RemoveExtension(file); ShowInformation information = _showFileParser.GetShow(fileName, file.Name, file.Length); information.PathFile = file.FullName; retourInformations.Add(information); } return(retourInformations); }
IEnumerator OnResponse() { // Handles the HTTP request WWW www = new WWW(SanitizeAndRequestQuery()); //Wait for a response while (!www.isDone) { yield return(null); } // Assigns the JSON response to a string string jsonString = www.text; // Creates an ShowInformation Object from the JSON Response. ShowInformation query = JsonUtility.FromJson <ShowInformation>(jsonString); // Sends a message to the CanvasManager script that creates the program list on the UI. SendMessage("ReceiveShowInfo", query.data); yield return(query); }
static void Main(string[] args) { //print and read data. /*I don't implement a unit test for this class. * I have priorizited the calc tests*/ ReadData data = new ReadData(); //Using Building Pattern to create an employee Employee employee = BuilderEmployee.Create().EarnsForHour(data._hourRate) .WorkedFor(data._hoursWorked) .LivesIn(data._location).Build(); //validate objects EmployeeValidator employeeValidator = new EmployeeValidator(); ShowInformation information = new ShowInformation(); //verify if it a valid employee try { employeeValidator.ValidateAndThrow(employee); /* * I have used the Strategy patter to implement Open closed principle. * With this pattern I can associate countries and their relative Calculcate class. * * I don't implement a unit test for this class. * I have priorizited the calc tests */ CalculateStrategy calculate = new CalculateStrategy(employee); //this method exec all calcs from an employe var calcInformations = calculate.CalculateNetAmount(); information.Sucess(employee, calcInformations); } catch (ValidationException ex) { information.Error(ex.Message); } }
/// <summary> /// Permet d'enlever une vidéo du model, ainsi que les informations /// d'épisode TmDb (voir Saison si plus d'épisode). /// </summary> /// <param name="video"></param> internal void RemoveVideo(ShowInformation video) { ShowInformation.Remove(video); TvEpisode episodeToDelete = TvEpisodes.FirstOrDefault(x => x.SeasonNumber == video.Saison && x.EpisodeNumber == video.Episode); if (episodeToDelete != null) { TvEpisodes.Remove(episodeToDelete); if (TvEpisodes.All(x => x.SeasonNumber != video.Saison)) { TvSeason saison = TvSeasons.FirstOrDefault(x => x.SeasonNumber == video.Saison); if (saison != null) { TvSeasons.Remove(saison); } } } }
public static void handleGrandmasterLevelCommand(string[] commandParts) { if (commandParts.Length < 2) { Logger.Error("Grandmaster level must be specified"); return; } float level = float.Parse(commandParts[2]); // I added this to ensure opacity level is between 0 and 100. if (level < 0 || level > 100) { Logger.Error("Invalid level command received.\n Level must be between 0 and 100\n "); return; } try { ShowInformation showInformation = (ShowInformation)ContentObjectAccessor.GetObject("ShowInformation"); showInformation.Opacity = level; } catch (Exception e) { Logger.Error("Failed to set grandmaster level"); } }
public void Show(string text, string caption = "---") { ShowInformation?.Invoke(this, text, caption); }