private void FindChangedFiles(Dictionary <string, long> filePositions) { // find all the files which have changed Dictionary <string, long> changedFilePositions = new Dictionary <string, long>(); foreach (KeyValuePair <string, long> kvp in filePositions) { changedFilePositions[kvp.Key] = kvp.Value; } // update the changed positions foreach (KeyValuePair <string, long> kvp in changedFilePositions) { previousFilePositions[kvp.Key] = kvp.Value.ToString(); } foreach (KeyValuePair <string, long> kvp in changedFilePositions) { VideoInfo v = recentlyPlayedFiles.Values.FirstOrDefault(a => a.Uri == kvp.Key); if (v != null) { logger.Info($"Video position for {v.Uri} has changed to {kvp.Value}"); v.ChangePosition(kvp.Value); //Set New Resume Position try { if (VM_ShokoServer.Instance.Trakt_IsEnabled && !string.IsNullOrEmpty(VM_ShokoServer.Instance.Trakt_AuthToken) && !scrobbleLock) { scrobblePosition = kvp.Value; scrobbleLock = true; traktHelper.TraktScrobble(TraktHelper.ScrobblePlayingStatus.Start, v, (int)kvp.Value, (int)v.Duration); scrobbleLock = false; } } catch (Exception) { scrobbleLock = false; } if (!MayUpdateWatchStatus(v, kvp.Value)) { return; } } } }
private void TimeTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { info.ChangePosition((long)(Time * 100)); if (Width == 0 && Height == 0) { string w = GetProperty("width"); int wd = 0; if (!string.IsNullOrEmpty(w)) { int.TryParse(w, out wd); if (wd == 0) { return; } } else { return; } int hg = 0; string h = GetProperty("height"); if (!string.IsNullOrEmpty(h)) { int.TryParse(h, out hg); if (hg == 0) { return; } } else { return; } Width = wd; Height = hg; form?.Resize(wd, hg); } }