Stetic.ImageInfo.FromString C# (CSharp) Method

FromString() public static method

public static FromString ( string str ) : ImageInfo
str string
return ImageInfo
        public static ImageInfo FromString(string str)
        {
            ImageInfo info = new ImageInfo ();
            if (str.StartsWith ("resource:")) {
                info.source = ImageSource.Resource;
                info.name = str.Substring (9);
            } else if (str.StartsWith ("stock:")) {
                info.source = ImageSource.Theme;
                string[] s = str.Substring (6).Split (' ');
                if (s.Length != 2)
                    return null;
                info.name = s[0];
                info.size = (Gtk.IconSize) Enum.Parse (typeof(Gtk.IconSize), s[1]);
            } else if (str.StartsWith ("file:")) {
                info.source = ImageSource.File;
                info.name = str.Substring (5);
            } else
                return null;
            return info;
        }