本文整理汇总了C#中IAssembly类的典型用法代码示例。如果您正苦于以下问题:C# IAssembly类的具体用法?C# IAssembly怎么用?C# IAssembly使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAssembly类属于命名空间,在下文中一共展示了IAssembly类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimpleCompilation
public SimpleCompilation(ISolutionSnapshot solutionSnapshot, IUnresolvedAssembly mainAssembly, IEnumerable<IAssemblyReference> assemblyReferences)
{
if (solutionSnapshot == null)
throw new ArgumentNullException("solutionSnapshot");
if (mainAssembly == null)
throw new ArgumentNullException("mainAssembly");
if (assemblyReferences == null)
throw new ArgumentNullException("assemblyReferences");
this.solutionSnapshot = solutionSnapshot;
this.context = new SimpleTypeResolveContext(this);
this.mainAssembly = mainAssembly.Resolve(context);
List<IAssembly> assemblies = new List<IAssembly>();
assemblies.Add(this.mainAssembly);
List<IAssembly> referencedAssemblies = new List<IAssembly>();
foreach (var asmRef in assemblyReferences) {
IAssembly asm;
try {
asm = asmRef.Resolve(context);
} catch (InvalidOperationException) {
throw new InvalidOperationException("Tried to initialize compilation with an invalid assembly reference. (Forgot to load the assembly reference ? - see CecilLoader)");
}
if (asm != null && !assemblies.Contains(asm))
assemblies.Add(asm);
if (asm != null && !referencedAssemblies.Contains(asm))
referencedAssemblies.Add(asm);
}
this.assemblies = assemblies.AsReadOnly();
this.referencedAssemblies = referencedAssemblies.AsReadOnly();
this.knownTypeCache = new KnownTypeCache(this);
}
示例2: GetProjectInfo
public NSObjectProjectInfo GetProjectInfo (DotNetProject project, IAssembly lookinAssembly = null)
{
var dom = TypeSystemService.GetProjectContentWrapper (project);
project.ReferenceAddedToProject += HandleDomReferencesUpdated;
project.ReferenceRemovedFromProject += HandleDomReferencesUpdated;
return GetProjectInfo (dom, lookinAssembly);
}
示例3: DerivedTypeInformation
/// <summary>
/// Initializes a new instance of the <see cref="DerivedTypeInformation"/> class.
/// </summary>
/// <param name="assemblyManager">The assembly manager.</param>
/// <param name="visibility">The visibility.</param>
public DerivedTypeInformation(IAssemblyManager assemblyManager, IVisibilityConfiguration visibility)
{
this.table = new Dictionary<ITypeReference, List<ITypeDeclaration>>();
IAssembly[] assemblies = new IAssembly[assemblyManager.Assemblies.Count];
assemblyManager.Assemblies.CopyTo(assemblies, 0);
FastTypeEnumerator enumerator = new FastTypeEnumerator(assemblies);
foreach (ITypeDeclaration typeDeclaration in enumerator.Types)
{
if (ReflectorHelper.IsVisible(typeDeclaration, visibility))
{
ITypeReference baseType = typeDeclaration.BaseType;
if (baseType != null)
{
if (baseType.GenericType != null)
{
this.AddToTable(baseType.GenericType, typeDeclaration);
}
else
{
this.AddToTable(baseType, typeDeclaration);
}
}
foreach (ITypeReference interfaceType in typeDeclaration.Interfaces)
{
this.AddToTable(interfaceType, typeDeclaration);
}
}
}
}
示例4: SimpleTypeResolveContext
private SimpleTypeResolveContext(ICompilation compilation, IAssembly currentAssembly, ITypeDefinition currentTypeDefinition, IMember currentMember)
{
this.compilation = compilation;
this.currentAssembly = currentAssembly;
this.currentTypeDefinition = currentTypeDefinition;
this.currentMember = currentMember;
}
示例5: ApplyTo
public override void ApplyTo(IAssembly assembly, IAttributeStore attributeStore, IErrorReporter errorReporter) {
foreach (var t in assembly.GetAllTypeDefinitions()) {
if (!attributeStore.AttributesFor(t).HasAttribute<DefaultMemberReflectabilityAttribute>()) {
ApplyTo(t, attributeStore, errorReporter);
}
}
}
示例6: BlobReader
public BlobReader(byte[] buffer, IAssembly currentResolvedAssembly)
{
if (buffer == null)
throw new ArgumentNullException("buffer");
this.buffer = buffer;
this.currentResolvedAssembly = currentResolvedAssembly;
}
示例7: GetTestClasses
public override List<ITestClass> GetTestClasses(IAssembly assembly, TestClassInstanceDictionary instances)
{
return new List<ITestClass>
{
_test
};
}
示例8: ResolveNormal
DnSpyFile ResolveNormal(IAssembly assembly, ModuleDef sourceModule, bool delayLoad) {
var existingFile = fileList.FindAssembly(assembly);
if (existingFile != null)
return existingFile;
var file = LookupFromSearchPaths(assembly, sourceModule, true);
if (file != null)
return fileList.AddFile(file, fileList.AssemblyLoadEnabled, delayLoad);
if (fileList.UseGAC) {
var gacFile = GacInterop.FindAssemblyInNetGac(assembly);
if (gacFile != null)
return fileList.GetOrCreate(gacFile, fileList.AssemblyLoadEnabled, true, delayLoad);
foreach (var path in GacInfo.OtherGacPaths) {
file = TryLoadFromDir(assembly, true, path);
if (file != null)
return fileList.AddFile(file, fileList.AssemblyLoadEnabled, delayLoad);
}
}
file = LookupFromSearchPaths(assembly, sourceModule, false);
if (file != null)
return fileList.AddFile(file, fileList.AssemblyLoadEnabled, delayLoad);
return null;
}
示例9: AssemblyManager
/// <summary>
/// Create a new assembly manager, takes in the harness, provider
/// reference and actual IAssembly object.
/// </summary>
/// <param name="runFilter">The test run filter object.</param>
/// <param name="testHarness">Harness object.</param>
/// <param name="provider">The unit test metadata provider.</param>
/// <param name="testAssembly">The test assembly metadata object.</param>
public AssemblyManager(TestRunFilter runFilter, UnitTestHarness testHarness, IUnitTestProvider provider, IAssembly testAssembly) : base(testHarness, provider)
{
_filter = runFilter;
_assembly = testAssembly;
_testClasses = new CompositeWorkItem();
ClassInstances = new TestClassInstanceDictionary();
}
示例10: GetReferences
private AsmReference GetReferences(IAssembly currentAssembly, AsmReference referenceDictionary, uint currentRecursionLimit = uint.MaxValue)
{
Contract.Requires<ArgumentNullException>(currentAssembly != null);
Contract.Requires<ArgumentNullException>(referenceDictionary != null);
if (referenceDictionary.ContainsKey(currentAssembly))
{
return referenceDictionary;
}
if (currentRecursionLimit == 0)
{
return referenceDictionary;
}
referenceDictionary.Add(currentAssembly, currentAssembly.References);
currentRecursionLimit--;
foreach (var referencedAssembly in currentAssembly.References)
{
var assemblyReferences = GetReferences(referencedAssembly, referenceDictionary, currentRecursionLimit);
referenceDictionary.Add(assemblyReferences);
}
return referenceDictionary;
}
示例11: WindowsService
private WindowsService(bool interactive, IServiceWrapper wrapper, ILogger logger,
ICommandLineParser parser, IConsoleHarness console, IAssembly assembly,
ServiceAttributeReader reader, WindowsServiceManager manager, HostFactory hostFactory)
{
Logger = logger;
_metadata = reader.GetMetadata(this);
_interactive = interactive;
_assembly = assembly;
Console = console;
_manager = manager;
_manager.SetMetadata(_metadata);
_hostFactory = hostFactory;
CommandLineParser = parser
.SetApplicationName(reader.GetAttribute(this).DisplayName)
.SetDescription(reader.GetAttribute(this).Description)
.AddOption("quiet", "q", "Enable quiet mode. Will display only errors on the console.",
noArgs => _metadata.Quiet = true)
.AddOption("silent", "si", "Enable silent mode. Will display nothing (not even errors) on the console.",
noArgs => _metadata.Silent = true)
.AddOption("logtoconsole", "l", "Instructs the installer/uninstaller to log the output to the console.",
noArgs => _manager.LogToConsole = true)
.AddOption("debug", "d", "Pauses to attach a debugger.", noArgs => EnableDebugMode())
.AddOption("uninstall", "u", "Uninstalls the service.", noArgs => _manager.Uninstall())
.AddOption("install", "i", "Installs the service.", noArgs => _manager.Install())
.AddOption("installandstart", "is", "Installs and then starts the service.",
noArgs => _manager.InstallAndStart())
.AddOption("start", "s", "Starts the service.", noArgs => _manager.StartService())
.AddOption("stop", "x", "Stops the service.", noArgs => _manager.StopService())
.AddOption("status", "st", "Displays the status of the service.", noArgs => _manager.ShowStatus());
Harness = wrapper.WrapService(this);
}
示例12: GetInstance
internal static WindowsServiceManager GetInstance(
IConsoleHarness harness,
IAssembly assembly,
ManagedInstallerProxy installerProxy)
{
return new Implementation(harness, assembly, installerProxy);
}
示例13: AssemblyDispatcher
public AssemblyDispatcher(UnitTestHarness testHarness, IUnitTestProvider provider,
IAssembly testAssembly) : base(testHarness, provider)
{
_assembly = testAssembly;
_testClasses = new TestWorkItemDispatcher();
_classInstances = new TestClassInstanceCollection();
}
示例14: ConstructorCallWeave
public ConstructorCallWeave(IAssembly parentAssembly, MethodDefinition parentMethod, Instruction newInstruction, MethodDefinition constructor)
{
_parentAssembly = parentAssembly;
_parentMethod = parentMethod;
_constructor = constructor;
_newInstruction = newInstruction;
}
示例15: GetProject
public IProject GetProject(IAssembly assembly)
{
if (assembly != null)
return GetProject(assembly.UnresolvedAssembly as IProjectContent);
else
return null;
}