本文整理汇总了C#中IAssemblySymbol类的典型用法代码示例。如果您正苦于以下问题:C# IAssemblySymbol类的具体用法?C# IAssemblySymbol怎么用?C# IAssemblySymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAssemblySymbol类属于命名空间,在下文中一共展示了IAssemblySymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAssemblyLink
protected void AddAssemblyLink(IAssemblySymbol assemblySymbol)
{
var name = assemblySymbol.Identity.Name;
var navInfo = _libraryManager.LibraryService.NavInfoFactory.CreateForAssembly(assemblySymbol);
_description.AddDescriptionText3(name, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
}
示例2: AddAssemblyLink
protected void AddAssemblyLink(IAssemblySymbol assemblySymbol)
{
var name = assemblySymbol.Identity.Name;
var navInfo = _libraryManager.GetAssemblyNavInfo(assemblySymbol);
_description.AddDescriptionText3(name, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
}
示例3: GetAssemblyInfo
public static string GetAssemblyInfo(IAssemblySymbol assemblySymbol)
{
return string.Format(
"{0} {1}",
FeaturesResources.Assembly,
assemblySymbol.Identity.GetDisplayName());
}
示例4: IsSameAssemblyOrHasFriendAccessTo
public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
{
return
Equals(assembly, toAssembly) ||
(assembly.IsInteractive && toAssembly.IsInteractive) ||
toAssembly.GivesAccessTo(assembly);
}
示例5: IsAccessibleWithin
/// <summary>
/// Checks if 'symbol' is accessible from within assembly 'within'.
/// </summary>
public static bool IsAccessibleWithin(
this ISymbol symbol,
IAssemblySymbol within,
ITypeSymbol throughTypeOpt = null)
{
return IsSymbolAccessibleCore(symbol, within, throughTypeOpt, out var failedThroughTypeCheck);
}
示例6: CompareTo
public static IEnumerable<TypeDiff> CompareTo(this IAssemblySymbol assembly, IAssemblySymbol comparedTo)
{
var types = assembly.GlobalNamespace.GetTypes();
var comparedToTypes = comparedTo.GlobalNamespace.GetTypes();
var result = types.FullOuterJoin(comparedToTypes, NamespaceOrTypeSymbolComparer.Instance, (a, b) => a.CompareTo(b));
return result;
}
示例7: ShouldCreateFromScratch
private static bool ShouldCreateFromScratch(
Solution solution,
IAssemblySymbol assembly,
string filePath,
out string prefix,
out VersionStamp version,
CancellationToken cancellationToken)
{
prefix = null;
version = default(VersionStamp);
var service = solution.Workspace.Services.GetService<IAssemblySerializationInfoService>();
if (service == null)
{
return true;
}
// check whether the assembly that belong to a solution is something we can serialize
if (!service.Serializable(solution, filePath))
{
return true;
}
if (!service.TryGetSerializationPrefixAndVersion(solution, filePath, out prefix, out version))
{
return true;
}
return false;
}
示例8: LoadOrCreateAsync
/// <summary>
/// this is for a metadata reference in a solution
/// </summary>
private static async Task<SymbolTreeInfo> LoadOrCreateAsync(Solution solution, IAssemblySymbol assembly, string filePath, CancellationToken cancellationToken)
{
// if assembly is not from a file, just create one on the fly
if (filePath == null || !File.Exists(filePath) || !FilePathUtilities.PartOfFrameworkOrReferencePaths(filePath))
{
return Create(VersionStamp.Default, assembly, cancellationToken);
}
// if solution is not from a disk, just create one.
if (solution.FilePath == null || !File.Exists(solution.FilePath))
{
return Create(VersionStamp.Default, assembly, cancellationToken);
}
// okay, see whether we can get one from persistence service.
var relativePath = FilePathUtilities.GetRelativePath(solution.FilePath, filePath);
var version = VersionStamp.Create(File.GetLastWriteTimeUtc(filePath));
var persistentStorageService = solution.Workspace.Services.GetService<IPersistentStorageService>();
// attempt to load from persisted state. metadata reference is solution wise information
SymbolTreeInfo info;
using (var storage = persistentStorageService.GetStorage(solution))
{
var key = PrefixMetadataSymbolTreeInfo + relativePath;
using (var stream = await storage.ReadStreamAsync(key, cancellationToken).ConfigureAwait(false))
{
if (stream != null)
{
using (var reader = new ObjectReader(stream))
{
info = ReadFrom(reader);
if (info != null && VersionStamp.CanReusePersistedVersion(version, info.version))
{
return info;
}
}
}
}
cancellationToken.ThrowIfCancellationRequested();
// compute it if we couldn't load it from cache
info = Create(version, assembly, cancellationToken);
if (info != null)
{
using (var stream = SerializableBytes.CreateWritableStream())
using (var writer = new ObjectWriter(stream, cancellationToken: cancellationToken))
{
info.WriteTo(writer);
stream.Position = 0;
await storage.WriteStreamAsync(key, stream, cancellationToken).ConfigureAwait(false);
}
}
}
return info;
}
示例9: ExternAliasRecord
public ExternAliasRecord(string alias, IAssemblySymbol targetAssembly)
{
Debug.Assert(alias != null);
Debug.Assert(targetAssembly != null);
Alias = alias;
TargetAssembly = targetAssembly;
}
示例10: GetAssemblyAttributes
public static IEnumerable<string> GetAssemblyAttributes(IAssemblySymbol assemblySymbol)
{
var attributes = assemblySymbol.GetAttributes();
foreach (var attribute in attributes)
{
yield return attribute.ToString();
}
}
示例11: AssemblyHasPublicTypes
private static bool AssemblyHasPublicTypes(IAssemblySymbol assembly)
{
return assembly
.GlobalNamespace
.GetMembers()
.OfType<INamedTypeSymbol>()
.Where(s => s.DeclaredAccessibility == Accessibility.Public)
.Any();
}
示例12: IsOrUsesAssemblyType
private static bool IsOrUsesAssemblyType(ITypeSymbol typeSymbol, IAssemblySymbol assemblySymbol)
{
if (typeSymbol.ContainingAssembly == assemblySymbol)
{
return true;
}
INamedTypeSymbol namedTypeSymbol = typeSymbol as INamedTypeSymbol;
return namedTypeSymbol != null && namedTypeSymbol.IsGenericType
&& namedTypeSymbol.TypeArguments.Any(t => IsOrUsesAssemblyType(t, assemblySymbol));
}
示例13: MetadataSearchScope
public MetadataSearchScope(
Solution solution,
IAssemblySymbol assembly,
PortableExecutableReference metadataReference,
bool ignoreCase,
CancellationToken cancellationToken)
: base(ignoreCase, cancellationToken)
{
_solution = solution;
_assembly = assembly;
_metadataReference = metadataReference;
}
示例14: IsObjectMapperFrameworkAssembly
public static bool IsObjectMapperFrameworkAssembly(IAssemblySymbol assemblySymbol)
{
if (assemblySymbol.Name != "ObjectMapper.Framework")
{
return false;
}
if (!assemblySymbol.Identity.IsStrongName || !_publicKeyToken.SequenceEqual(assemblySymbol.Identity.PublicKeyToken))
{
return false;
}
return true;
}
示例15: ImportRecord
public ImportRecord(
ImportTargetKind targetKind,
string alias = null,
ITypeSymbol targetType = null,
string targetString = null,
IAssemblySymbol targetAssembly = null,
string targetAssemblyAlias = null)
{
TargetKind = targetKind;
Alias = alias;
TargetType = targetType;
TargetString = targetString;
TargetAssembly = targetAssembly;
TargetAssemblyAlias = targetAssemblyAlias;
}