本文整理汇总了C#中System.Reflection.AssemblyName.EndsWith方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyName.EndsWith方法的具体用法?C# AssemblyName.EndsWith怎么用?C# AssemblyName.EndsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.AssemblyName
的用法示例。
在下文中一共展示了AssemblyName.EndsWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAssemblies
public Assembly FindAssemblies(object sender, ResolveEventArgs args)
{
// If a linkable component loads additional assemblies OmiEd might
// have issues resolving them
// This will help by guessing that the additional assembly might be
// in the same folder as the linkable component assembly and trying that.
// Not guarantied to work but definitely does help in some cases.
var name = new AssemblyName(args.Name).Name;
if (name.EndsWith(".resources") || name.StartsWith("System.") || name.EndsWith(".XmlSerializers"))
{
// don't clutter session log with these
return null;
}
Assembly assembly;
string file;
FileInfo fi;
var sb = new StringBuilder();
bool loaded = false;
try
{
sb.Append(string.Format("AssemblyLoader({0}).FindAssemblies({1})",
_caption, name));
if (_loaded.TryGetValue(name, out assembly))
{
sb.AppendLine();
sb.AppendLine(string.Format("\tPreviously loaded as({0})", assembly.EscapedCodeBase));
return assembly;
}
if (args.RequestingAssembly != null)
{
var uri = Utilities.AssemblyUri(args.RequestingAssembly);
AddSearchUri(uri);
}
var folderpath = string.Empty;
foreach (string extension in _potentialAssemblyExtensions)
{
file = name;
if (!file.EndsWith(extension))
file = name + extension;
foreach (var uri in _uris)
{
if (!Utilities.UriIsExistingFolderPath(uri, out folderpath))
continue;
fi = new FileInfo(Path.Combine(folderpath, file));
if (!fi.Exists)
continue;
sb.AppendLine();
sb.Append(string.Format("\tLoadFrom({0})", fi.FullName));
assembly = Assembly.LoadFrom(fi.FullName);
if (assembly != null)
{
loaded = true;
_loaded.Add(name, assembly);
return assembly;
}
}
}
return null;
}
finally
{
if (args.RequestingAssembly != null)
sb.AppendFormat("\t\tRequestingAssembly\r\n\t\t\t{0}\r\n\t\t\t{1}\r\n",
args.RequestingAssembly.FullName,
args.RequestingAssembly.CodeBase);
if (loaded)
Trace.TraceInformation(sb.ToString());
else
{
sb.Append(", unfound");
Trace.TraceWarning(sb.ToString());
}
}
}
示例2: HandlerImpl
private Assembly HandlerImpl(object sender, ResolveEventArgs args) {
if (_ignore) return null;
var id = new AssemblyName(args.Name).Name;
Assembly result;
if (_cached.TryGetValue(id, out result)) return result;
if (string.Equals(id, "System.Web", StringComparison.OrdinalIgnoreCase)) {
if (MessageBox.Show("Looks like you don’t have .NET 4.5.2 installed. Would you like to install it?", "Error",
MessageBoxButton.YesNo, MessageBoxImage.Asterisk) == MessageBoxResult.Yes) {
Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=42642");
}
Environment.Exit(10);
}
#if LOCALIZABLE
if (name == "Content Manager.resources" && _first) {
Log(">> Content Manager.resources <<");
return null;
}
if (name.EndsWith(".resources")) {
var culture = splitted.ElementAtOrDefault(2)?.Split(new[] { "Culture=" }, StringSplitOptions.None).ElementAtOrDefault(1);
Log("culture: " + culture);
if (culture == "neutral") return null;
var resourceId = CultureInfo.CurrentUICulture.IetfLanguageTag;
if (!string.Equals(resourceId, "en-US", StringComparison.OrdinalIgnoreCase)) {
name = name.Replace(".resources", "." + resourceId);
Log("localized: " + name);
} else {
Log("skip: " + args.Name);
return null;
}
}
#else
if (id.StartsWith("PresentationFramework") || id.EndsWith(".resources")) return null;
#endif
if (id == "Magick.NET-x86") return null;
if (_logFilename != null) {
Log("Resolve: " + args.Name + " as " + id);
}
try {
_ignore = true;
result = Extract(id);
if (OptionCache) {
_cached[id] = result;
}
return result;
} finally {
_ignore = false;
}
}