private Assembly GetAssembly(string/*!*/ assemblyName, bool throwOnError, bool tryPartialName) {
#if SILVERLIGHT
tryPartialName = false;
#endif
try {
return Platform.LoadAssembly(assemblyName);
} catch (Exception e) {
if (!tryPartialName || !(e is FileNotFoundException)) {
if (throwOnError) {
throw RubyExceptions.CreateLoadError(e);
} else {
return null;
}
}
}
#if SILVERLIGHT
throw Assert.Unreachable;
#else
#pragma warning disable 618,612 // csc, gmcs
Assembly assembly;
try {
assembly = Assembly.LoadWithPartialName(assemblyName);
} catch (Exception e) {
if (throwOnError) {
throw RubyExceptions.CreateLoadError(e);
} else {
return null;
}
}
if (assembly == null && throwOnError) {
throw RubyExceptions.CreateLoadError(String.Format("Assembly '{0}' not found", assemblyName));
}
#pragma warning restore 618,612
return assembly;
#endif
}