コード例 #1
0
ファイル: IconFile.cs プロジェクト: 3Lies/runtime-crypter-net
        public GroupIconResource ConvertToGroupIconResource()
        {
            GroupIconResource groupIconResource = new GroupIconResource();
            switch (Type)
            {
                case GroupType.Icon:
                    groupIconResource.GroupIconResourceType = GroupIconResource.GroupType.Icon;
                    break;
                case GroupType.Cursor:
                    groupIconResource.GroupIconResourceType = GroupIconResource.GroupType.Cursor;
                    break;
            }

            for (int id = 0; id < Icons.Count; id++)
            {
                IconResource iconResource = Icons[id].ConvertToIconResource((UInt16) id);
                groupIconResource.Icons.Add(iconResource);
            }

            return groupIconResource;
        }
コード例 #2
0
        public GroupIconResource ConvertToGroupIconResource()
        {
            GroupIconResource groupIconResource = new GroupIconResource();

            switch (Type)
            {
            case GroupType.Icon:
                groupIconResource.GroupIconResourceType = GroupIconResource.GroupType.Icon;
                break;

            case GroupType.Cursor:
                groupIconResource.GroupIconResourceType = GroupIconResource.GroupType.Cursor;
                break;
            }

            for (int id = 0; id < Icons.Count; id++)
            {
                IconResource iconResource = Icons[id].ConvertToIconResource((UInt16)id);
                groupIconResource.Icons.Add(iconResource);
            }

            return(groupIconResource);
        }
コード例 #3
0
        /// <summary>
        /// Enumerate resource languages within a resource by name
        /// </summary>
        private bool EnumResourceLanguages(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, ushort wIDLanguage, IntPtr lParam)
        {
            string type = ResourceUtil.GetResourceName(lpszType);

            List <Resource> resources = null;

            if (!_resources.TryGetValue(type, out resources))
            {
                resources        = new List <Resource>();
                _resources[type] = resources;
            }

            IntPtr hResource       = Kernel32.FindResourceEx(hModule, lpszType, lpszName, wIDLanguage);
            IntPtr hResourceGlobal = Kernel32.LoadResource(hModule, hResource);
            int    size            = Kernel32.SizeofResource(hModule, hResource);

            Resource rc = null;

            switch (ResourceUtil.GetResourceName(lpszType))
            {
            case "16":     // Kernel32.RT_VERSION:
                rc = new VersionResource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                break;

            case "14":     // Kernel32.RT_GROUP_ICON
                rc = new GroupIconResource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                break;

            // \todo: specialize other resource types
            default:
                rc = new Resource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                break;
            }

            resources.Add(rc);
            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Enumerate resource languages within a resource by name
        /// </summary>
        private bool EnumResourceLanguages(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, ushort wIDLanguage, IntPtr lParam)
        {
            string type = ResourceUtil.GetResourceName(lpszType);

            List<Resource> resources = null;
            if (!_resources.TryGetValue(type, out resources))
            {
                resources = new List<Resource>();
                _resources[type] = resources;
            }

            IntPtr hResource = Kernel32.FindResourceEx(hModule, lpszType, lpszName, wIDLanguage);
            IntPtr hResourceGlobal = Kernel32.LoadResource(hModule, hResource);
            int size = Kernel32.SizeofResource(hModule, hResource);

            Resource rc = null;
            switch (ResourceUtil.GetResourceName(lpszType))
            {
                case "16": // Kernel32.RT_VERSION:
                    rc = new VersionResource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                    break;
                case "14": // Kernel32.RT_GROUP_ICON
                    rc = new GroupIconResource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                    break;
                // \todo: specialize other resource types
                default:
                    rc = new Resource(hModule, hResourceGlobal, lpszType, lpszName, wIDLanguage, size);
                    break;
            }

            resources.Add(rc);
            return true;
        }