本文整理汇总了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;
}
}