public async Task <IActionResult> Create([FromForm] UploadClass data)
        {
            IEnumerable <IFormFile> files = data.myFiles;

            foreach (var file in files)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    await file.CopyToAsync(ms);

                    byte[] bytes = ms.ToArray();
                    ClassService.Create(bytes);
                }
            }
            return(Ok());
        }
Exemple #2
0
        public ActionResult Index(int?fileId)
        {
            List <UploadClass> videolist = new List <UploadClass>();
            string             CS        = ConfigurationManager.ConnectionStrings["FilesEntities"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("select Id,Name,Path from Files", con);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    UploadClass video = new UploadClass();
                    video.Id   = int.Parse(rdr["Id"].ToString());
                    video.Name = rdr["Name"].ToString();
                    video.Path = rdr["Path"].ToString();

                    videolist.Add(video);
                }
            }
            return(View(videolist));
        }
Exemple #3
0
        private void updateScoreLabels(int e)
        {
            scoreDisplayText.Clear();
            //gotScore = false;
            if (!pickDiff)
            {

                displayScores = null;
                return;
            }
            SongInfo ss = songNameList[index].Info;
            scoreDisplayPage = e;
            //Console.WriteLine("updating score labels");
            int tIndex = 0;
            for (int x = 0; x < currentSong.Charts.Count; x++)
            {
                if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                {
                    tIndex = x;
                }
            }
            String diffName = currentSong.Charts[tIndex].Name;
            if (currentSong.FileVersion == 1)
            {
                if (Config.LocalScores)
                {
                    string tempFileName = ScoreLibrary.getFileFromDiff(ss, diffName);
                    string hash = Utils.calcHash(tempFileName);
                    //  List<Score> tempList = null;
                    if (File.Exists("replay\\" + hash + ".psf"))
                    {
                        if (currentUpload != null)
                        {
                            currentUpload.abort();
                        }
                        displayScores = ScoreLibrary.reconstruct("replay\\" + hash + ".psf");
                        displayScores.Sort(scoreCompare);
                        scoreDisplayText.Clear();
                        //if calculated upper bound exceeds displayscores.count, use count as upper bound instead
                        int upperlimit = displayScores.Count > scoreDisplayPage * 8 + 8 ? scoreDisplayPage * 8 + 8 : displayScores.Count;

                        for (int i = scoreDisplayPage * 8; i < upperlimit; i++)
                        {
                            int toset = i;
                            int loc = (i == 0 ? 0 : (i % 8));
                            Button toAdd = new Button(game, new Rectangle(Config.ResWidth, 200 + (loc * 60) + (loc * 1) /*1 px padding*/, 230, 60), "#" + (toset + 1) + " " + displayScores[toset].Player + " " + displayScores[toset].TotalScore.ToString("D8"), delegate(int data)
                            {
                                ScoreSelectScreen temp = (ScoreSelectScreen)game.screens["sSScreen"];
                                Game.setScreen(temp);
                                temp.Music = this.Music;
                                temp.setScore(displayScores[toset], currentSong, tIndex, data);
                            }, Skin.skindict["scoreentry"]);
                            toAdd.OtherData = i + 1;
                            scoreDisplayText.Add(toAdd);
                        }
                        return;
                    }
                    else
                    {
                        displayScores = null;
                        return;
                    }
                }
                else
                {
                    if (Account.currentAccount != null)
                    {
                        //online scores TODO
                        if (!gotScore)
                        {
                            gotScore = true;
                            string hash = Utils.calcHash(currentSong.Charts[tIndex].Path);
                            NameValueCollection n = new NameValueCollection();
                            n.Add("n", Account.currentAccount.AccountName);
                            n.Add("c", hash);

                            scoreDisplayText.Clear();
                            if (currentUpload != null)
                            {
                                //currentUpload.abort();
                            }
                            UploadClass uc = new UploadClass();
                            currentUpload = uc;
                            uc.additionalArg = tIndex; //hacky
                            uc.uploadDone += new Action<string, int>(uc_uploadDone);
                            uc.HttpUploadFileAsync("http://p.ulse.net/getscores", n);
                        }
                        //Game.game.Context.MakeCurrent(null); not gonna fly ;x
                        /*  I feel like I am flying so free across the sky
                            Like i'm diving in the air
                            I fly high the way you want it

                            Just gotta the way you want it.

                            Don't trip on the people
                            And things around you now
                            Keep lookin' ahead cousin
                            So glide on until you find it

                            Just gotta until you find it
                            In this limitless sky

                            Full speed ahead and I get high
                            Open the window (Look up the sky)
                            (That's the floating island in the legendary world)
                            Future is eternal, (Light, early-morning sunlight)
                            (The greatest, open up, look now with your left eye)

                            It's all a weird-ass place i'm in so weird a place
                            I'm tripping-out passing time
                            It's a wonderful way to free my mind
                            Up in the sky
                            I'm content to keep on flying.*/
                    }
                    else
                    {
                        Config.LocalScores = true;
                        ((ToggleButton)onlineToggle).toggle();
                    }
                }
            }
        }
