Пример #1
0
 public EmoticonFindResult(Emoticon e, int offset, int len)
 {
     Emoticon = e;
     Offset = offset;
     Length = len;
 }
Пример #2
0
        private static Image GetImage(Emoticon emote)
        {
            if (emote == null)
                return null;

            BitmapImage src;
            if (!s_emotes.TryGetValue(emote, out src))
            {
                if (string.IsNullOrWhiteSpace(emote.LocalFile) || !File.Exists(emote.LocalFile))
                    return null;

                try
                {
                    src = new BitmapImage();
                    src.BeginInit();
                    src.UriSource = new Uri(emote.LocalFile, UriKind.RelativeOrAbsolute);
                    src.EndInit();
                }
                catch
                {
                    try
                    {
                        var local = emote.LocalFile;
                        emote.LocalFile = local;
                        File.Delete(local);
                        emote.ForceRedownload();
                    }
                    catch
                    {
                    }

                    return null;
                }
            }

            Image img = new Image();
            img.Source = src;
            if (emote.Height != -1)
                img.Height = (int)emote.Height;

            if (emote.Width != -1)
                img.Width = (int)emote.Width;

            img.Stretch = Stretch.Uniform;
            return img;
        }
Пример #3
0
 internal void Add(Emoticon e)
 {
     m_emoticons.Add(e);
 }