TraktPlugin.TraktHandlers.VideoInfo.Equals C# (CSharp) Method

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            return (this.ToString().Equals(((VideoInfo)obj).ToString()));
        }

Usage Example

        public bool Scrobble(string filename)
        {
            StopScrobble();

            if (!g_Player.IsTV)
            {
                return(false);
            }

            try
            {
                CurrentProgram = GetCurrentProgram();
            }
            catch (Exception e)
            {
                TraktLogger.Error(e.Message);
                return(false);
            }
            if (CurrentProgram == null)
            {
                return(false);
            }
            CurrentProgram.IsScrobbling = true;

            if (CurrentProgram.Type == VideoType.Series)
            {
                TraktLogger.Info("Detected tv-series '{0}' playing in 4TR TV Live", CurrentProgram.ToString());
            }
            else
            {
                TraktLogger.Info("Detected movie '{0}' playing in 4TR TV Live", CurrentProgram.ToString());
            }

            #region scrobble timer
            TraktTimer = new Timer(new TimerCallback((stateInfo) =>
            {
                Thread.CurrentThread.Name = "Scrobble";

                // get the current program airing on tv now
                // this may have changed since last status update on trakt
                VideoInfo videoInfo = GetCurrentProgram();

                if (videoInfo != null)
                {
                    // if we are watching something different,
                    // check if we should mark previous as watched
                    if (!videoInfo.Equals(CurrentProgram))
                    {
                        TraktLogger.Info("Detected new tv program has started '{0}' -> '{1}'", CurrentProgram.ToString(), videoInfo.ToString());
                        if (IsProgramWatched(CurrentProgram) && CurrentProgram.IsScrobbling)
                        {
                            ScrobbleProgram(CurrentProgram);
                        }
                        CurrentProgram.IsScrobbling = true;
                    }

                    // continue watching new program
                    // dont try to scrobble if previous attempt failed
                    if (CurrentProgram.IsScrobbling)
                    {
                        if (videoInfo.Type == VideoType.Series)
                        {
                            videoInfo.IsScrobbling = BasicHandler.ScrobbleEpisode(videoInfo, TraktScrobbleStates.watching);
                        }
                        else
                        {
                            videoInfo.IsScrobbling = BasicHandler.ScrobbleMovie(videoInfo, TraktScrobbleStates.watching);
                        }

                        // set current program to new program
                        CurrentProgram = videoInfo;
                    }
                }
            }), null, 1000, 300000);
            #endregion

            return(true);
        }
All Usage Examples Of TraktPlugin.TraktHandlers.VideoInfo::Equals