Exemple #4
0
        private void updateScoreLabels(int e)
        {
            scoreDisplayText.Clear();
            //gotScore = false;
            if (!pickDiff)
            {
                displayScores = null;
                return;
            }
            SongInfo ss = songNameList[index].Info;

            scoreDisplayPage = e;
            //Console.WriteLine("updating score labels");
            int tIndex = 0;

            for (int x = 0; x < currentSong.Charts.Count; x++)
            {
                if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                {
                    tIndex = x;
                }
            }
            String diffName = currentSong.Charts[tIndex].Name;

            if (currentSong.FileVersion == 1)
            {
                if (Config.LocalScores)
                {
                    string tempFileName = ScoreLibrary.getFileFromDiff(ss, diffName);
                    string hash         = Utils.calcHash(tempFileName);
                    //  List<Score> tempList = null;
                    if (File.Exists("replay\\" + hash + ".psf"))
                    {
                        if (currentUpload != null)
                        {
                            currentUpload.abort();
                        }
                        displayScores = ScoreLibrary.reconstruct("replay\\" + hash + ".psf");
                        displayScores.Sort(scoreCompare);
                        scoreDisplayText.Clear();
                        //if calculated upper bound exceeds displayscores.count, use count as upper bound instead
                        int upperlimit = displayScores.Count > scoreDisplayPage * 8 + 8 ? scoreDisplayPage * 8 + 8 : displayScores.Count;

                        for (int i = scoreDisplayPage * 8; i < upperlimit; i++)
                        {
                            int    toset = i;
                            int    loc   = (i == 0 ? 0 : (i % 8));
                            Button toAdd = new Button(game, new Rectangle(Config.ResWidth, 200 + (loc * 60) + (loc * 1) /*1 px padding*/, 230, 60), "#" + (toset + 1) + " " + displayScores[toset].Player + " " + displayScores[toset].TotalScore.ToString("D8"), delegate(int data)
                            {
                                ScoreSelectScreen temp = (ScoreSelectScreen)game.screens["sSScreen"];
                                Game.setScreen(temp);
                                temp.Music = this.Music;
                                temp.setScore(displayScores[toset], currentSong, tIndex, data);
                            }, Skin.skindict["scoreentry"]);
                            toAdd.OtherData = i + 1;
                            scoreDisplayText.Add(toAdd);
                        }
                        return;
                    }
                    else
                    {
                        displayScores = null;
                        return;
                    }
                }
                else
                {
                    if (Account.currentAccount != null)
                    {
                        //online scores TODO
                        if (!gotScore)
                        {
                            gotScore = true;
                            string hash           = Utils.calcHash(currentSong.Charts[tIndex].Path);
                            NameValueCollection n = new NameValueCollection();
                            n.Add("n", Account.currentAccount.AccountName);
                            n.Add("c", hash);

                            scoreDisplayText.Clear();
                            if (currentUpload != null)
                            {
                                //currentUpload.abort();
                            }
                            UploadClass uc = new UploadClass();
                            currentUpload    = uc;
                            uc.additionalArg = tIndex; //hacky
                            uc.uploadDone   += new Action <string, int>(uc_uploadDone);
                            uc.HttpUploadFileAsync("http://p.ulse.net/getscores", n);
                        }
                        //Game.game.Context.MakeCurrent(null); not gonna fly ;x

                        /*  I feel like I am flying so free across the sky
                         *  Like i'm diving in the air
                         *  I fly high the way you want it
                         *
                         *  Just gotta the way you want it.
                         *
                         *  Don't trip on the people
                         *  And things around you now
                         *  Keep lookin' ahead cousin
                         *  So glide on until you find it
                         *
                         *  Just gotta until you find it
                         *  In this limitless sky
                         *
                         *  Full speed ahead and I get high
                         *  Open the window (Look up the sky)
                         *  (That's the floating island in the legendary world)
                         *  Future is eternal, (Light, early-morning sunlight)
                         *  (The greatest, open up, look now with your left eye)
                         *
                         *  It's all a weird-ass place i'm in so weird a place
                         *  I'm tripping-out passing time
                         *  It's a wonderful way to free my mind
                         *  Up in the sky
                         *  I'm content to keep on flying.*/
                    }
                    else
                    {
                        Config.LocalScores = true;
                        ((ToggleButton)onlineToggle).toggle();
                    }
                }
            }
        }
