Esempio n. 1
0
        private async Task <List <Image> > GetImages(string text)
        {
            Regex regex = new Regex("\\(pic: [a-zA-Z0-9.]+\\)");
            Match match = regex.Match(text);

            var images = new List <Image>();

            while (match.Success)
            {
                var subStr = match.Value;
                var val    = subStr.Substring(6, subStr.Length - 7);
                var img    = await _loader.GetFile(BasePicUrl + val);

                images.Add(new Image()
                {
                    Data = img
                });
                //int index = text.IndexOf(subStr);
                //text = (index < 0)
                //    ? text
                //    : text.Remove(index, subStr.Length).Trim();
                match = match.NextMatch();
            }
            return(images);
        }