Exemple #1
0
 public static bool IsHiddenInterface(Type InterfaceType)
 {
     object[] InterfaceAttributes = InterfaceType.GetCustomAttributes(typeof(TypeLibTypeAttribute), false);
     if (InterfaceAttributes.Length > 0)
     {
         TypeLibTypeAttribute tlt   = ( TypeLibTypeAttribute )InterfaceAttributes[0];
         TypeLibTypeFlags     flags = tlt.Value;
         return((flags & TypeLibTypeFlags.FHidden) != 0);
     }
     return(false);
 }
Exemple #2
0
        private void ProcessLibraryAttributes(ITypeLib typeLibrary)
        {
            try
            {
                IntPtr attribPtr;
                typeLibrary.GetLibAttr(out attribPtr);
                var typeAttr = (TYPELIBATTR)Marshal.PtrToStructure(attribPtr, typeof(TYPELIBATTR));

                MajorVersion = typeAttr.wMajorVerNum;
                MinorVersion = typeAttr.wMinorVerNum;
                _flags       = (TypeLibTypeFlags)typeAttr.wLibFlags;
                Guid         = typeAttr.guid;
            }
            catch (COMException) { }
        }
        public ComProject(ITypeLib typeLibrary, string path) : base(null, typeLibrary, -1)
        {
            Path = path;
            try
            {
                typeLibrary.GetLibAttr(out IntPtr attribPtr);
                using (DisposalActionContainer.Create(attribPtr, typeLibrary.ReleaseTLibAttr))
                {
                    var typeAttr = Marshal.PtrToStructure <TYPELIBATTR>(attribPtr);

                    MajorVersion = typeAttr.wMajorVerNum;
                    MinorVersion = typeAttr.wMinorVerNum;
                    _flags       = (TypeLibTypeFlags)typeAttr.wLibFlags;
                    Guid         = typeAttr.guid;
                }
            }
            catch (COMException) { }
            LoadModules(typeLibrary);
        }
Exemple #4
0
 private static string GetBaseInterfaceIID(Type type)
 {
     foreach (CustomAttributeData attr in type.GetCustomAttributesData())
     {
         if (attr.Constructor.DeclaringType == typeof(TypeLibTypeAttribute))
         {
             TypeLibTypeFlags flags = (TypeLibTypeFlags)attr.ConstructorArguments[0].Value;
             if (flags.HasFlag(TypeLibTypeFlags.FDual))
             {
                 return("{00020400-0000-0000-C000-000000000046}");
             }
             else
             {
                 return("{00000000-0000-0000-C000-000000000046}");
             }
         }
     }
     return("");
 }
Exemple #5
0
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     _val = flags;
 }
Exemple #6
0
 public TypeLibTypeAttribute(short flags)
 {
     _val = (TypeLibTypeFlags)flags;
 }
Exemple #7
0
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     _val = flags;
 }
 /// <summary>Initializes a new instance of the TypeLibTypeAttribute class with the specified <see cref="T:System.Runtime.InteropServices.TypeLibTypeFlags" /> value.</summary><param name="flags">The <see cref="T:System.Runtime.InteropServices.TypeLibTypeFlags" /> value for the attributed type as found in the type library it was imported from. </param>
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
        public static CustomAttributeBuilder GetBuilderForTypeLibType(TypeLibTypeFlags flags)
        {
            ConstructorInfo ctorTypeLibType = typeof(TypeLibTypeAttribute).GetConstructor(new Type[] { typeof(TypeLibTypeFlags) });

            return(new CustomAttributeBuilder(ctorTypeLibType, new Object[] { flags }));
        }
        public void Ctor_TypeLibTypeFlags(TypeLibTypeFlags flags)
        {
            var attribute = new TypeLibTypeAttribute(flags);

            Assert.Equal(flags, attribute.Value);
        }
		public TypeLibTypeAttribute (TypeLibTypeFlags flags)
		{
			this.flags = flags;
		}
 //
 // Zusammenfassung:
 //     Initialisiert eine neue Instanz der TypeLibTypeAttribute-Klasse mit dem angegebenen
 //     System.Runtime.InteropServices.TypeLibTypeFlags-Wert.
 //
 // Parameter:
 //   flags:
 //     Der System.Runtime.InteropServices.TypeLibTypeFlags-Wert für den attributierten
 //     Typ, wie er in der Typbibliothek angegeben ist, aus der er importiert wurde.
 public TypeLibTypeAttrib(short flags)
 {
     this.m_flags = (TypeLibTypeFlags)flags;
 }
 public TypeLibTypeAttribute(short flags)
 {
     this.flags = (TypeLibTypeFlags)flags;
 }
Exemple #14
0
 public TypeLibTypeAttribute(short flags)
 {
     _val = (TypeLibTypeFlags)flags;
 }
 // Constructors
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
 }
Exemple #16
0
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     Value = flags;
 }
Exemple #17
0
 internal TypeLibTypeAttribute(short flags)
 {
     _val = (TypeLibTypeFlags)flags;
 }
Exemple #18
0
 internal TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     _val = flags;
 }
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
 }
 public static CustomAttributeBuilder GetBuilderForTypeLibType(TypeLibTypeFlags flags)
 {
     ConstructorInfo ctorTypeLibType = typeof(TypeLibTypeAttribute).GetConstructor(new Type[] { typeof(TypeLibTypeFlags) });
     return new CustomAttributeBuilder(ctorTypeLibType, new Object[] { flags });
 }
		public TypeLibTypeAttribute (short flags)
		{
			this.flags = (TypeLibTypeFlags) flags;
		}
 public TypeLibTypeAttribute(TypeLibTypeFlags flags)
 {
     this.flags = flags;
 }
 //
 // Zusammenfassung:
 //     Initialisiert eine neue Instanz der TypeLibTypeAttribute-Klasse mit dem angegebenen
 //     System.Runtime.InteropServices.TypeLibTypeFlags-Wert.
 //
 // Parameter:
 //   flags:
 //     Der System.Runtime.InteropServices.TypeLibTypeFlags-Wert für den attributierten
 //     Typ, wie er in der Typbibliothek angegeben ist, aus der er importiert wurde.
 public TypeLibTypeAttrib(TypeLibTypeFlags flags)
 {
     this.m_flags = flags;
 }