Exemple #1
0
        public void PopulateTitleStatics()
        {
            try
            {
                string artist = Source.Length > 0 ? Source + " (" + Artist + ")" : Artist;

                if (Artist.Length > 0)
                {
                    SortTitle = artist + " - " + Title;
                }
                else if (Title.Length > 0)
                {
                    SortTitle = Title;
                }
                else
                {
                    SortTitle = Path.GetFileName(Filename);
                }

                string versionString = (Version.Length > 0 ? " [" + Version + "]" : "");

                if (Artist.Length > 0)
                {
                    DisplayTitle = artist + " - " + Title + versionString;
                }
                else if (Title.Length > 0)
                {
                    DisplayTitle = Title + versionString;
                }
                else
                {
                    DisplayTitle = Path.GetFileName(Filename);
                }

                if (Title.Length > 0)
                {
                    DisplayTitleNoArtist = Title + versionString;
                }
                else
                {
                    DisplayTitleNoArtist = Path.GetFileName(Filename);
                }

                if (Creator.Length > 0)
                {
                    GroupTitle = SortTitle + Creator;
                }
                else
                {
                    GroupTitle = SortTitle;
                }
            }
            catch (Exception e)
            {
                BanchoClient.HandleException(e, "Populating title statistics");
            }
        }
        internal static void IncomingBeatmapInfoReply(bBeatmapInfoReply reply)
        {
            try
            {
                lock (BeatmapRequestLock)
                {
                    foreach (Beatmap b in BeatmapInfoRequestList)
                    {
                        b.submissionStatus = SubmissionStatus.NotSubmitted;
                        b.PlayerRank       = Rankings.N;
                    }

                    foreach (bBeatmapInfo bmi in reply.beatmapInfo)
                    {
                        Beatmap b = BeatmapInfoRequestList[bmi.id];

                        if (bmi.checksum != b.BeatmapChecksum)
                        {
                            b.submissionStatus = SubmissionStatus.UpdateAvailable;
                        }
                        else
                        {
                            switch (bmi.ranked)
                            {
                            case 2:
                                b.submissionStatus = SubmissionStatus.Approved;
                                break;

                            case 1:
                                b.submissionStatus = SubmissionStatus.Ranked;
                                break;

                            default:
                                b.submissionStatus = SubmissionStatus.Pending;
                                break;
                            }
                        }

                        b.BeatmapId      = bmi.beatmapId;
                        b.BeatmapSetId   = bmi.beatmapSetId;
                        b.BeatmapTopicId = bmi.threadId;
                        b.PlayerRank     = bmi.playerRank;
                    }

                    BeatmapInfoRequestList = null;
                }
                if (NewBeatmapInfo != null)
                {
                    NewBeatmapInfo(null, null);
                }
            }
            catch (Exception e)
            {
                BanchoClient.HandleException(e, "beatmap info reply");
            }
        }