本文整理汇总了C#中PEAPI.Class类的典型用法代码示例。如果您正苦于以下问题:C# Class类的具体用法?C# Class怎么用?C# Class使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Class类属于PEAPI命名空间,在下文中一共展示了Class类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsEnum
public static bool IsEnum (Class type)
{
return IsEnum (type.nameSpace, type.name);
}
示例2: AddNestedClass
/// <summary>
/// Add a nested class to this class
/// </summary>
/// <param name="attrSet">attributes for this nested class</param>
/// <param name="nsName">nested name space name</param>
/// <param name="name">nested class name</param>
/// <param name="sType">super type of this nested class</param>
/// <returns>a descriptor for this new nested class</returns>
public ClassDef AddNestedClass(TypeAttr attrSet, string nsName,
string name, Class sType) {
ClassDef nClass = AddNestedClass (attrSet, nsName, name);
nClass.SetSuper(sType);
if (ClassDef.IsValueType (sType))
nClass.MakeValueClass (ValueClass.ValueType);
else
if (ClassDef.IsEnum (sType))
nClass.MakeValueClass (ValueClass.Enum);
if (ClassDef.IsValueType (sType) || ClassDef.IsEnum (sType))
nClass.SetTypeIndex (PrimitiveType.ValueType.GetTypeIndex ());
nClass.typeIndexChecked = true;
return (nClass);
}
示例3: AddImplementedInterface
/// <summary>
/// Add an interface that is implemented by this class
/// </summary>
/// <param name="iFace">the interface that is implemented</param>
public void AddImplementedInterface(Class iFace)
{
metaData.AddToTable(MDTable.InterfaceImpl,new InterfaceImpl(this,iFace));
}
示例4: IsValueType
public static bool IsValueType (Class type)
{
return IsValueType (type.nameSpace, type.name);
}
示例5: ClassDef
internal ClassDef(TypeAttr attrSet, string nsName, string name,
MetaData md) : base(nsName, name, md) {
metaData = md;
superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
flags = (uint)attrSet;
tabIx = MDTable.TypeDef;
}
示例6: ClassDef
internal ClassDef(TypeAttr attrSet, string nsName, string name,
MetaData md) : base(nsName, name, md)
{
metaData = md;
if (! ((nsName == "" && name == "<Module>") || (nsName == "System" && name == "Object")) ) {
superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
}
flags = (uint)attrSet;
tabIx = MDTable.TypeDef;
}
示例7: CustomModifiedType
/// <summary>
/// Create a new custom modifier for a type
/// </summary>
/// <param name="type">the type to be modified</param>
/// <param name="cmod">the modifier</param>
/// <param name="cmodType">the type reference to be associated with the type</param>
public CustomModifiedType(Type type, CustomModifier cmod, Class cmodType)
: base((byte)cmod)
{
this.type = type;
this.cmodType = cmodType;
}
示例8: EndCatchBlock
/// <summary>
/// Mark this position as the end of the last started block and
/// make it a catch block. This catch block is associated with the
/// specified try block.
/// </summary>
/// <param name="exceptType">the exception type to be caught</param>
/// <param name="tryBlock">the try block associated with this catch block</param>
public void EndCatchBlock(Class exceptType, TryBlock tryBlock)
{
Catch catchBlock = new Catch(exceptType,(CILLabel)blockStack[0],
NewCodedLabel());
tryBlock.AddHandler(catchBlock);
}
示例9: InterfaceImpl
internal InterfaceImpl(ClassDef theClass, Class theInterface)
{
this.theClass = theClass;
this.theInterface = theInterface;
tabIx = MDTable.InterfaceImpl;
}
示例10: Catch
/// <summary>
/// Create a new catch clause
/// </summary>
/// <param name="except">the exception to be caught</param>
/// <param name="handlerStart">start of the handler code</param>
/// <param name="handlerEnd">end of the handler code</param>
public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd)
: base(handlerStart, handlerEnd)
{
exceptType = except;
}
示例11: AddClass
/// <summary>
/// Add a class to this module
/// </summary>
/// <param name="attrSet">attributes of this class</param>
/// <param name="nsName">name space name</param>
/// <param name="name">class name</param>
/// <param name="superType">super type of this class (extends)</param>
/// <returns>a descriptor for this new class</returns>
public ClassDef AddClass(TypeAttr attrSet, string nsName, string name, Class superType) {
ClassDef aClass = new ClassDef(attrSet,nsName,name,metaData);
aClass.SetSuper(superType);
metaData.AddToTable(MDTable.TypeDef,aClass);
return aClass;
}
示例12: SetSuper
internal void SetSuper(Class sClass) {
superType = sClass;
if (sClass is ClassRef)
typeIndex = superType.GetTypeIndex();
else
typeIndexChecked = false;
}
示例13: BuildTables
internal sealed override void BuildTables(MetaData md)
{
if (done) return;
if ((flags & (uint)TypeAttr.Interface) != 0) { superType = null; }
// Console.WriteLine("Building tables for " + name);
if (layout != null) md.AddToTable(MDTable.ClassLayout,layout);
// Console.WriteLine("adding methods " + methods.Count);
methodIx = md.TableIndex(MDTable.Method);
for (int i=0; i < methods.Count; i++) {
md.AddToTable(MDTable.Method,(MetaDataElement)methods[i]);
((MethodDef)methods[i]).BuildTables(md);
}
// Console.WriteLine("adding fields");
fieldIx = md.TableIndex(MDTable.Field);
for (int i=0; i < fields.Count; i++) {
md.AddToTable(MDTable.Field,(MetaDataElement)fields[i]);
((FieldDef)fields[i]).BuildTables(md);
}
// Console.WriteLine("adding events and properties");
if (events != null) {
for (int i=0; i < events.Count; i++) {
md.AddToTable(MDTable.Event,(Event)events[i]);
((Event)events[i]).BuildTables(md);
}
md.AddToTable(MDTable.EventMap,
new MapElem(this,((Event)events[0]).Row,MDTable.Event));
}
if (properties != null) {
for (int i=0; i < properties.Count; i++) {
md.AddToTable(MDTable.Property,(Property)properties[i]);
((Property)properties[i]).BuildTables(md);
}
md.AddToTable(MDTable.PropertyMap,new MapElem(this,
((Property)properties[0]).Row,MDTable.Property));
}
// Console.WriteLine("End of building tables");
done = true;
}
示例14: SetSuper
internal void SetSuper(Class sClass)
{
superType = sClass;
if (! (sClass is GenericTypeInst))
typeIndexChecked = false;
}
示例15: ClassType
public ClassType(Class classDesc)
{
desc = classDesc;
type = PrimitiveType.ClassType;
}