Exemplo n.º 1
0
        /// <summary>
        ///     使用一定的格式构造一个字符串
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            var b = new StringBuilder(format);

            b.Replace("Artist", Artist);
            b.Replace("artist", Artist);
            b.Replace("bpm", Bpm.ToString(CultureInfo.CurrentCulture));
            b.Replace("stars", Stars.ToString(CultureInfo.CurrentCulture));
            b.Replace("mode", Mode.ToString());
            b.Replace("cs", CircleSize.ToString(CultureInfo.CurrentCulture));
            b.Replace("ar", ApproachRate.ToString(CultureInfo.CurrentCulture));
            b.Replace("hp", HpDrain.ToString(CultureInfo.CurrentCulture));
            b.Replace("od", OverallDifficulty.ToString(CultureInfo.CurrentCulture));
            b.Replace("circles", HitCircle.ToString());
            b.Replace("sliders", Slider.ToString());
            b.Replace("spiners", Spinner.ToString());
            b.Replace("creator", Creator);
            b.Replace("Title", Title);
            b.Replace("title", Title);
            b.Replace("Tags", Tags);
            b.Replace("tags", Tags);
            b.Replace("setid", BeatmapSetId.ToString());
            b.Replace("maxcombo", MaxCombo.ToString());
            b.Replace("approved", Approved.ToString());
            var total = TimeSpan.FromSeconds(TotalTime);
            var hit   = TimeSpan.FromSeconds(DrainTime);

            b.Replace("length", $"{total.TotalMinutes}:{total.Seconds}");
            b.Replace("hitlength", $"{hit.TotalMinutes}:{hit.Seconds}");
            b.Replace("version", Version);
            b.Replace("md5", Md5);
            b.Replace("id", BeatmapId.ToString());
            return(b.ToString());
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + TitleUnicode.GetHashCode();
         hash = hash * 23 + TitleRoman.GetHashCode();
         hash = hash * 23 + ArtistUnicode.GetHashCode();
         hash = hash * 23 + ArtistRoman.GetHashCode();
         hash = hash * 23 + Creator.GetHashCode();
         hash = hash * 23 + DiffName.GetHashCode();
         hash = hash * 23 + Mp3Name.GetHashCode();
         hash = hash * 23 + Md5.GetHashCode();
         hash = hash * 23 + OsuFileName.GetHashCode();
         hash = hash * 23 + Tags.GetHashCode();
         hash = hash * 23 + Somestuff.GetHashCode();
         hash = hash * 23 + _state.GetHashCode();
         hash = hash * 23 + Circles.GetHashCode();
         hash = hash * 23 + Sliders.GetHashCode();
         hash = hash * 23 + Spinners.GetHashCode();
         hash = hash * 23 + EditDate.GetHashCode();
         hash = hash * 23 + ApproachRate.GetHashCode();
         hash = hash * 23 + CircleSize.GetHashCode();
         hash = hash * 23 + HpDrainRate.GetHashCode();
         hash = hash * 23 + OverallDifficulty.GetHashCode();
         hash = hash * 23 + SliderVelocity.GetHashCode();
         hash = hash * 23 + DrainingTime.GetHashCode();
         hash = hash * 23 + TotalTime.GetHashCode();
         hash = hash * 23 + PreviewTime.GetHashCode();
         hash = hash * 23 + MapId.GetHashCode();
         hash = hash * 23 + MapSetId.GetHashCode();
         hash = hash * 23 + ThreadId.GetHashCode();
         hash = hash * 23 + OsuGrade.GetHashCode();
         hash = hash * 23 + TaikoGrade.GetHashCode();
         hash = hash * 23 + CatchGrade.GetHashCode();
         hash = hash * 23 + ManiaGrade.GetHashCode();
         hash = hash * 23 + Offset.GetHashCode();
         hash = hash * 23 + StackLeniency.GetHashCode();
         hash = hash * 23 + PlayMode.GetHashCode();
         hash = hash * 23 + Source.GetHashCode();
         hash = hash * 23 + AudioOffset.GetHashCode();
         hash = hash * 23 + LetterBox.GetHashCode();
         hash = hash * 23 + Played.GetHashCode();
         hash = hash * 23 + LastPlayed.GetHashCode();
         hash = hash * 23 + IsOsz2.GetHashCode();
         hash = hash * 23 + Dir.GetHashCode();
         //hash = hash * 23 + LastSync.GetHashCode(); //This value is updated by osu even if no changes were made to the actual data
         hash = hash * 23 + DisableHitsounds.GetHashCode();
         hash = hash * 23 + DisableSkin.GetHashCode();
         hash = hash * 23 + DisableSb.GetHashCode();
         hash = hash * 23 + BgDim.GetHashCode();
         hash = hash * 23 + ModPpStars.GetHashCode();
         hash = hash * 23 + MaxBpm.GetHashCode();
         hash = hash * 23 + MinBpm.GetHashCode();
         hash = hash * 23 + MainBpm.GetHashCode();
         return(hash);
     }
 }