KBS2.Handlers.ItemHandler.ItemHandler.GetPicture C# (CSharp) Method

GetPicture() public method

public GetPicture ( ItemType item ) : Bitmap
item KBS2.Models.ItemType
return System.Drawing.Bitmap
        public Bitmap GetPicture(ItemType item)
        {
            if (item == null) { item = new ItemType(""); }
            if (!this._picture.ContainsKey(item.ID)) {
                String path = item.ToString();
                char sep = System.IO.Path.DirectorySeparatorChar;
                string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string imgPath = exePath + sep + "Resources" + sep;
                try {
                    Bitmap map = new Bitmap(imgPath + path.ToLower() + ".png");
                    this._picture.Add(item.ID, map);
                }
                catch (Exception e) {
                    return null;
                }
            }
            return this._picture[item.ID];
        }