示例#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 GetResourceTypesCallback(IntPtr moduleHandle, IntPtr pType, IntPtr userParam)
        {
            Win32ResourceType type = new Win32ResourceType(pType, this);

            _types.Add(type);

            // enumerate all resources for that type
            NativeMethods.EnumResNameProc callback = new NativeMethods.EnumResNameProc(GetResourceNamesCallback);
            NativeMethods.EnumResourceNames(moduleHandle, pType, callback, IntPtr.Zero);

            return(true);
        }
示例#3
0
        internal Win32ResourceName(IntPtr namePointer, Win32ResourceType parentType)
        {
            Languages  = new List <Win32ResourceLanguage>();
            ParentType = parentType;

            Int32 nameInt; String nameStr;

            Win32ResourceHelper.GetId(namePointer, out nameInt, out nameStr);
            NameInt = nameInt; NameStr = nameStr;

            if (NameInt > -1)
            {
                FriendlyName = NameInt.ToString(Cult.InvariantCulture);
            }
            else
            {
                FriendlyName = NameStr;
            }
        }
示例#4
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);
        }
示例#5
0
 public ResourceTypeIdentifier(Win32ResourceType type) : base((int)type)
 {
     FriendlyName = GetTypeFriendlyName(IntegerId.Value);
     KnownType    = type;
 }