private void btnLoop_Click(object sender, EventArgs e)
        {
            switch (RepeatState)
            {
            case RepState.ListNoLoop:
                RepeatState = RepState.ListLoop;
                SendNetEaseLeftClick(PreDefinedPoints[MO_Repeat]);
                btnLoop.BackgroundImage = ListLoop;
                break;

            case RepState.ListLoop:
                RepeatState = RepState.OneLoop;
                SendNetEaseLeftClick(PreDefinedPoints[MO_Repeat]);
                btnLoop.BackgroundImage = OneLoop;
                break;

            case RepState.OneLoop:
                RepeatState = RepState.Random;
                SendNetEaseLeftClick(PreDefinedPoints[MO_Repeat]);
                btnLoop.BackgroundImage = Properties.Resources.Random;
                break;

            case RepState.Random:
                RepeatState = RepState.ListNoLoop;
                SendNetEaseLeftClick(PreDefinedPoints[MO_Repeat]);
                btnLoop.BackgroundImage = ListNoLoop;
                break;
            }
        }
        private void GetNeteasePlayingState()
        {
Retry:
            RepeatState = DoImageCompare();
            if (RepeatState != RepState.Unknown)
            {
                switch (RepeatState)
                {
                case RepState.ListLoop:
                    btnLoop.BackgroundImage = ListLoop;
                    break;

                case RepState.ListNoLoop:
                    btnLoop.BackgroundImage = ListNoLoop;
                    break;

                case RepState.OneLoop:
                    btnLoop.BackgroundImage = OneLoop;
                    break;

                case RepState.Random:
                    btnLoop.BackgroundImage = Properties.Resources.Random;
                    break;
                }
            }
            else
            {
                Thread.Sleep(5);
                goto Retry;
            }

            if (KeyPointColors[KeyPoints[3]].R == 0xff && KeyPointColors[KeyPoints[3]].G == 0xff && KeyPointColors[KeyPoints[3]].B == 0xff)
            {
                PlayingState = PlayState.Playing;
            }
            else
            {
                PlayingState = PlayState.Paused;
            }
            if (KeyPointColors[KeyPoints[4]].R == 0x66 && KeyPointColors[KeyPoints[4]].G == 0x66 && KeyPointColors[KeyPoints[4]].B == 0x66)
            {
                LyricState             = LrcState.On;
                btnLrc.BackgroundImage = Lyric;
            }
            else
            {
                LyricState             = LrcState.Off;
                btnLrc.BackgroundImage = Lyric_Off;
            }
        }
        private RepState DoImageCompare()
        {
            TopMost = false;
            BringAllWindowToTop(NetEaseMainHandle);

            Bitmap NetEaseBitmap = GetNetEaseBitmap(NetEaseMainHandle);
            Dictionary <RepState, double> Possibility = new Dictionary <RepState, double>()
            {
                { RepState.ListLoop, 0 },
                { RepState.ListNoLoop, 0 },
                { RepState.OneLoop, 0 },
                { RepState.Random, 0 }
            };

            System.Drawing.Point p;
            p = GetImageContains(NetEaseBitmap, SAMP_ONEREP, 1);
            Possibility[RepState.OneLoop] = GetSimilarity(NetEaseBitmap, SAMP_ONEREP, p);
            p = GetImageContains(NetEaseBitmap, SAMP_NOREP, 1);
            Possibility[RepState.ListNoLoop] = GetSimilarity(NetEaseBitmap, SAMP_NOREP, p);
            p = GetImageContains(NetEaseBitmap, SAMP_ALLREP2, 1);
            Possibility[RepState.ListLoop] = GetSimilarity(NetEaseBitmap, SAMP_ALLREP2, p);
            p = GetImageContains(NetEaseBitmap, SAMP_RND, 1);
            Possibility[RepState.Random] = GetSimilarity(NetEaseBitmap, SAMP_RND, p);
            RepState LowestRepState = RepState.Unknown;
            double   LowestP        = 1.0;

            foreach (var elem in Possibility)
            {
                if (elem.Value < LowestP)
                {
                    LowestRepState = elem.Key;
                    LowestP        = elem.Value;
                }
            }
            tTopMostSetup_Tick(new object(), new EventArgs());
            return(LowestRepState);
        }