本文整理汇总了C#中UTF8String类的典型用法代码示例。如果您正苦于以下问题:C# UTF8String类的具体用法?C# UTF8String怎么用?C# UTF8String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UTF8String类属于命名空间,在下文中一共展示了UTF8String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: Create
public static EventDefOptions Create(UTF8String name, ITypeDefOrRef eventType) {
return new EventDefOptions {
Attributes = 0,
Name = name,
EventType = eventType,
};
}
示例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;
}
示例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);
}
示例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);
}
示例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,
};
}
示例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,
};
}
示例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,
};
}
示例9: MemberRefOptions
public MemberRefOptions(MemberRef mr)
{
this.Class = mr.Class;
this.Name = mr.Name;
this.Signature = mr.Signature;
this.CustomAttributes.AddRange(mr.CustomAttributes);
}
示例10: 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);
}
示例11: 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);
}
示例12: ParamDefOptions
public ParamDefOptions(ParamDef pd) {
Name = pd.Name;
Sequence = pd.Sequence;
Attributes = pd.Attributes;
Constant = pd.Constant;
MarshalType = pd.MarshalType;
CustomAttributes.AddRange(pd.CustomAttributes);
}
示例13: 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);
}
示例14: EventDefOptions
public EventDefOptions(EventDef evt) {
Attributes = evt.Attributes;
Name = evt.Name;
EventType = evt.EventType;
AddMethod = evt.AddMethod;
InvokeMethod = evt.InvokeMethod;
RemoveMethod = evt.RemoveMethod;
OtherMethods.AddRange(evt.OtherMethods);
CustomAttributes.AddRange(evt.CustomAttributes);
}
示例15: PropertyDefOptions
public PropertyDefOptions(PropertyDef prop) {
Attributes = prop.Attributes;
Name = prop.Name;
PropertySig = prop.PropertySig;
Constant = prop.Constant;
GetMethods.AddRange(prop.GetMethods);
SetMethods.AddRange(prop.SetMethods);
OtherMethods.AddRange(prop.OtherMethods);
CustomAttributes.AddRange(prop.CustomAttributes);
}