Пример #1
0
        private Boolean GetResourceLanguagesCallback(IntPtr moduleHandle, IntPtr pType, IntPtr pName, UInt16 langId, IntPtr userParam)
        {
            Win32ResourceType tempType = new Win32ResourceType(pType, this);               // temp type used for finding the one to reference
            Win32ResourceType type     = _types.Find(new Predicate <Win32ResourceType>(delegate(Win32ResourceType resType) { return(resType == tempType); }));

            if (type == null)
            {
                throw new InvalidOperationException("Resource language callback for a type that isn't known.");
            }

            Win32ResourceName tempName = new Win32ResourceName(pName, type);               // temp Name used for finding the one to reference
            Win32ResourceName name     = type.Names.Find(new Predicate <Win32ResourceName>(delegate(Win32ResourceName resName) { return(resName == tempName); }));

            if (name == null)
            {
                throw new InvalidOperationException("Resource names callback for a Name that isn't known.");
            }

            //

            Win32ResourceLanguage lang = new Win32ResourceLanguage(langId, name);

            name.Languages.Add(lang);

            return(true);
        }
Пример #2
0
        private Boolean GetResourceNamesCallback(IntPtr moduleHandle, IntPtr pType, IntPtr pName, IntPtr userParam)
        {
            Win32ResourceType tempType = new Win32ResourceType(pType, this);               // temp type used for finding the one to reference
            Win32ResourceType type     = _types.Find(new Predicate <Win32ResourceType>(delegate(Win32ResourceType resType) { return(resType == tempType); }));

            if (type == null)
            {
                throw new InvalidOperationException("Resource names callback for a type that isn't known.");
            }

            //

            Win32ResourceName name = new Win32ResourceName(pName, type);

            type.Names.Add(name);

            NativeMethods.EnumResLangProc callback = new NativeMethods.EnumResLangProc(GetResourceLanguagesCallback);
            NativeMethods.EnumResourceLanguages(moduleHandle, pType, pName, callback, IntPtr.Zero);

            return(true);
        }
Пример #3
0
        internal Win32ResourceLanguage(UInt16 languageId, Win32ResourceName parentName)
        {
            LanguageId = languageId;

            ParentName = parentName;
        }