Beispiel #1
0
        public static Emote Parse(string text)
        {
            if (text == null)
            {
                return(null);
            }

            var splites = text.Split(EmoteIdSeparator);

            if (splites.Length != 2)
            {
                return(null);
            }

            var emote = new Emote();

            emote.EmoteId = splites[0];

            var indicesToString = splites[1];
            var indicesSplits   = indicesToString.Split(IndicesSeparator);

            foreach (var indexToString in indicesSplits)
            {
                if (EmoteIndex.TryParse(indexToString, out var index) == true)
                {
                    emote.Indices.Add(index);
                }
            }

            return(emote);
        }
        public static bool TryParse(string text, out EmoteIndex value)
        {
            value = new EmoteIndex();

            if (text == null)
            {
                return(false);
            }

            var splites = text.Split(IndexSeparator);

            if (splites.Length != 2)
            {
                return(false);
            }

            value.StartIndex = NumberUtils.ToInt(splites[0]);
            value.LastIndex  = NumberUtils.ToInt(splites[1]);

            return(true);
        }