Esempio n. 1
0
        protected void MatchSpearResult(string message)
        {
            var spearResult        = new SpearResult();
            var spearFishSizeMatch = FishSizeRegex.Match(message);

#if RB_CN
            var spearFishMatch     = SpearFishRegex.Matches(message);
            var spearFishAwayMatch = SpearFishGetAwayRegex.Match(message);

            if (spearFishSizeMatch.Success)
            {
                spearResult.Name = spearFishMatch[0].ToString();
                float.TryParse(spearFishSizeMatch.Groups[1].Value, out float size);
#else
            var spearFishMatch     = SpearFishRegex.Match(message);
            var spearFishAwayMatch = SpearFishGetAwayRegex.Match(message);
            if (spearFishMatch.Success)
            {
                spearResult.Name = spearFishMatch.Groups[1].Value;
                float.TryParse(spearFishMatch.Groups[2].Value, out float size);
#endif
                spearResult.Size = size;
                if (spearResult.Name[spearResult.Name.Length - 2] == ' ')
                {
                    spearResult.IsHighQuality = true;
                }
            }
            if (spearFishAwayMatch.Success)
            {
                spearResult.Name = "none";
            }

            SpearResult = spearResult;
        }
Esempio n. 2
0
        protected void MatchSpearResult(string message)
        {
            var spearResult        = new SpearResult();
            var spearFishAwayMatch = SpearFishGetAwayRegex.Match(message);
            var spearFishSizeMatch = FishSizeRegex.Match(message);

#if RB_CN
            var spearFishMatch = SpearFishRegex.Matches(message);

            if (spearFishSizeMatch.Success)
            {
                spearResult.Name = spearFishMatch[1].ToString();
                float.TryParse(spearFishSizeMatch.Groups[1].Value, out float size);
                spearResult.Size = size;
                if (spearFishMatch[2].ToString() == "\uE03C")
                {
                    spearResult.IsHighQuality = true;
                }
            }
#else
            var spearFishMatch = SpearFishRegex.Match(message);
            if (spearFishMatch.Success)
            {
                spearResult.Name = spearFishMatch.Groups[1].Value;
                float.TryParse(spearFishMatch.Groups[2].Value, NumberStyles.Number, CultureInfo.InvariantCulture.NumberFormat, out float size);
                spearResult.Size = size;
                if (spearResult.Name[spearResult.Name.Length - 2] == ' ')
                {
                    spearResult.IsHighQuality = true;
                }
            }
#endif

            if (spearFishAwayMatch.Success)
            {
                spearResult.Name = "none";
            }

            SpearResult = spearResult;
        }