Exemplo n.º 1
0
        /// <summary>Associates all of the IconImages in this directory with the ResourceSource by creating IconCursorResourceData instances for each IconImage (with the specified Lang)</summary>
        public void BindToSource(ResourceSource source, UInt16 langId)
        {
            IconCursorImageResourceDataFactory factory = GetImageFactory();

            ResourceTypeIdentifier typeId = Type == IconType.Icon ? _iiTypeId : _ciTypeId;

            foreach (IconImage image in _images)
            {
                IconCursorImageResourceData rd = (IconCursorImageResourceData)factory.FromFileData(null, image.ImageData, Type == IconType.Icon);

                image.ResourceDataTyped = rd;

                source.Add(typeId, source.GetUnusedName(typeId), langId, rd);
            }
        }
Exemplo n.º 2
0
        private IconCursorImageResourceDataFactory GetImageFactory()
        {
            if (_imgFactory != null)
            {
                return(_imgFactory);
            }

            var desired = Type == IconType.Icon ? Win32ResourceType.IconImage : Win32ResourceType.CursorImage;

            var typeId = new ResourceTypeIdentifier(desired);

            var factories = ResourceDataFactory.GetFactoriesForType(typeId);

            foreach (var f in factories)
            {
                if (f is IconCursorImageResourceDataFactory icif)
                {
                    return(_imgFactory = icif);
                }
            }

            return(_imgFactory);
        }
Exemplo n.º 3
0
        private IconCursorImageResourceDataFactory GetImageFactory()
        {
            if (_imgFactory != null)
            {
                return(_imgFactory);
            }

            Win32ResourceType desired = Type == IconType.Icon ? Win32ResourceType.IconImage : Win32ResourceType.CursorImage;

            ResourceTypeIdentifier typeId = new ResourceTypeIdentifier(desired);

            ResourceDataFactory[] factories = ResourceDataFactory.GetFactoriesForType(typeId);

            foreach (ResourceDataFactory f in factories)
            {
                IconCursorImageResourceDataFactory icif = f as IconCursorImageResourceDataFactory;
                if (icif != null)
                {
                    return(_imgFactory = icif);
                }
            }

            return(_imgFactory);
        }
Exemplo n.º 4
0
        private IconCursorImageResourceData GetRD(Byte[] data)
        {
            IconCursorImageResourceDataFactory factory = GetImageFactory();

            return(factory.FromFileData(null, data, Type == IconType.Icon));
        }