当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyCatalog.ToString方法代码示例

本文整理汇总了C#中System.ComponentModel.Composition.Hosting.AssemblyCatalog.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyCatalog.ToString方法的具体用法?C# AssemblyCatalog.ToString怎么用?C# AssemblyCatalog.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.Composition.Hosting.AssemblyCatalog的用法示例。


在下文中一共展示了AssemblyCatalog.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckAndAddAssambly

        private void CheckAndAddAssambly(string filename, Action cancel)
        {
            AssemblyName assemblyName = null;

            try
            {
                assemblyName = AssemblyName.GetAssemblyName(filename);
            }
            catch (ArgumentException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (BadImageFormatException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (FileLoadException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (FileNotFoundException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (PlatformNotSupportedException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (SecurityException e)
            {
                IsHandeld(e, filename);
                return;
            }
            catch (Exception e)
            {
                IsHandeld(e, filename);
                Console.WriteLine("first chance exception of type '" + e.GetType() + "' in assambly '" + filename +
                                  "' was NOT Handeled by StrongNameCatalog ...");
                cancel();
            }

            if (assemblyName == null)
                return;
            #if (SECLOADING)
                                    var publicKey = assemblyName.GetPublicKey();

                                    if (publicKey == null)
                                        continue;

                                    var trusted = _trustedKeys.Any(trustedKey => assemblyName.GetPublicKey().SequenceEqual(trustedKey));

                                    if (!trusted)
                                        continue;
            #endif
            try
            {
                var assam = new AssemblyCatalog(filename);

                if (!assam.Parts.Any())
                {
                    ImportPool.AddNotAnImportMessage(assam.Assembly);
                    return;
                }

                if (_aggregateCatalog.Catalogs.Any(s => s.ToString() == assam.ToString()))
                    return;

                if (Changing != null)
                {
                    Changing.Invoke(this,
                                    new ComposablePartCatalogChangeEventArgs(assam.Parts,
                                                                             new List<ComposablePartDefinition>(), null));
                }

                _aggregateCatalog.Catalogs.Add(assam);
                ImportPool.AddSuccessIncludedMessage(filename);

                if (Changed != null)
                {
                    Changed.Invoke(this,
                                   new ComposablePartCatalogChangeEventArgs(assam.Parts,
                                                                            new List<ComposablePartDefinition>(), null));
                }
            }
            catch (Exception e)
            {
                IsHandeld(e, filename);
                return;
            }
        }
开发者ID:JPVenson,项目名称:Shell_Temp,代码行数:95,代码来源:StrongNameCatalog.cs


注:本文中的System.ComponentModel.Composition.Hosting.AssemblyCatalog.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。