Stetic.ImageInfo.GetImage C# (CSharp) Method

GetImage() public method

public GetImage ( IProject project ) : Gdk.Pixbuf
project IProject
return Gdk.Pixbuf
        public Gdk.Pixbuf GetImage(IProject project)
        {
            if (image != null)
                return image;

            switch (source) {
                case ImageSource.Resource:
                    if (project.ResourceProvider == null)
                        return null;
                    System.IO.Stream s = project.ResourceProvider.GetResourceStream (name);
                    if (s == null)
                        return null;
                    try {
                        return image = new Gdk.Pixbuf (s);
                    } catch {
                        // Not a valid image
                        return WidgetUtils.MissingIcon;
                    }

                case ImageSource.Theme:
                    return image = WidgetUtils.LoadIcon (name, size);

                case ImageSource.File:
                    try {
                        string file = Path.Combine (project.ImagesRootPath, name);
                        return image = new Gdk.Pixbuf (file);
                    } catch {
                        return WidgetUtils.MissingIcon;
                    }
            }
            return null;
        }