Beispiel #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("username", UserName);
            b.Replace("userid", UserId.ToString());
            b.Replace("mode", _mode.ToString());
            b.Replace("pp", Pp.ToString(CultureInfo.InvariantCulture));
            b.Replace("globalrank", GlobalRank.ToString());
            b.Replace("countryrank", CountryRank.ToString());
            b.Replace("cssh", SshCount.ToString());
            b.Replace("csh", ShCount.ToString());
            b.Replace("css", SsCount.ToString());
            b.Replace("cs", SCount.ToString());
            b.Replace("ca", ACount.ToString());
            b.Replace("acc", $"{Accuracy:f2}%");
            b.Replace("rankedscore", RankedScore.ToString(CultureInfo.InvariantCulture));
            b.Replace("totalscore", TotalScore.ToString(CultureInfo.InvariantCulture));
            b.Replace("playcount", PlayCount.ToString());
            b.Replace("level", Level.ToString(CultureInfo.InvariantCulture));
            b.Replace("countrycn", GetCountryInCn(Country));
            b.Replace("country", Country);
            b.Replace("joindate", JoinDate.ToString("yyyy/MM/dd HH:mm:ss"));
            return(b.ToString());
        }
Beispiel #2
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("perfect", Perfect.ToString());
            b.Replace("pp", Pp.ToString(CultureInfo.CurrentCulture));
            b.Replace("Count300g", Count300g.ToString());
            b.Replace("c300", Count300.ToString());
            b.Replace("Count200", Count200.ToString());
            b.Replace("Count100", Count100.ToString());
            b.Replace("Count50", Count50.ToString());
            b.Replace("CountMiss", CountMiss.ToString());
            b.Replace("userid", UserId.ToString());
            b.Replace("rank", Rank);
            b.Replace("playtime", _d.ToString("yyyy/MM/dd HH:mm:ss"));
            b.Replace("score", Score.ToString());
            b.Replace("beatmapid", BeatmapId.ToString());
            b.Replace("maxcombo", MaxCombo.ToString());
            b.Replace("acc", Accuracy.ToString("p2"));
            return(b.ToString());
        }