本文整理汇总了C#中UTF8String类的典型用法代码示例。如果您正苦于以下问题:C# UTF8String类的具体用法?C# UTF8String怎么用?C# UTF8String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UTF8String类属于命名空间,在下文中一共展示了UTF8String类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SplitNameAndNamespace
public static void SplitNameAndNamespace(UTF8String utf8Name, string fullName, out UTF8String ns, out UTF8String name) {
if (fullName == null)
fullName = string.Empty;
if (!UTF8String.IsNull(utf8Name)) {
if (fullName == utf8Name.String) {
ns = UTF8String.Empty;
name = utf8Name;
return;
}
if (fullName.EndsWith("." + utf8Name.String)) {
ns = fullName.Substring(0, fullName.Length - utf8Name.String.Length - 1);
name = utf8Name;
return;
}
}
int i = fullName.LastIndexOf('.');
if (i < 0) {
ns = UTF8String.Empty;
name = fullName;
}
else {
ns = fullName.Substring(0, i);
name = fullName.Substring(i + 1);
}
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:28,代码来源:Utils.cs
示例2: Create
public static EventDefOptions Create(UTF8String name, ITypeDefOrRef eventType) {
return new EventDefOptions {
Attributes = 0,
Name = name,
EventType = eventType,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:EventDefOptions.cs
示例3: InitializeName
void InitializeName(UTF8String utf8Name, string fullName)
{
UTF8String ns, name;
Utils.SplitNameAndNamespace(utf8Name, fullName, out ns, out name);
this.Namespace = ns;
this.Name = name;
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:7,代码来源:CorTypeRef.cs
示例4: CreateFromXml
/// <summary>
/// Creates a <see cref="SecurityAttribute"/> from an XML string.
/// </summary>
/// <param name="module">Owner module</param>
/// <param name="xml">XML</param>
/// <returns>A new <see cref="SecurityAttribute"/> instance</returns>
public static SecurityAttribute CreateFromXml(ModuleDef module, string xml) {
var attrType = module.CorLibTypes.GetTypeRef("System.Security.Permissions", "PermissionSetAttribute");
var utf8Xml = new UTF8String(xml);
var namedArg = new CANamedArgument(false, module.CorLibTypes.String, "XML", new CAArgument(module.CorLibTypes.String, utf8Xml));
var list = ThreadSafeListCreator.Create<CANamedArgument>(namedArg);
return new SecurityAttribute(attrType, list);
}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:13,代码来源:SecurityAttribute.cs
示例5: Write
public static void Write(this BinaryWriter writer, IWriterError helper, UTF8String s) {
if (UTF8String.IsNull(s)) {
helper.Error("UTF8String is null");
s = UTF8String.Empty;
}
writer.WriteCompressedUInt32(helper, (uint)s.DataLength);
writer.Write(s.Data);
}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:9,代码来源:WriterUtils.cs
示例6: Create
public static MethodDefOptions Create(UTF8String name, MethodSig methodSig) {
return new MethodDefOptions {
ImplAttributes = MethodImplAttributes.IL | MethodImplAttributes.Managed,
Attributes = MethodAttributes.Public | MethodAttributes.ReuseSlot | MethodAttributes.HideBySig | (methodSig.HasThis ? 0 : MethodAttributes.Static),
Name = name,
MethodSig = methodSig,
ImplMap = null,
};
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:MethodDefOptions.cs
示例7: Create
public static PropertyDefOptions Create(ModuleDef module, UTF8String name, bool isInstance) {
return new PropertyDefOptions {
Attributes = 0,
Name = name,
PropertySig = isInstance ?
PropertySig.CreateInstance(module.CorLibTypes.Int32) :
PropertySig.CreateStatic(module.CorLibTypes.Int32),
Constant = null,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:PropertyDefOptions.cs
示例8: Create
public static TypeDefOptions Create(UTF8String ns, UTF8String name, ITypeDefOrRef baseType, bool isNestedType) {
return new TypeDefOptions {
Attributes = (isNestedType ? TypeAttributes.NestedPublic : TypeAttributes.Public) | TypeAttributes.AutoLayout | TypeAttributes.Class | TypeAttributes.AnsiClass,
Namespace = ns ?? UTF8String.Empty,
Name = name ?? UTF8String.Empty,
PackingSize = null,
ClassSize = null,
BaseType = baseType,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:TypeDefOptions.cs
示例9: InitializeName
internal static void InitializeName(string fullname, out UTF8String @namespace, out UTF8String name) {
string s = fullname ?? string.Empty;
int index = s.LastIndexOf('.');
if (index < 0) {
@namespace = UTF8String.Empty;
name = s;
}
else {
@namespace = s.Substring(0, index);
name = s.Substring(index + 1);
}
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:12,代码来源:DndbgSignatureReader.cs
示例10: Create
public static FieldDefOptions Create(UTF8String name, FieldSig fieldSig) {
return new FieldDefOptions {
Attributes = FieldAttributes.Public,
Name = name,
FieldSig = fieldSig,
FieldOffset = null,
MarshalType = null,
RVA = 0,
InitialValue = null,
ImplMap = null,
Constant = null,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:FieldDefOptions.cs
示例11: Add
/// <summary>
/// Adds a string to the #Strings heap
/// </summary>
/// <param name="s">The string</param>
/// <returns>The offset of the string in the #Strings heap</returns>
public uint Add(UTF8String s)
{
if (isReadOnly)
throw new ModuleWriterException("Trying to modify #Strings when it's read-only");
if (UTF8String.IsNullOrEmpty(s))
return 0;
uint offset;
if (cachedDict.TryGetValue(s, out offset))
return offset;
return AddToCache(s);
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:18,代码来源:StringsHeap.cs
示例12: Compare
static bool Compare(ITypeDefOrRef type, UTF8String expNs, UTF8String expName) {
if (type == null)
return false;
var tr = type as TypeRef;
if (tr != null)
return tr.Namespace == expNs && tr.Name == expName;
var td = type as TypeDef;
if (td != null)
return td.Namespace == expNs && td.Name == expName;
return false;
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:AssemblyInfoTransform.cs
示例13: Populate
void Populate(IImageStream reader) {
reader.Position = 1;
while (reader.Position < reader.Length) {
uint offset = (uint)reader.Position;
var bytes = reader.ReadBytesUntilByte(0);
if (bytes == null)
break;
reader.ReadByte(); // terminating zero
if (bytes.Length == 0)
continue;
var s = new UTF8String(bytes);
if (!cachedDict.ContainsKey(s))
cachedDict[s] = offset;
}
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:17,代码来源:StringsHeap.cs
示例14: ResourceOptions
public ResourceOptions(Resource resource) {
this.ResourceType = resource.ResourceType;
this.Name = resource.Name ?? UTF8String.Empty;
this.Attributes = resource.Attributes;
switch (resource.ResourceType) {
case ResourceType.Embedded:
break;
case ResourceType.AssemblyLinked:
this.Assembly = ((AssemblyLinkedResource)resource).Assembly;
break;
case ResourceType.Linked:
this.File = ((LinkedResource)resource).File;
break;
default:
throw new InvalidOperationException();
}
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:20,代码来源:ResourceOptions.cs
示例15: Find
public static CustomAttribute Find(this IHasCustomAttribute provider, UTF8String ns, UTF8String name) {
if (provider == null || provider.CustomAttributes.Count == 0)
return null;
foreach (var ca in provider.CustomAttributes) {
var tr = ca.AttributeType as TypeRef;
if (tr != null) {
if (tr.Namespace == ns && tr.Name == name)
return ca;
continue;
}
var td = ca.AttributeType as TypeDef;
if (td != null) {
if (td.Namespace == ns && td.Name == name)
return ca;
continue;
}
}
return null;
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:20,代码来源:Extensions.cs
示例16: MemberRefOptions
public MemberRefOptions(MemberRef mr)
{
this.Class = mr.Class;
this.Name = mr.Name;
this.Signature = mr.Signature;
this.CustomAttributes.AddRange(mr.CustomAttributes);
}
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:7,代码来源:MemberRefOptions.cs
示例17: GenericParamOptions
public GenericParamOptions(GenericParam gp) {
this.Number = gp.Number;
this.Flags = gp.Flags;
this.Name = gp.Name;
this.Kind = gp.Kind;
this.GenericParamConstraints.AddRange(gp.GenericParamConstraints);
this.CustomAttributes.AddRange(gp.CustomAttributes);
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:GenericParamOptions.cs
示例18: GenericParamOptions
public GenericParamOptions(GenericParam gp) {
Number = gp.Number;
Flags = gp.Flags;
Name = gp.Name;
Kind = gp.Kind;
GenericParamConstraints.AddRange(gp.GenericParamConstraints);
CustomAttributes.AddRange(gp.CustomAttributes);
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:GenericParamOptions.cs
示例19: ParamDefOptions
public ParamDefOptions(ParamDef pd) {
Name = pd.Name;
Sequence = pd.Sequence;
Attributes = pd.Attributes;
Constant = pd.Constant;
MarshalType = pd.MarshalType;
CustomAttributes.AddRange(pd.CustomAttributes);
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:ParamDefOptions.cs
示例20: PropertyDefOptions
public PropertyDefOptions(PropertyDef prop) {
this.Attributes = prop.Attributes;
this.Name = prop.Name;
this.PropertySig = prop.PropertySig;
this.Constant = prop.Constant;
this.GetMethods.AddRange(prop.GetMethods);
this.SetMethods.AddRange(prop.SetMethods);
this.OtherMethods.AddRange(prop.OtherMethods);
this.CustomAttributes.AddRange(prop.CustomAttributes);
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:PropertyDefOptions.cs
注:本文中的UTF8String类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论