KeePassLib.PwCustomIcon.PwCustomIcon C# (CSharp) Method

PwCustomIcon() public method

public PwCustomIcon ( KeePassLib.PwUuid pwUuid, byte pbImageDataPng ) : System.Drawing
pwUuid KeePassLib.PwUuid
pbImageDataPng byte
return System.Drawing
        public PwCustomIcon(PwUuid pwUuid, byte[] pbImageDataPng)
        {
            Debug.Assert(pwUuid != null);
            if(pwUuid == null) throw new ArgumentNullException("pwUuid");
            Debug.Assert(!pwUuid.Equals(PwUuid.Zero));
            if(pwUuid.Equals(PwUuid.Zero)) throw new ArgumentException("pwUuid == 0.");
            Debug.Assert(pbImageDataPng != null);
            if(pbImageDataPng == null) throw new ArgumentNullException("pbImageDataPng");

            m_pwUuid = pwUuid;
            m_pbImageDataPng = pbImageDataPng;

            // MemoryStream ms = new MemoryStream(m_pbImageDataPng, false);
            // m_imgOrg = Image.FromStream(ms);
            // ms.Close();
            try { m_imgOrg = GfxUtil.LoadImage(m_pbImageDataPng); }
            catch(Exception) { Debug.Assert(false); }

            if(m_imgOrg != null)
                m_dImageCache[GetID(m_imgOrg.Width, m_imgOrg.Height)] =
                    m_imgOrg;
        }