Exemple #5
0
        public override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);
            if (currentOffset > updateTime && updateTime != -1234)
            {
                score.TotalScore = scoreUpdate;
                score.Combo = comboUpdate;
                hp = hpUpdate;
                score.Accuracy = accUpdate;
                updateTime = -1234;
            }
            if (skip.Visible == true && keyPress(Config.SkipKey))
            {
                running = true;
                unpause();
                music.PositionAsMilli = (long)startOffset - 2000;
                currentOffset = music.PositionAsMilli;
                skip.Visible = false;
                skip.Enabled = false;
            }
            if (!Config.Specs.Equals(oldSpecs) && Config.Spectating)
            {
                userList.Update(Config.Specs);
                oldSpecs = Config.Specs;
            }
            else if (!Config.SpecsOnMe.Equals(oldSpecs) && Config.Spectated)
            {
                userList.Update(Config.SpecsOnMe);
                oldSpecs = Config.SpecsOnMe;
            }
            if (startOffset - currentOffset < 2000)
            {
                skip.Visible = false;
                skip.Enabled = false;
            }
            if (!paused)
            {
                heartbeatTime += e.Time;
                time1 += e.Time;
                time2 += e.Time;
                time3 += e.Time;
                if (time3 > 0.5)
                {
                    time3 = 0;
                    double min = Math.Floor((endOffset - music.PositionAsMilli) / 60000);
                    double sec = Math.Floor((endOffset - music.PositionAsMilli) % 60000);
                    sec = Math.Floor(sec / 1000);
                    countDown.Text = min.ToString("0#") + ":" + sec.ToString("0#");
                }
            }
            if (time2 > 0.05 && !comboText.moving && comboMove)
            {
                comboMove = false;
                comboText.scale(new Size((int)(frame.LaneWidth[0] * 1.5), (int)(frame.LaneWidth[0] * 1.5)), 0.12);
                comboText.move(new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, (int)(frame.LaneWidth[0] * 1.5))) / 2, frame.Location.Y + 200), 0.12);
            }
            if (!running && !paused && !scores)
            {
                currentOffset += e.Time * 1000 * mods.Speed;
                if (time1 > chart.LeadInTime / mods.Speed)
                {
                    running = true;
                    unpause();
                    time1 = 0;
                }
            }
            if (failed)
            {
                pause();
                try
                {
                    if (running == true)
                    {
                        if (Config.Spectated)
                        {
                            PacketWriter.sendSpectateFail(Game.conn.Bw);
                        }
                        PacketWriter.sendSongStart(Game.conn.Bw, Account.currentAccount.AccountName, "", "", (short)2, 0, 0, 0);
                    }
                }
                catch
                {
                }
                running = false;
                scores = false;
                pauseScreen.Failed = true;
            }
            if (scores)
            {
                if (invert)
                {
                    invert = false;
                    foreach (Note n in chart.Notes)
                    {
                        if (Config.Mirror)
                        {
                            n.Location = 9 - n.Location;
                        }
                    }
                }
                music.Speed = 0.0f;
                scoreScreen.OnUpdateFrame(e);
                if (scoreScreen.Score == null)
                {
                    scoreScreen.Score = score;
                }
                scoreFadeTime += e.Time;
                if (scoreFadeTime > 0.025 && overlay.Colour.A < 1.0f)
                {
                    float newAlpha = overlay.Colour.A + 0.2f;
                    overlay.Colour = new Color4(overlay.Colour.R, overlay.Colour.G, overlay.Colour.B, newAlpha);
                    scoreFadeTime = 0;
                }
            }
            if (keyPress(Key.Escape))
            {
                if (buffering || specFailed)
                {
                    Game.setScreen(game.screens["selectScreen"]);
                    game.Title = "Pulse";
                    try
                    {
                        PacketWriter.sendSpectateCancel(Game.conn.Bw, Config.SpectatedUser);
                        Config.Spectating = false;
                        Config.SpectatedUser = "";
                        buffering = false;
                    }
                    catch
                    {

                    }
                }
                else if (!running && paused && !scores && !failed)
                {
                    unpause();
                    //time = 0;
                    //running = true;
                }
                else if (!running && !scores && !failed)
                {
                    pause();
                }
                else if (!scores && !failed)
                {
                    if (currentOffset > endOffset - 1510)
                    {
                        forceScores = true;
                    }
                    else
                    {
                        togglePause();
                    }
                }
                else if (playType == PlayType.PLAY && !scores && failed)
                {
                    foreach (Note n in Chart.Notes)
                    {
                        if (Config.Mirror)
                        {
                            n.Location = 9 - n.Location;
                        }
                    }
                    loadSong(CurrentSong, Difficulty, mods, null, playType);
                    onSwitched();
                }
            }
            for (int i = 0; i < 8; i++)
            {
                if (!holding[i])
                {
                    canHit[i] = true;
                }
            }
            if (!paused && running)
            {
                currentOffset = music.PositionAsMilli + Config.Offset + (-7 * (music.Speed / 10));
            }
            if (replay)
            {
                #region replay
                if (!paused)
                {
                    if (playType == PlayType.SPECTATE)
                    {
                        if (bufferOffset - currentOffset < bufferGap)
                        {
                            pause();
                            buffering = true;
                            bufferAmount += 250;
                        }
                    }
                    pulse = true;
                    foreach (TimingSection t in currentSong.TimingsList)
                    {
                        if (currentOffset > t.Offset)
                        {
                            if (sectionSnap != t.Snap)
                            {
                                sectionSnap = t.Snap;
                                glow.Bounds = new Rectangle(new Point((int)frame.Location.X, (int)frame.HitHeight - 43), new Size((int)frame.Width, 40));
                            }
                        }
                    }
                    foreach (var pair in currentReplay.PressTimings)
                    {
                        if (currentOffset > pair.key && !pair.value.value)
                        {
                            pair.value.value = true;
                            keys[pair.value.key] = true;
                            int temp = 0;
                            for (int x = 0; x < pair.value.key; x++)
                            {
                                temp += frame.LaneWidth[x];
                            }
                            lights[pair.value.key].fade(0.65f, 0.075);
                            lights[pair.value.key].move(new Point((int)frame.Location.X + (frame.LaneLoc[pair.value.key]) + (1 * pair.value.key) + 5, 96), 0.1);
                            lights[pair.value.key].scale(new Size(frame.LaneWidth[pair.value.key], (int)frame.HitHeight - 99), 0.1);
                            glows[pair.value.key].fade(0.65f, 0.075);
                            presses[pair.value.key].fade(1.0f, 0.05);
                        }
                    }
                    foreach (var pair in currentReplay.ReleaseTimings)
                    {
                        if (currentOffset > pair.key && !pair.value.value)
                        {
                            pair.value.value = true;
                            keys[pair.value.key] = false;
                            int temp = 0;
                            for (int x = 0; x < pair.value.key; x++)
                            {
                                temp += frame.LaneWidth[x];
                            }
                            lights[pair.value.key].fade(0.0f, 0.075);
                            lights[pair.value.key].move(new Point((int)frame.Location.X + (frame.LaneLoc[pair.value.key] + (1 * pair.value.key)) + 5 + 25, 596), 0.075);
                            lights[pair.value.key].scale(new Size(0, (int)frame.HitHeight - 599), 0.05);
                            glows[pair.value.key].fade(0.0f, 0.075);
                            presses[pair.value.key].fade(0.0f, 0.05);
                        }
                    }
                }
                else
                {
                    pulse = false;
                }
                if (playType != PlayType.TEST && (currentOffset > endOffset && !scores) || (music.PositionAsMilli == music.Length && !scores))
                {
                    scores = true;
                    if (playType == PlayType.SPECTATE)
                    {
                        this.score = finalScore;
                    }
                    try
                    {
                        PacketWriter.sendSongStart(Game.conn.Bw, Account.currentAccount.AccountName, "", "", (short)2, 0, 0, 0);
                    }
                    catch
                    {
                    }
                    scoreScreen = new ScoreScreen(game, "scores", currentReplay, currentSong, difficulty, false);
                    scoreScreen.OnLoad(null);
                    paused = false;
                    running = false;
                    SongInfo curr = SongLibrary.songInfos[CurrentSong.PncName];
                    String cstring = chart.Name;
                    score.chartName = chart.Name;
                    score.ArtistTitle = currentSong.Artist + " - " + currentSong.SongName;
                    score.dateString = DateTime.Now.ToString();
                    scoreScreen.Score = score;
                }
                if (!scores)
                {
                    foreach (ReplayHit r in currentReplay.HitTimings)
                    {
                        if (r.Used == false && currentOffset > r.NoteOffset - r.OffsetDifference)
                        {
                            Note temp = null;
                            bool hold = false;
                            foreach (Note n in chart.Notes)
                            {
                                if (n.Hold && n.HoldOffset + hitWindow < currentOffset)
                                {
                                    n.Enabled = false;
                                    n.setAlpha(0.0f);
                                    foreach (Animation a in holdBursts)
                                    {
                                        if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * r.Lane)) + 5 - frame.LaneWidth[n.Location - 1] * 2)
                                        {
                                            a.Active = false;
                                            holdRem.Add(a);
                                        }
                                    }
                                }
                                else if (!n.Hold && n.Offset + hitWindow < currentOffset)
                                {
                                    n.Enabled = false;
                                    n.setAlpha(0.0f);
                                }
                                if (n.Offset == r.NoteOffset && n.Location == r.Lane + 1)
                                {
                                    temp = n;
                                    break;
                                }
                                else if (n.HoldOffset == r.NoteOffset && n.Location == r.Lane + 1)
                                {
                                    temp = n;
                                    hold = true;
                                    break;
                                }
                            }
                            r.Used = true;
                            if (r.Hit != Replay.HitType.MISS && r.Hit != Replay.HitType.HOLDMISS && temp != null)
                            {
                                score.Combo++;
                                //comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, 50)) / 2, frame.Location.Y + 200);
                                comboText.move(new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0] * 2)) / 2, frame.Location.Y + 185), 0.02);
                                comboText.scale(new Size(frame.LaneWidth[0] * 2, frame.LaneWidth[0] * 2), 0.02);
                                if (score.Combo > 2)
                                {
                                    comboText.Visible = true;
                                }
                                comboMove = true;
                                time2 = 0;
                                if (Config.HitVolume > 0)
                                {
                                    sfx = AudioManager.loadFromMemory(hitsound);//.loadFromFile(Skin.skindict["normal-hitnormal"],true);
                                    sfx.Volume = Config.HitVolume / 100f; //add separate hitsound config setting later?
                                    sfx.play(false);
                                }
                                temp.Texture.fade(0.0f, 0.05);
                                if (!temp.Hold)
                                {
                                    temp.Enabled = false;
                                }
                                else if (temp.Hold && hold)
                                {
                                    temp.Enabled = false;
                                    temp.Texture.fade(0.0f, 0.05);
                                    temp.Holdbar.fade(0.0f, 0.05);
                                    temp.HoldStart.fade(0.0f, 0.05);
                                    temp.HoldEnd.fade(0.0f, 0.05);
                                    foreach (Animation a in holdBursts)
                                    {
                                        if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[temp.Location - 1]) + (1 * r.Lane)) + 5 - frame.LaneWidth[temp.Location - 1] * 2)
                                        {
                                            a.Active = false;
                                            holdRem.Add(a);
                                        }
                                    }
                                }
                                else if (temp.Hold)
                                {
                                    holdBursts.Add(new Animation(new Rectangle(((int)frame.Location.X + (frame.LaneLoc[temp.Location - 1]) + (1 * r.Lane)) + 5 - frame.LaneWidth[temp.Location - 1] * 2, (int)frame.HitHeight - 25 - frame.LaneWidth[temp.Location - 1] * 2, frame.LaneWidth[temp.Location - 1] + frame.LaneWidth[temp.Location - 1] * 4, frame.LaneWidth[temp.Location - 1] + frame.LaneWidth[temp.Location - 1] * 4), Skin.HoldFrameRate, "holdBurst", 3, true, Skin.MaskHolds));
                                }
                                if (r.Hit == Replay.HitType.PERFECT)
                                {
                                    adjustHp(2);
                                    burstAcc(3);
                                    score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 3);
                                    score.AccuracyTotal.Add(3);
                                }
                                else if (r.Hit == Replay.HitType.GREAT)
                                {
                                    adjustHp(1);
                                    burstAcc(2);
                                    score.TotalScore += (score.Combo * 45) / 6;
                                    score.AccuracyTotal.Add(3.5f);
                                }
                                else if (r.Hit == Replay.HitType.GOOD)
                                {
                                    adjustHp(1);
                                    burstAcc(2);
                                    score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 2);
                                    score.AccuracyTotal.Add(2);
                                }
                                else if (r.Hit == Replay.HitType.OK)
                                {
                                    adjustHp(-3);
                                    burstAcc(1);
                                    score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 1);
                                    score.AccuracyTotal.Add(1);
                                }
                                if (!hold)
                                {
                                    burst = new Animation(new Rectangle(((int)frame.Location.X + (frame.LaneLoc[temp.Location - 1]) + (1 * r.Lane)) + 5 - frame.LaneWidth[temp.Location - 1] * 2, (int)frame.HitHeight - 25 - frame.LaneWidth[temp.Location - 1] * 2, frame.LaneWidth[temp.Location - 1] + frame.LaneWidth[temp.Location - 1] * 4, frame.LaneWidth[temp.Location - 1] + frame.LaneWidth[temp.Location - 1] * 4), Skin.BurstFrameRate, "burst", Skin.BurstFrameCount, false, Skin.MaskBursts);
                                    bursts.Add(burst);
                                }
                            }
                            else if (temp != null)
                            {
                                temp.Enabled = false;
                                temp.Texture.fade(0.0f, 0.1);
                                if (temp.Hold)
                                {
                                    temp.Holdbar.fade(0.0f, 0.1);
                                    temp.HoldEnd.fade(0.0f, 0.1);
                                    temp.HoldStart.fade(0.0f, 0.1);
                                    foreach (Animation a in holdBursts)
                                    {
                                        if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[temp.Location - 1]) + (1 * r.Lane)) + 5 - frame.LaneWidth[temp.Location - 1] * 2)
                                        {
                                            a.Active = false;
                                            holdRem.Add(a);
                                        }
                                    }
                                }
                                burstAcc(0);
                                if (r.Hit == Replay.HitType.HOLDMISS)
                                {
                                    adjustHp(-24);
                                }
                                else
                                {
                                    adjustHp(-12);
                                }
                                miss();
                            }
                            //comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, comboText.CharWidth)) / 2, frame.Location.Y + 200);
                        }
                    }
                    foreach (Note n in chart.Notes)
                    {
                        if (n.Offset - currentOffset > 20000)
                            break;
                        if (n.Texture.Colour.A <= 0 && running && n.Holdbar.Colour.A <= 0)
                        {
                            n.Visible = false;
                        }
                        if (n.Offset - currentOffset < n.MoveTime && n.Visible)
                        {
                            moveRate = (double)(int)frame.HitHeight / n.MoveTime;
                            double temp = n.Offset - currentOffset;
                            double moved = (n.MoveTime - temp) * moveRate;
                            n.Vertical = moved;
                            if (n.Hold)
                            {
                                temp = n.HoldOffset - currentOffset;
                                moved = (n.MoveTime - temp) * moveRate;
                                n.HoldVertical = moved;
                            }
                            if (((Mods.Flags & 8) == 8) && n.Offset - currentOffset < n.MoveTime - (n.MoveTime / 3))
                            {
                                if (!n.Texture.Fading)
                                {
                                    n.Texture.fade(0.0f, 0.2 / (mods.Scroll > 5 ? mods.Scroll / 10 : mods.Scroll));
                                }
                                if (n.Hold && n.HoldOffset - currentOffset < n.MoveTime - (n.MoveTime / 3) && !n.Holdbar.Fading)
                                {
                                    n.Holdbar.fade(0.0f, 0.2);
                                    n.HoldEnd.fade(0.0f, 0.2);
                                    n.HoldStart.fade(0.0f, 0.2);
                                    foreach (Animation a in holdBursts)
                                    {
                                        if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * n.Location - 1)) + 5 - frame.LaneWidth[n.Location - 1] * 2)
                                        {
                                            a.Active = false;
                                            holdRem.Add(a);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {

                }
                #endregion
            }
            else if (!replay)
            {
                if (Config.Spectated && heartbeatTime > 1 && !paused && !scores)
                {
                    try
                    {
                        PacketWriter.sendSpectateHeartbeat(Game.conn.Bw, (int)currentOffset, score.TotalScore, score.Combo, hp, score.Accuracy);
                        heartbeatTime = 0;
                    }
                    catch
                    {
                    }
                }
                #region play
                if (!paused)
                {
                    pulse = true;
                    foreach (TimingSection t in currentSong.TimingsList)
                    {
                        if (currentOffset > t.Offset)
                        {
                            if (sectionSnap != t.Snap)
                            {
                                sectionSnap = t.Snap;
                                glow.Bounds = new Rectangle(new Point((int)frame.Location.X + 5, (int)frame.HitHeight - 43), new Size((int)frame.Width - 3, 40));
                            }
                        }
                    }
                    if (recordingReplay)
                    {
                        for (int x = 0; x < chart.Keys; x++)
                        {
                            if (newKeyState.Contains(Config.keys[keygroup][x]) && !oldKeyState.Contains(Config.keys[keygroup][x]))
                            {
                                currentReplay.PressTimings.Add(new Pair<int, Pair<int, bool>>((int)currentOffset - 8, new Pair<int, bool>(x, false)));
                                if (Config.Spectated)
                                {
                                    PacketWriter.sendSpectatePress(Game.conn.Bw, (int)currentOffset, x);
                                }
                            }
                            else if (!newKeyState.Contains(Config.keys[keygroup][x]) && oldKeyState.Contains(Config.keys[keygroup][x]))
                            {
                                currentReplay.ReleaseTimings.Add(new Pair<int, Pair<int, bool>>((int)currentOffset - 8, new Pair<int, bool>(x, false)));
                                if (Config.Spectated)
                                {
                                    PacketWriter.sendSpectateRelease(Game.conn.Bw, (int)currentOffset, x);
                                }
                            }
                            if (newKeyState.Contains(Config.keys[keygroup][x]))
                            {
                                keys[x] = true;
                                if (lights[x].Colour.A == 0.0f && !lights[x].Fading)
                                {
                                    lights[x].fade(0.65f, 0.075);
                                    lights[x].move(new Point(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5, 96), 0.1);
                                    lights[x].scale(new Size(frame.LaneWidth[x], (int)frame.HitHeight - 99), 0.1);
                                    glows[x].fade(0.65f, 0.075);
                                }
                                if (!presses[x].Fading && presses[x].Colour.A == 0.0f)
                                {
                                    presses[x].fade(1.0f, 0.05);
                                }
                            }
                            else
                            {
                                keys[x] = false;
                                if (!lights[x].Fading && lights[x].Colour.A > 0.0f)
                                {
                                    lights[x].fade(0.0f, 0.075);
                                    lights[x].move(new Point(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5 + 25, 596), 0.075);
                                    lights[x].scale(new Size(0, (int)frame.HitHeight - 599), 0.05);
                                    glows[x].fade(0.0f, 0.075);
                                }
                                if (!presses[x].Fading && presses[x].Colour.A > 0.0f)
                                {
                                    presses[x].fade(0.0f, 0.05);
                                }
                            }
                        }
                    }
                }
                else
                {
                    pulse = false;
                }
                if ((playType == PlayType.PLAY && !scores && (currentOffset > endOffset || music.PositionAsMilli == music.Length)) || forceScores)
                {
                    scores = true;
                    try
                    {
                        PacketWriter.sendSongStart(Game.conn.Bw, Account.currentAccount.AccountName, "", "", (short)2, 0, 0, 0);
                    }
                    catch
                    {
                    }
                    paused = false;
                    running = false;
                    if (notAdded)
                    {
                        try
                        {
                            if (Config.Spectated)
                            {
                                PacketWriter.sendSpectateFinish(Game.conn.Bw, score.TotalScore, score.MaxCombo, score.Perfects, score.Goods, score.Oks, score.Misses, (int)mods.Flags, (double)score.Accuracy);
                            }
                        }
                        catch { }
                        if (!calibrate)
                        {
                            SongInfo curr = SongLibrary.songInfos[CurrentSong.PncName];
                            String cstring = chart.Name;
                            score.chartName = chart.Name;
                            score.ArtistTitle = currentSong.Artist + " - " + currentSong.SongName;
                            score.dateString = DateTime.Now.ToString();
                            try
                            {
                                if (CurrentSong.FileVersion == 1)
                                {
                                    string fileName = ScoreLibrary.getFileFromDiff(curr, cstring);
                                    string hash = Utils.calcHash(fileName);
                                    string sName = "replay\\" + hash + ".psf";
                                    string rName;
                                    XmlDocument rep = new XmlDocument();
                                    XmlDeclaration d = rep.CreateXmlDeclaration("1.0", null, "yes");
                                    rep.AppendChild(d);
                                    XmlElement r = rep.CreateElement("replay");
                                    r.SetAttribute("Version", "1");
                                    XmlElement m = rep.CreateElement("m");
                                    XmlElement scr = rep.CreateElement("c");
                                    scr.InnerText = "" + Convert.ToDouble(mods.Scroll, Config.cultureEnglish);
                                    m.AppendChild(scr);
                                    XmlElement speed = rep.CreateElement("s");
                                    speed.InnerText = "" + mods.Speed;
                                    m.AppendChild(speed);
                                    XmlElement flags = rep.CreateElement("f");
                                    flags.InnerText = "" + mods.Flags;
                                    m.AppendChild(flags);
                                    r.AppendChild(m);
                                    foreach (ReplayHit h in currentReplay.HitTimings)
                                    {
                                        XmlElement t = rep.CreateElement("h");
                                        XmlElement hit = rep.CreateElement("t");
                                        hit.InnerText = "" + (int)h.Hit;
                                        t.AppendChild(hit);
                                        XmlElement lane = rep.CreateElement("l");
                                        lane.InnerText = "" + h.Lane;
                                        t.AppendChild(lane);
                                        XmlElement o = rep.CreateElement("o");
                                        o.InnerText = "" + h.NoteOffset;
                                        t.AppendChild(o);
                                        XmlElement di = rep.CreateElement("d");
                                        di.InnerText = "" + h.OffsetDifference;
                                        t.AppendChild(di);
                                        r.AppendChild(t);
                                    }
                                    foreach (Pair<int, Pair<int, bool>> h in currentReplay.PressTimings)
                                    {
                                        XmlElement p = rep.CreateElement("p");
                                        XmlElement o = rep.CreateElement("o");
                                        o.InnerText = "" + h.key;
                                        p.AppendChild(o);
                                        XmlElement l = rep.CreateElement("l");
                                        l.InnerText = "" + h.value.key;
                                        p.AppendChild(l);
                                        r.AppendChild(p);
                                    }
                                    foreach (Pair<int, Pair<int, bool>> h in currentReplay.ReleaseTimings)
                                    {
                                        XmlElement p = rep.CreateElement("r");
                                        XmlElement o = rep.CreateElement("o");
                                        o.InnerText = "" + h.key;
                                        p.AppendChild(o);
                                        XmlElement l = rep.CreateElement("l");
                                        l.InnerText = "" + h.value.key;
                                        p.AppendChild(l);
                                        r.AppendChild(p);
                                    }
                                    rep.AppendChild(r);
                                    if (File.Exists(sName))
                                    {
                                        Console.WriteLine("1237");
                                        rName = "replay\\r\\" + Config.UnixTime() + " " + hash + ".pcr";
                                        if (!Directory.Exists("replay\\r"))
                                        {
                                            Directory.CreateDirectory("replay\\r");
                                        }
                                        rep.Save(rName);
                                        score.ReplayName = Config.UnixTime() + " " + hash;
                                        List<Score> reconstructed = ScoreLibrary.reconstruct(sName);
                                        if (reconstructed.Count < 8)
                                        {
                                            reconstructed.Add(score);
                                            ScoreLibrary.serializeScores(reconstructed, sName);
                                        }
                                        else
                                        {
                                            Comparison<Score> scoreCompare = new Comparison<Score>(ScoreLibrary.CompareScores);
                                            reconstructed.Sort(scoreCompare);
                                            if (reconstructed[reconstructed.Count - 1].TotalScore < score.TotalScore)
                                            {
                                                File.Delete("replay\\r\\" + reconstructed[reconstructed.Count - 1].ReplayName);
                                                reconstructed.RemoveAt(reconstructed.Count - 1);
                                                reconstructed.Add(score);
                                                ScoreLibrary.serializeScores(reconstructed, sName);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        List<Score> newL = new List<Score>();
                                        newL.Add(score);
                                        ScoreLibrary.serializeScores(newL, sName);
                                        rName = "replay\\r\\" + Config.UnixTime() + " " + hash + ".pcr";
                                        Directory.CreateDirectory("replay\\r");
                                        rep.Save(rName);
                                        score.ReplayName = Config.UnixTime() + " " + hash;
                                        newL = new List<Score>();
                                        newL.Add(score);
                                        ScoreLibrary.serializeScores(newL, sName);
                                    }
                                    if (Account.currentAccount != null)
                                    {
                                        NameValueCollection nvc = new NameValueCollection();
                                        nvc.Add("u", Account.currentAccount.AccountName);
                                        nvc.Add("p", Account.currentAccount.passHash);
                                        nvc.Add("c", hash);
                                        XmlDocument doc = new XmlDocument();
                                        XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, "yes");
                                        doc.AppendChild(dec);
                                        XmlElement root = doc.CreateElement("score");
                                        root.SetAttribute("Version", "1");
                                        XmlElement oks = doc.CreateElement("oks");
                                        oks.InnerText = score.Oks.ToString();
                                        root.AppendChild(oks);
                                        XmlElement perfects = doc.CreateElement("perfects");
                                        perfects.InnerText = score.Perfects.ToString();
                                        root.AppendChild(perfects);
                                        XmlElement goods = doc.CreateElement("goods");
                                        goods.InnerText = score.Goods.ToString();
                                        root.AppendChild(goods);
                                        XmlElement misses = doc.CreateElement("misses");
                                        misses.InnerText = score.Misses.ToString();
                                        root.AppendChild(misses);
                                        XmlElement maxC = doc.CreateElement("maxc");
                                        maxC.InnerText = score.MaxCombo.ToString();
                                        root.AppendChild(maxC);
                                        XmlElement totalScore = doc.CreateElement("totalscore");
                                        totalScore.InnerText = score.TotalScore.ToString();
                                        root.AppendChild(totalScore);
                                        XmlElement acc = doc.CreateElement("acc");
                                        acc.InnerText = score.Accuracy.ToString(Config.cultureEnglish);
                                        root.AppendChild(acc);
                                        XmlElement flag = doc.CreateElement("flags");
                                        flag.InnerText = "" + score.Flags;
                                        root.AppendChild(flag);
                                        doc.AppendChild(root);
                                        doc.Save("tmp.xml");
                                        UploadClass uc = new UploadClass();
                                        uc.uploadDone += new Action<string, int>(uc_uploadDone);
                                        try
                                        {
                                            uc.HttpUploadFileAsync("http://p.ulse.net/scoresubmit", nvc, rName, "replay", "text/xml", "tmp.xml", "score", "text/xml");
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex) { Console.WriteLine("Score submit failed: " + ex.Message); }
                        }
                        notAdded = false;
                        scoreScreen = new ScoreScreen(game, "scores", currentReplay, currentSong, difficulty, true);
                        scoreScreen.OnLoad(null);
                    }
                }
                if (!scores)
                {
                    foreach (Note n in chart.Notes)
                    {
                        if (n.Offset - currentOffset > 20000)
                            break;
                        if (n.Texture.Colour.A <= 0 && running && n.Offset - currentOffset > -hitWindow && n.Holdbar.Colour.A <= 0 && !holding[n.Location - 1])
                        {
                            n.Visible = false;
                        }
                        if (n.Offset - currentOffset < n.MoveTime && n.Visible && n.Enabled)
                        {
                            moveRate = (double)(int)frame.HitHeight / n.MoveTime;
                            double temp = n.Offset - currentOffset;
                            double moved = (n.MoveTime - temp) * moveRate;
                            n.Vertical = moved;
                            if (n.Hold)
                            {
                                temp = n.HoldOffset - currentOffset;
                                moved = (n.MoveTime - temp) * moveRate;
                                n.HoldVertical = moved;
                            }
                            if (((Mods.Flags & 8) == 8) && n.Offset - currentOffset < n.MoveTime - (n.MoveTime / 3))
                            {
                                if (!n.Texture.Fading)
                                {
                                    n.Texture.fade(0.0f, 0.2 / (mods.Scroll > 5 ? mods.Scroll / 10 : mods.Scroll));
                                }
                                if (n.Hold && n.HoldOffset - currentOffset < n.MoveTime - (n.MoveTime / 3) && !n.Holdbar.Fading)
                                {
                                    n.Holdbar.fade(0.0f, 0.2);
                                    n.HoldEnd.fade(0.0f, 0.2);
                                    n.HoldStart.fade(0.0f, 0.2);
                                }
                            }
                        }
                        if (n.Enabled)
                        {
                            bool added = false;
                            if ((n.Offset - currentOffset < n.MoveTime && n.Offset - currentOffset > -hitWindow) || holding[n.Location - 1])
                            {
                                if (!Music.Paused)
                                {
                                    if (canHit[n.Location - 1])
                                    {
                                        if (keys[n.Location - 1] && !prevKey[n.Location - 1])
                                        {
                                            if (n.Offset - currentOffset < hitWindow && n.Offset - currentOffset > -hitWindow)
                                            {
                                                if (calibrate)
                                                {
                                                    offsets.Add((int)currentOffset - (int)n.Offset);
                                                    offsetLabel.Text = "Average mistime: " + Math.Round(offsets.Average(), 3);
                                                }
                                                comboText.move(new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0] * 2)) / 2, frame.Location.Y + 185), 0.02);
                                                comboText.scale(new Size(frame.LaneWidth[0] * 2, frame.LaneWidth[0] * 2), 0.02);
                                                comboMove = true;
                                                canHit[n.Location - 1] = false;
                                                if (Config.HitVolume > 0 && hitsound != null)
                                                {
                                                    sfx = AudioManager.loadFromMemory(hitsound);//.loadFromFile(Skin.skindict["normal-hitnormal"],true);
                                                    sfx.Volume = Config.HitVolume / 100f; //add separate hitsound config setting later?
                                                    sfx.play(false);
                                                }
                                                if (!added)
                                                {
                                                    Replay.HitType hit = Replay.HitType.MISS;
                                                    added = true;

                                                    score.Combo++;
                                                    if (n.Offset - currentOffset < (hitWindow - ((hitWindow / 100) * 70)) && n.Offset - currentOffset > -(hitWindow - ((hitWindow / 100) * 70)))
                                                    {
                                                        adjustHp(2);
                                                        burstAcc(3);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 3);
                                                        score.AccuracyTotal.Add(3);
                                                        hit = Replay.HitType.PERFECT;
                                                    }
                                                    else if (n.Offset - currentOffset < (hitWindow - ((hitWindow / 100) * 40)) && n.Offset - currentOffset > -(hitWindow - ((hitWindow / 100) * 40)))
                                                    {
                                                        adjustHp(1);
                                                        burstAcc(2);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 2);
                                                        score.AccuracyTotal.Add(2);
                                                        hit = Replay.HitType.GOOD;
                                                    }
                                                    else if (n.Offset - currentOffset < (hitWindow - ((hitWindow / 100) * 10)) && n.Offset - currentOffset > -(hitWindow - ((hitWindow / 100) * 10)))
                                                    {
                                                        adjustHp(-3);
                                                        burstAcc(1);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 1);
                                                        score.AccuracyTotal.Add(1f);
                                                        hit = Replay.HitType.OK;
                                                    }
                                                    if (hit != Replay.HitType.MISS)
                                                    {
                                                        currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, hit));
                                                        if (Config.Spectated)
                                                        {
                                                            PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)hit);
                                                        }
                                                        burst = new Animation(new Rectangle(((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * n.Location - 1)) + 5 - frame.LaneWidth[n.Location - 1] * 2, (int)frame.HitHeight - 25 - frame.LaneWidth[n.Location - 1] * 2, frame.LaneWidth[n.Location - 1] + frame.LaneWidth[n.Location - 1] * 4, frame.LaneWidth[n.Location - 1] + frame.LaneWidth[n.Location - 1] * 4), Skin.BurstFrameRate, "burst", Skin.BurstFrameCount, false, Skin.MaskBursts);
                                                        bursts.Add(burst);
                                                    }
                                                }
                                                if (!n.Hold)
                                                {
                                                    n.Enabled = false;
                                                    n.Texture.fade(0.0f, 0.05);
                                                }
                                                else
                                                {
                                                    holding[n.Location - 1] = true;
                                                    n.Texture.fade(0.0f, 0.05);
                                                    holdBursts.Add(new Animation(new Rectangle(((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * n.Location)) + 5 - frame.LaneWidth[n.Location - 1] * 2, (int)frame.HitHeight - 25 - frame.LaneWidth[n.Location - 1] * 2,
                                                        frame.LaneWidth[n.Location - 1] + frame.LaneWidth[n.Location - 1] * 4, frame.LaneWidth[n.Location - 1] + frame.LaneWidth[n.Location - 1] * 4), Skin.HoldFrameRate, "holdBurst", 3, true, Skin.MaskHolds));
                                                }
                                            }
                                            else if (n.Offset - currentOffset < ((double)hitWindow * 1.1) && n.Offset - currentOffset > (double)(hitWindow * 0.9))
                                            {
                                                n.Enabled = false;
                                                n.Texture.fade(0.0f, 0.1);
                                                if (n.Hold)
                                                {
                                                    n.Holdbar.fade(0.0f, 0.1);
                                                    n.HoldEnd.fade(0.0f, 0.1);
                                                    n.HoldStart.fade(0.0f, 0.1);
                                                }
                                                burstAcc(0);
                                                if (!added)
                                                {
                                                    if (!n.Hold)
                                                    {
                                                        currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, Replay.HitType.MISS));
                                                        if (Config.Spectated)
                                                        {
                                                            PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)Replay.HitType.MISS);
                                                        }
                                                        adjustHp(-12);
                                                    }
                                                    else
                                                    {
                                                        currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, Replay.HitType.HOLDMISS));
                                                        if (Config.Spectated)
                                                        {
                                                            PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)Replay.HitType.HOLDMISS);
                                                        }
                                                        adjustHp(-24);
                                                    }
                                                    miss();
                                                    added = true;
                                                }
                                            }
                                            //Console.WriteLine("Current: " + currentOffset + ", Note: " + n.Offset + ", Diff: " + (currentOffset - n.Offset));
                                            comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0])) / 2, frame.Location.Y + 200);
                                            if (score.Combo > 2)
                                            {
                                                comboText.Visible = true;
                                            }
                                        }
                                    }
                                    else if (!canHit[n.Location - 1] && n.Hold && holding[n.Location - 1])
                                    {
                                        //display hold success texture/effect when implemented
                                        if (!keys[n.Location - 1] && prevKey[n.Location - 1])
                                        {
                                            foreach (Animation a in holdBursts)
                                            {
                                                if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * n.Location)) + 5 - frame.LaneWidth[n.Location - 1] * 2)
                                                {
                                                    a.Active = false;
                                                    holdRem.Add(a);
                                                }
                                            }
                                            if (n.HoldOffset - currentOffset < hitWindow * 2 && n.HoldOffset - currentOffset > -hitWindow * 2)
                                            {
                                                comboText.move(new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0] * 2)) / 2, frame.Location.Y + 185), 0.03);
                                                comboText.scale(new Size(frame.LaneWidth[0] * 2, frame.LaneWidth[0] * 2), 0.03);
                                                comboMove = true;
                                                if (Config.HoldHitsounds && Config.HitVolume > 0 && hitsound != null)
                                                {
                                                    sfx = AudioManager.loadFromMemory(hitsound);//.loadFromFile(Skin.skindict["normal-hitnormal"],true);
                                                    sfx.Volume = Config.HitVolume / 100f; //add separate hitsound config setting later?
                                                    sfx.play(false);
                                                }
                                                if (!added)
                                                {
                                                    Replay.HitType hit = Replay.HitType.MISS;
                                                    if (n.HoldOffset - currentOffset < (hitWindow - ((hitWindow / 100) * 70)) * 2 && n.HoldOffset - currentOffset > -(hitWindow - ((hitWindow / 100) * 70)) * 2)
                                                    {
                                                        adjustHp(2);
                                                        burstAcc(3);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 3);
                                                        score.AccuracyTotal.Add(3);
                                                        hit = Replay.HitType.PERFECT;
                                                    }
                                                    else if (n.HoldOffset - currentOffset < (hitWindow - ((hitWindow / 100) * 40)) * 2 && n.HoldOffset - currentOffset > -(hitWindow - ((hitWindow / 100) * 40)) * 2)
                                                    {
                                                        adjustHp(1);
                                                        burstAcc(2);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 2);
                                                        score.AccuracyTotal.Add(2);
                                                        hit = Replay.HitType.GOOD;
                                                    }
                                                    else if (n.HoldOffset - currentOffset < (hitWindow - ((hitWindow / 100) * 10)) * 2 && n.HoldOffset - currentOffset > -(hitWindow - ((hitWindow / 100) * 10)) * 2)
                                                    {
                                                        adjustHp(-3);
                                                        burstAcc(1);
                                                        score.TotalScore += (int)(scoreMod * ((score.Combo * 9) / 6.5) * 3);
                                                        score.AccuracyTotal.Add(1);
                                                        hit = Replay.HitType.OK;
                                                    }
                                                    if (hit != Replay.HitType.MISS)
                                                    {
                                                        currentReplay.HitTimings.Add(new ReplayHit((int)n.HoldOffset, (int)n.HoldOffset - (int)currentOffset, n.Location - 1, hit));
                                                        if (Config.Spectated)
                                                        {
                                                            PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.HoldOffset, (int)(n.HoldOffset - currentOffset), n.Location - 1, (int)hit);
                                                        }
                                                        score.Combo++;
                                                        added = true;
                                                        if (score.Combo > 2)
                                                        {
                                                            comboText.Visible = true;
                                                        }
                                                    }
                                                }
                                                n.Enabled = false;
                                                n.Texture.fade(0.0f, 0.05);
                                                n.Holdbar.fade(0.0f, 0.05);
                                                n.HoldStart.fade(0.0f, 0.05);
                                                n.HoldEnd.fade(0.0f, 0.05);
                                                holding[n.Location - 1] = false;
                                            }
                                            else if (n.Offset - currentOffset < 0)
                                            {
                                                burstAcc(0);
                                                adjustHp(-12);
                                                currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, Replay.HitType.MISS));
                                                if (Config.Spectated)
                                                {
                                                    PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)Replay.HitType.MISS);
                                                }
                                                if (!added)
                                                {
                                                    miss();
                                                }
                                                n.Enabled = false;
                                                n.Texture.fade(0.0f, 0.1);
                                                n.Holdbar.fade(0.0f, 0.1);
                                                n.HoldEnd.fade(0.0f, 0.1);
                                                n.HoldStart.fade(0.0f, 0.1);
                                                holding[n.Location - 1] = false;
                                            }
                                            comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0])) / 2, frame.Location.Y + 200);
                                        }
                                        else if (n.HoldOffset - currentOffset < -hitWindow * 2)
                                        {
                                            foreach (Animation a in holdBursts)
                                            {
                                                if (a.Bounds.X == ((int)frame.Location.X + (frame.LaneLoc[n.Location - 1]) + (1 * n.Location)) + 5 - frame.LaneWidth[n.Location - 1] * 2)
                                                {
                                                    a.Active = false;
                                                    holdRem.Add(a);
                                                }
                                            }
                                            burstAcc(0);
                                            adjustHp(-12);
                                            currentReplay.HitTimings.Add(new ReplayHit((int)n.HoldOffset, (int)n.HoldOffset - (int)currentOffset, n.Location - 1, Replay.HitType.MISS));
                                            if (Config.Spectated)
                                            {
                                                PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.HoldOffset, (int)(n.HoldOffset - currentOffset), n.Location - 1, (int)Replay.HitType.MISS);
                                            }
                                            if (!added)
                                            {
                                                added = true;
                                                miss();
                                            }
                                            n.Enabled = false;
                                            n.Texture.fade(0.0f, 0.1);
                                            n.Holdbar.fade(0.0f, 0.1);
                                            n.HoldEnd.fade(0.0f, 0.1);
                                            n.HoldStart.fade(0.0f, 0.1);
                                            holding[n.Location - 1] = false;
                                            comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0])) / 2, frame.Location.Y + 200);
                                        }
                                    }
                                    if (n.Enabled && n.Offset - currentOffset < -hitWindow && !holding[n.Location - 1])
                                    {
                                        burstAcc(0);
                                        adjustHp(-12);
                                        currentReplay.HitTimings.Add(new ReplayHit((int)n.HoldOffset, (int)n.HoldOffset - (int)currentOffset, n.Location - 1, Replay.HitType.MISS));
                                        if (Config.Spectated)
                                        {
                                            PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.HoldOffset, (int)(n.HoldOffset - currentOffset), n.Location - 1, (int)Replay.HitType.MISS);
                                        }
                                        if (!added)
                                        {
                                            added = true;
                                            miss();
                                        }
                                        n.Enabled = false;
                                        n.Texture.fade(0.0f, 0.1);
                                        if (n.Hold)
                                        {
                                            n.Holdbar.fade(0.0f, 0.1);
                                            n.HoldEnd.fade(0.0f, 0.1);
                                            n.HoldStart.fade(0.0f, 0.1);
                                        }
                                        comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0])) / 2, frame.Location.Y + 200);
                                    }
                                }
                            }
                            else if ((n.Offset - currentOffset) < -hitWindow)
                            {
                                n.Enabled = false;
                                n.Texture.fade(0.0f, 0.1);
                                if (n.Hold)
                                {
                                    n.Holdbar.fade(0.0f, 0.1);
                                    n.HoldEnd.fade(0.0f, 0.1);
                                    n.HoldStart.fade(0.0f, 0.1);
                                    adjustHp(-24);
                                    currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, Replay.HitType.HOLDMISS));
                                    if (Config.Spectated)
                                    {
                                        PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)Replay.HitType.HOLDMISS);
                                    }
                                }
                                else
                                {
                                    adjustHp(-12);
                                    currentReplay.HitTimings.Add(new ReplayHit((int)n.Offset, (int)n.Offset - (int)currentOffset, n.Location - 1, Replay.HitType.MISS));
                                    if (Config.Spectated)
                                    {
                                        PacketWriter.sendSpectateHit(Game.conn.Bw, (int)n.Offset, (int)(n.Offset - currentOffset), n.Location - 1, (int)Replay.HitType.MISS);
                                    }
                                }
                                burstAcc(0);
                                if (!added)
                                {
                                    added = true;
                                    miss();
                                }
                                comboText.Location = new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString(comboText.Text, frame.LaneWidth[0])) / 2, frame.Location.Y + 200);
                            }
                        }
                    }
                }
                else
                {

                }
                #endregion
            }
            for (int x = 0; x < keys.Length; x++)
            {
                prevKey[x] = keys[x];
            }
            if (paused)
            {
                if (!buffering && !specFailed)
                {
                    pauseScreen.OnUpdateFrame(e);
                }
            }
            if (scoreLabel.Text != score.TotalScore.ToString("D9"))
            {
                scoreLabel.Text = score.TotalScore.ToString("D9");
            }
            if (comboText.Text != score.Combo + "x")
            {
                comboText.Text = score.Combo + "x";
            }
            if (score.Accuracy > 0)
            {
                if (accuracyLabel.Text != "" + String.Format("{0:0.00}%", score.Accuracy))
                {
                    accuracyLabel.Text = "" + String.Format("{0:0.00}%", score.Accuracy);
                }
            }
            else
            {
                accuracyLabel.Text = "";
            }
            for (int z = accRem.Count - 1; z > -1; z--)
            {
                bursts.Remove(accRem[z]);
                accRem.Remove(accRem[z]);
            }
            for (int z = holdRem.Count - 1; z > -1; z--)
            {
                holdBursts.Remove(holdRem[z]);
                holdRem.Remove(holdRem[z]);
            }
            for (int z = hitTimingsToAdd.Count - 1; z > -1; z--)
            {
                currentReplay.HitTimings.Add(hitTimingsToAdd[z]);
                hitTimingsToAdd.RemoveAt(z);
            }
            for (int z = pressTimingsToAdd.Count - 1; z > -1; z--)
            {
                currentReplay.PressTimings.Add(pressTimingsToAdd[z]);
                pressTimingsToAdd.RemoveAt(z);
            }
            for (int z = releaseTimingsToAdd.Count - 1; z > -1; z--)
            {
                currentReplay.ReleaseTimings.Add(releaseTimingsToAdd[z]);
                releaseTimingsToAdd.RemoveAt(z);
            }
        }