BootRes.Program.GetBitmap C# (CSharp) Method

GetBitmap() static private method

static private GetBitmap ( string path, bool displayError ) : Bitmap
path string
displayError bool
return System.Drawing.Bitmap
        static Bitmap GetBitmap(string path, bool displayError)
        {
            Bitmap x = null;
            try
            {
                x = new Bitmap(path);
                if (x.Width != ANIM_WIDTH || x.Height != ANIM_HEIGHT)
                {
                    if (displayError)
                    {
                        Console.Error.WriteLine("The file '"+path+"' is the wrong size (needs to be "+ANIM_WIDTH+"x"+ANIM_HEIGHT+")");
                    }
                    x = null;
                }
            }
            catch (Exception ex)
            {
                if (displayError)
                {
                    Console.Error.WriteLine("There was a problem opening the file '"+path+"': "+ex.Message);
                }
            }
            return x;
        }