Exemple #1
0
        public override ResourceData FromResource(ResourceLang lang, byte[] data)
        {
            BmpImageResourceData rd;

            if (BmpImageResourceData.TryCreate(null, data, out rd))
            {
                return(rd);
            }

            return(null);
        }
Exemple #2
0
        internal static Boolean TryCreate(ResourceLang lang, Byte[] rawData, out BmpImageResourceData typed)
        {
            Dib dib;

            try {
                dib = new Dib(rawData);
            } catch (DibException) {
                typed = null;
                return(false);
            }

            typed = new BmpImageResourceData(dib, lang, rawData);

            return(true);
        }
Exemple #3
0
        internal static Boolean TryCreate(ResourceLang lang, Byte[] rawData, out BmpImageResourceData typed)
        {
            // check if the data is of the right format before working with it

            FileDib dib = new FileDib(rawData);

            Bitmap bmp;

            if (!dib.TryToBitmap(out bmp))
            {
                typed = null;
                return(false);
            }

            typed = new BmpImageResourceData(dib, bmp, lang, rawData);

            return(true);
        }