本文整理汇总了C#中RuntimeAssembly类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeAssembly类的具体用法?C# RuntimeAssembly怎么用?C# RuntimeAssembly使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeAssembly类属于命名空间,在下文中一共展示了RuntimeAssembly类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnReflectionOnlyNamespaceResolveEvent
internal static RuntimeAssembly[] OnReflectionOnlyNamespaceResolveEvent(AppDomain appDomain, RuntimeAssembly assembly, string namespaceName)
{
EventHandler<NamespaceResolveEventArgs> eventHandler = ReflectionOnlyNamespaceResolve;
if (eventHandler != null)
{
Delegate[] ds = eventHandler.GetInvocationList();
int len = ds.Length;
for (int i = 0; i < len; i++)
{
NamespaceResolveEventArgs eventArgs = new NamespaceResolveEventArgs(namespaceName, assembly);
((EventHandler<NamespaceResolveEventArgs>)ds[i])(appDomain, eventArgs);
Collection<Assembly> assembliesCollection = eventArgs.ResolvedAssemblies;
if (assembliesCollection.Count > 0)
{
RuntimeAssembly[] retAssemblies = new RuntimeAssembly[assembliesCollection.Count];
int retIndex = 0;
foreach (Assembly asm in assembliesCollection)
{
retAssemblies[retIndex] = AppDomain.GetRuntimeAssembly(asm);
retIndex++;
}
return retAssemblies;
}
}
}
return null;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:30,代码来源:WindowsRuntimeMetadata.cs
示例2: CheckAssembly
internal static void CheckAssembly(RuntimeAssembly asm, CodeAccessPermission demand)
{
PermissionSet set;
PermissionSet set2;
asm.GetGrantSet(out set, out set2);
CheckHelper(set, set2, demand, PermissionToken.GetToken(demand), RuntimeMethodHandleInternal.EmptyHandle, asm, SecurityAction.Demand, true);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CodeAccessSecurityEngine.cs
示例3: RuntimeLibrary
public RuntimeLibrary(
string type,
string name,
string version,
string hash,
IReadOnlyList<RuntimeAssetGroup> runtimeAssemblyGroups,
IReadOnlyList<RuntimeAssetGroup> nativeLibraryGroups,
IEnumerable<ResourceAssembly> resourceAssemblies,
IEnumerable<Dependency> dependencies,
bool serviceable)
: base(type, name, version, hash, dependencies, serviceable)
{
if (runtimeAssemblyGroups == null)
{
throw new ArgumentNullException(nameof(runtimeAssemblyGroups));
}
if (nativeLibraryGroups == null)
{
throw new ArgumentNullException(nameof(nativeLibraryGroups));
}
if (resourceAssemblies == null)
{
throw new ArgumentNullException(nameof(resourceAssemblies));
}
RuntimeAssemblyGroups = runtimeAssemblyGroups;
ResourceAssemblies = resourceAssemblies.ToArray();
NativeLibraryGroups = nativeLibraryGroups;
Assemblies = new RuntimeAssembly[0];
NativeLibraries = new string[0];
}
开发者ID:krytarowski,项目名称:cli,代码行数:31,代码来源:RuntimeLibrary.cs
示例4: StrongName
internal StrongName(StrongNamePublicKeyBlob blob, string name, System.Version version, Assembly assembly)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
}
if (blob == null)
{
throw new ArgumentNullException("blob");
}
if (version == null)
{
throw new ArgumentNullException("version");
}
RuntimeAssembly assembly2 = assembly as RuntimeAssembly;
if ((assembly != null) && (assembly2 == null))
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
}
this.m_publicKeyBlob = blob;
this.m_name = name;
this.m_version = version;
this.m_assembly = assembly2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:StrongName.cs
示例5: AssemblyEvidenceFactory
/// <summary>
/// Create a factory which can generate evidence for the specified assembly
/// </summary>
private AssemblyEvidenceFactory(RuntimeAssembly targetAssembly, PEFileEvidenceFactory peFileFactory)
{
Contract.Assert(targetAssembly != null);
Contract.Assert(peFileFactory != null);
m_targetAssembly = targetAssembly;
m_peFileFactory = peFileFactory;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:11,代码来源:AssemblyEvidenceFactory.cs
示例6: EventItfInfo
public EventItfInfo(string strEventItfName, string strSrcItfName, string strEventProviderName, RuntimeAssembly asmImport, RuntimeAssembly asmSrcItf)
{
this.m_strEventItfName = strEventItfName;
this.m_strSrcItfName = strSrcItfName;
this.m_strEventProviderName = strEventProviderName;
this.m_asmImport = asmImport;
this.m_asmSrcItf = asmSrcItf;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:EventItfInfo.cs
示例7: GetCustomAttribute
internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly)
{
Type[] o = null;
RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack<Type[]>(ref o));
TypeForwardedToAttribute[] attributeArray = new TypeForwardedToAttribute[o.Length];
for (int i = 0; i < o.Length; i++)
{
attributeArray[i] = new TypeForwardedToAttribute(o[i]);
}
return attributeArray;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:TypeForwardedToAttribute.cs
示例8: CaseInsensitiveManifestResourceStreamLookup
private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, string name)
{
StringBuilder builder = new StringBuilder();
if (this._mediator.LocationInfo != null)
{
string str = this._mediator.LocationInfo.Namespace;
if (str != null)
{
builder.Append(str);
if (name != null)
{
builder.Append(Type.Delimiter);
}
}
}
builder.Append(name);
string str2 = builder.ToString();
CompareInfo compareInfo = CultureInfo.InvariantCulture.CompareInfo;
string str3 = null;
foreach (string str4 in satellite.GetManifestResourceNames())
{
if (compareInfo.Compare(str4, str2, CompareOptions.IgnoreCase) == 0)
{
if (str3 != null)
{
throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", new object[] { str2, satellite.ToString() }));
}
str3 = str4;
}
}
if (FrameworkEventSource.IsInitialized)
{
if (str3 != null)
{
FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
}
else
{
FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
}
}
if (str3 == null)
{
return null;
}
bool skipSecurityCheck = (this._mediator.MainAssembly == satellite) && (this._mediator.CallingAssembly == this._mediator.MainAssembly);
StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
Stream stream = satellite.GetManifestResourceStream(str3, ref lookForMyCaller, skipSecurityCheck);
if ((stream != null) && FrameworkEventSource.IsInitialized)
{
FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str3);
}
return stream;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:ManifestBasedResourceGroveler.cs
示例9: GetCustomAttribute
internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly)
{
Type[] types = null;
RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref types));
TypeForwardedToAttribute[] attributes = new TypeForwardedToAttribute[types.Length];
for (int i = 0; i < types.Length; ++i)
attributes[i] = new TypeForwardedToAttribute(types[i]);
return attributes;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:TypeForwardedToAttribute.cs
示例10: EventItfInfo
public EventItfInfo(String strEventItfName,
String strSrcItfName,
String strEventProviderName,
RuntimeAssembly asmImport,
RuntimeAssembly asmSrcItf)
{
m_strEventItfName = strEventItfName;
m_strSrcItfName = strSrcItfName;
m_strEventProviderName = strEventProviderName;
m_asmImport = asmImport;
m_asmSrcItf = asmSrcItf;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:EventItfInfo.cs
示例11: ThrowSecurityException
#pragma warning disable 618
private static void ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
#pragma warning restore 618
{
AssemblyName asmName = null;
Evidence asmEvidence = null;
if (asm != null)
{
// Assert here because reflection will check grants and if we fail the check,
// there will be an infinite recursion that overflows the stack.
PermissionSet.s_fullTrust.Assert();
asmName = asm.GetName();
}
throw SecurityException.MakeSecurityException(asmName, asmEvidence, granted, refused, rmh, action, demand, permThatFailed);
}
开发者ID:kouvel,项目名称:coreclr,代码行数:15,代码来源:CodeAccessSecurityEngine.cs
示例12: TryResolve
public sealed override Exception TryResolve(ReflectionDomain reflectionDomain, RuntimeAssembly currentAssembly, bool ignoreCase, out RuntimeType result)
{
result = null;
if (AssemblyName == null)
{
return TypeName.TryResolve(reflectionDomain, currentAssembly, ignoreCase, out result);
}
else
{
RuntimeAssembly newAssembly;
Exception assemblyLoadException = RuntimeAssembly.TryGetRuntimeAssembly(reflectionDomain, AssemblyName, out newAssembly);
if (assemblyLoadException != null)
return assemblyLoadException;
return TypeName.TryResolve(reflectionDomain, newAssembly, ignoreCase, out result);
}
}
开发者ID:noahfalk,项目名称:corert,代码行数:16,代码来源:TypeName.cs
示例13: Hash
public Hash(Assembly assembly)
{
if (assembly == null)
{
throw new ArgumentNullException("assembly");
}
if (assembly.IsDynamic)
{
throw new ArgumentException(Environment.GetResourceString("Security_CannotGenerateHash"), "assembly");
}
this.m_hashes = new Dictionary<Type, byte[]>();
this.m_assembly = assembly as RuntimeAssembly;
if (this.m_assembly == null)
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:Hash.cs
示例14: ResourceManager
public ResourceManager(Type resourceSource)
{
if (null == resourceSource)
{
throw new ArgumentNullException("resourceSource");
}
if (!(resourceSource is RuntimeType))
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
}
this._locationInfo = resourceSource;
this.MainAssembly = this._locationInfo.Assembly;
this.BaseNameField = resourceSource.Name;
this.CommonSatelliteAssemblyInit();
this.m_callingAssembly = (RuntimeAssembly) Assembly.GetCallingAssembly();
if ((this.MainAssembly == typeof(object).Assembly) && (this.m_callingAssembly != this.MainAssembly))
{
this.m_callingAssembly = null;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:ResourceManager.cs
示例15: CreateAssemblyName
[System.Security.SecurityCritical] // auto-generated
internal static AssemblyName CreateAssemblyName(
String assemblyString,
bool forIntrospection,
out RuntimeAssembly assemblyFromResolveEvent)
{
if (assemblyString == null)
throw new ArgumentNullException("assemblyString");
Contract.EndContractBlock();
if ((assemblyString.Length == 0) ||
(assemblyString[0] == '\0'))
throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
if (forIntrospection)
AppDomain.CheckReflectionOnlyLoadSupported();
AssemblyName an = new AssemblyName();
an.Name = assemblyString;
assemblyFromResolveEvent = null; // instead of an.nInit(out assemblyFromResolveEvent, forIntrospection, true);
return an;
}
开发者ID:jamescourtney,项目名称:mono,代码行数:23,代码来源:MonoAssembly.cs
示例16: RuntimeModule
internal RuntimeModule(RuntimeAssembly assembly, ICorDebugModule comModule)
{
_assembly = assembly;
_comModule = comModule;
Symbols = _assembly.Domain.Process.Session.SymbolsServer.GetSymbolsProviderForFile(this.Name);
if (Symbols != null)
{
int index = 0, max = Session.PendingBreakpoints.Count;
Session.ProgressReporter.Report("Symbol reader present. Finding pending breakpoints to set.");
while (index < max)
{
if (TrySetBreakpoint(Session.PendingBreakpoints[index]))
{
max--;
Session.PendingBreakpoints.RemoveAt(index);
}
else
{
index++;
}
}
}
}
开发者ID:die-Deutsche-Orthopaedie,项目名称:LiteDevelop,代码行数:24,代码来源:RuntimeModule.cs
示例17: OnDeserialized
private void OnDeserialized(StreamingContext ctx)
{
_resourceSets = new Dictionary<String, ResourceSet>();
_lastUsedResourceCache = new CultureNameResourceSetPair();
// set up resource groveler, depending on whether this ResourceManager
// is looking for files or assemblies
ResourceManagerMediator mediator = new ResourceManagerMediator(this);
if (UseManifest)
{
resourceGroveler = new ManifestBasedResourceGroveler(mediator);
}
else
{
resourceGroveler = new FileBasedResourceGroveler(mediator);
}
// correct callingAssembly for v2
if (this.m_callingAssembly == null)
{
this.m_callingAssembly = (RuntimeAssembly)_callingAssembly;
}
// v2 does this lazily
if (UseManifest && this._neutralResourcesCulture == null)
{
_neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
}
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:28,代码来源:ResourceManager.cs
示例18: ResourceManager
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public ResourceManager(Type resourceSource)
{
if (null==resourceSource)
throw new ArgumentNullException("resourceSource");
Contract.EndContractBlock();
if (!(resourceSource is RuntimeType))
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
_locationInfo = resourceSource;
MainAssembly = _locationInfo.Assembly;
BaseNameField = resourceSource.Name;
SetAppXConfiguration();
CommonAssemblyInit();
m_callingAssembly = (RuntimeAssembly)Assembly.GetCallingAssembly();
// Special case for mscorlib - protect mscorlib's private resources.
if (MainAssembly == typeof(Object).Assembly && m_callingAssembly != MainAssembly)
{
m_callingAssembly = null;
}
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:25,代码来源:ResourceManager.cs
示例19: Init
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
private void Init()
{
m_callingAssembly = (RuntimeAssembly)Assembly.GetCallingAssembly();
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:5,代码来源:ResourceManager.cs
示例20: ShouldUseSatelliteAssemblyResourceLookupUnderAppX
private bool ShouldUseSatelliteAssemblyResourceLookupUnderAppX(RuntimeAssembly resourcesAssembly)
{
bool fUseSatelliteAssemblyResourceLookupUnderAppX = resourcesAssembly.IsFrameworkAssembly();
#if FEATURE_CORECLR
if (!fUseSatelliteAssemblyResourceLookupUnderAppX)
{
// Check to see if the assembly is under PLATFORM_RESOURCE_ROOTS. If it is, then we should use satellite assembly lookup for it.
String platformResourceRoots = (String)(AppDomain.CurrentDomain.GetData("PLATFORM_RESOURCE_ROOTS"));
if ((platformResourceRoots != null) && (platformResourceRoots != String.Empty))
{
string resourceAssemblyPath = resourcesAssembly.Location;
// Loop through the PLATFORM_RESOURCE_ROOTS and see if the assembly is contained in it.
foreach(string pathPlatformResourceRoot in platformResourceRoots.Split(Path.PathSeparator))
{
if (resourceAssemblyPath.StartsWith(pathPlatformResourceRoot, StringComparison.CurrentCultureIgnoreCase))
{
// Found the resource assembly to be present in one of the PLATFORM_RESOURCE_ROOT, so stop the enumeration loop.
fUseSatelliteAssemblyResourceLookupUnderAppX = true;
break;
}
}
}
}
#endif // FEATURE_CORECLR
return fUseSatelliteAssemblyResourceLookupUnderAppX;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:29,代码来源:ResourceManager.cs
注:本文中的RuntimeAssembly类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论