本文整理汇总了C#中StringHandle类的典型用法代码示例。如果您正苦于以下问题:C# StringHandle类的具体用法?C# StringHandle怎么用?C# StringHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringHandle类属于命名空间,在下文中一共展示了StringHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportedMember
protected ImportedMember(ImportedModule module, StringHandle nameHandle, ImportedType declaringType)
{
Module = module;
DeclaringType = declaringType;
_nameHandle = nameHandle;
}
示例2: StartsWith
public bool StartsWith(StringHandle handle, string value)
{
if (value == null)
{
Throw.ValueArgumentNull();
}
return _reader.StringStream.StartsWith(handle, value, _reader.utf8Decoder);
}
示例3: Equals
public bool Equals(StringHandle handle, string value, bool ignoreCase)
{
if (value == null)
{
Throw.ValueArgumentNull();
}
return _reader.StringHeap.Equals(handle, value, _reader.Utf8Decoder, ignoreCase);
}
示例4: Equals
public bool Equals(StringHandle handle, string value)
{
if (value == null)
{
ThrowValueArgumentNull();
}
return _reader.StringStream.Equals(handle, value, _reader.utf8Decoder);
}
示例5: FormatAssemblyInfo
private static AssemblyReferenceInformation FormatAssemblyInfo(this MetadataReader metadataReader, string name, StringHandle cultureHandle, BlobHandle publicKeyTokenHandle, Version version)
{
var culture = cultureHandle.IsNil
? "neutral"
: metadataReader.GetString(cultureHandle);
var publicKeyToken = publicKeyTokenHandle.IsNil
? "null"
: metadataReader.FormatPublicKeyToken(publicKeyTokenHandle);
return new AssemblyReferenceInformation(name, version, culture, publicKeyToken);
}
示例6: GetAttributeNamespaceAndName
public static bool GetAttributeNamespaceAndName(this MetadataReader metadataReader, CustomAttributeHandle attributeHandle,
out StringHandle namespaceHandle, out StringHandle nameHandle)
{
EntityHandle attributeType, attributeCtor;
if (!GetAttributeTypeAndConstructor(metadataReader, attributeHandle, out attributeType, out attributeCtor))
{
namespaceHandle = default(StringHandle);
nameHandle = default(StringHandle);
return false;
}
return GetAttributeTypeNamespaceAndName(metadataReader, attributeType, out namespaceHandle, out nameHandle);
}
示例7: GetString
public static string GetString(this MetadataReader[] readers, StringHandle handle)
{
int index = MetadataTokens.GetHeapOffset(handle);
foreach (var reader in readers)
{
int length = reader.GetHeapSize(HeapIndex.String);
if (index < length)
{
return reader.GetString(MetadataTokens.StringHandle(index));
}
index -= length;
}
return null;
}
示例8: GetMetadataNameWithoutBackticks
private static string GetMetadataNameWithoutBackticks(MetadataReader reader, StringHandle name)
{
var blobReader = reader.GetBlobReader(name);
var backtickIndex = blobReader.IndexOf((byte)'`');
if (backtickIndex == -1)
{
return reader.GetString(name);
}
unsafe
{
return MetadataStringDecoder.DefaultUTF8.GetString(
blobReader.CurrentPointer, backtickIndex);
}
}
示例9: ProjectionInfo
public ProjectionInfo(
string winRtNamespace,
StringHandle.VirtualIndex clrNamespace,
StringHandle.VirtualIndex clrName,
AssemblyReferenceHandle.VirtualIndex clrAssembly,
TypeDefTreatment treatment = TypeDefTreatment.RedirectedToClrType,
bool isIDisposable = false)
{
this.WinRTNamespace = winRtNamespace;
this.ClrNamespace = clrNamespace;
this.ClrName = clrName;
this.AssemblyRef = clrAssembly;
this.Treatment = treatment;
this.IsIDisposable = isIDisposable;
}
示例10: NamespaceData
public NamespaceData(
StringHandle name,
string fullName,
NamespaceDefinitionHandle parent,
ImmutableArray<NamespaceDefinitionHandle> namespaceDefinitions,
ImmutableArray<TypeDefinitionHandle> typeDefinitions,
ImmutableArray<ExportedTypeHandle> exportedTypes)
{
this.Name = name;
this.FullName = fullName;
this.Parent = parent;
this.NamespaceDefinitions = namespaceDefinitions;
this.TypeDefinitions = typeDefinitions;
this.ExportedTypes = exportedTypes;
}
示例11: GetAttributeTypeNamespaceAndName
public static bool GetAttributeTypeNamespaceAndName(this MetadataReader metadataReader, EntityHandle attributeType,
out StringHandle namespaceHandle, out StringHandle nameHandle)
{
namespaceHandle = default(StringHandle);
nameHandle = default(StringHandle);
if (attributeType.Kind == HandleKind.TypeReference)
{
TypeReference typeRefRow = metadataReader.GetTypeReference((TypeReferenceHandle)attributeType);
HandleKind handleType = typeRefRow.ResolutionScope.Kind;
// Nested type?
if (handleType == HandleKind.TypeReference || handleType == HandleKind.TypeDefinition)
return false;
nameHandle = typeRefRow.Name;
namespaceHandle = typeRefRow.Namespace;
return true;
}
else if (attributeType.Kind == HandleKind.TypeDefinition)
{
var def = metadataReader.GetTypeDefinition((TypeDefinitionHandle)attributeType);
// Nested type?
if (IsNested(def.Attributes))
return false;
nameHandle = def.Name;
namespaceHandle = def.Namespace;
return true;
}
else
{
// unsupported metadata
return false;
}
}
示例12: CreateRuntimeAssemblyNameFromMetadata
private static RuntimeAssemblyName CreateRuntimeAssemblyNameFromMetadata(
MetadataReader reader,
StringHandle name,
Version version,
StringHandle culture,
BlobHandle publicKeyOrToken,
AssemblyFlags assemblyFlags)
{
AssemblyNameFlags assemblyNameFlags = AssemblyNameFlags.None;
if (0 != (assemblyFlags & AssemblyFlags.PublicKey))
assemblyNameFlags |= AssemblyNameFlags.PublicKey;
if (0 != (assemblyFlags & AssemblyFlags.Retargetable))
assemblyNameFlags |= AssemblyNameFlags.Retargetable;
int contentType = ((int)assemblyFlags) & 0x00000E00;
assemblyNameFlags |= (AssemblyNameFlags)contentType;
return new RuntimeAssemblyName(
name.GetString(reader),
version,
culture.GetString(reader),
assemblyNameFlags,
reader.GetBlobContent(publicKeyOrToken).ToArray()
);
}
示例13: AddEvent
public void AddEvent(EventAttributes attributes, StringHandle name, EntityHandle type)
{
_eventTable.Add(new EventRow
{
EventFlags = (ushort)attributes,
Name = name,
EventType = (uint)CodedIndex.ToTypeDefOrRef(type)
});
}
示例14: IsValidIdentifier
private static bool IsValidIdentifier(MetadataReader reader, StringHandle handle)
{
var name = reader.GetString(handle);
for (int i= 0; i < name.Length; i++)
{
switch (name[i])
{
case '<':
case '>':
case '$':
return false;
}
}
return true;
}
示例15: GetAttributeTypeNameRaw
private bool GetAttributeTypeNameRaw(CustomAttributeHandle caHandle, out StringHandle namespaceName, out StringHandle typeName)
{
namespaceName = typeName = default(StringHandle);
EntityHandle typeDefOrRef = GetAttributeTypeRaw(caHandle);
if (typeDefOrRef.IsNil)
{
return false;
}
if (typeDefOrRef.Kind == HandleKind.TypeReference)
{
TypeReferenceHandle typeRef = (TypeReferenceHandle)typeDefOrRef;
var resolutionScope = TypeRefTable.GetResolutionScope(typeRef);
if (!resolutionScope.IsNil && resolutionScope.Kind == HandleKind.TypeReference)
{
// we don't need to handle nested types
return false;
}
// other resolution scopes don't affect full name
typeName = TypeRefTable.GetName(typeRef);
namespaceName = TypeRefTable.GetNamespace(typeRef);
}
else if (typeDefOrRef.Kind == HandleKind.TypeDefinition)
{
TypeDefinitionHandle typeDef = (TypeDefinitionHandle)typeDefOrRef;
if (TypeDefTable.GetFlags(typeDef).IsNested())
{
// we don't need to handle nested types
return false;
}
typeName = TypeDefTable.GetName(typeDef);
namespaceName = TypeDefTable.GetNamespace(typeDef);
}
else
{
// invalid metadata
return false;
}
return true;
}