Пример #1
0
 public static Guid GetGuid(this ITypeLib typeLib)
 {
     using (var attrScope = typeLib.CreateAttrScope())
     {
         return(attrScope.Value.guid);
     }
 }
Пример #2
0
        private static Assembly LoadPrimaryInteropAssembly(ITypeLib typeLib)
        {
            if (typeLib == null)
            {
                return(null);
            }

            // ReSharper disable EmptyGeneralCatchClause

            try
            {
                using (var attrScope = typeLib.CreateAttrScope())
                {
                    if (GetPrimaryInteropAssembly(attrScope.Value.guid, attrScope.Value.wMajorVerNum, attrScope.Value.wMinorVerNum, out var name, out var codeBase))
                    {
                        return(Assembly.Load(new AssemblyName(name)
                        {
                            CodeBase = codeBase
                        }));
                    }
                }
            }
            catch (Exception)
            {
            }

            return(null);

            // ReSharper restore EmptyGeneralCatchClause
        }