本文整理汇总了C#中Mono.ILASM.CodeGen类的典型用法代码示例。如果您正苦于以下问题:C# CodeGen类的具体用法?C# CodeGen怎么用?C# CodeGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeGen类属于Mono.ILASM命名空间,在下文中一共展示了CodeGen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
owner.Resolve (code_gen);
TypeDef owner_def = code_gen.TypeManager[owner.FullName];
if (owner_def == null)
Report.Error ("Reference to undefined class '" + owner.FullName + "'");
if ((call_conv & PEAPI.CallConv.Vararg) == 0) {
peapi_method = owner_def.ResolveMethod (ret_type, call_conv, name,
param, gen_param_count, code_gen);
} else {
ArrayList opt_list = new ArrayList ();
bool in_opt = false;
foreach (BaseTypeRef type in param) {
if (type is SentinelTypeRef) {
in_opt = true;
} else if (in_opt) {
type.Resolve (code_gen);
opt_list.Add (type.PeapiType);
}
}
peapi_method = owner_def.ResolveVarargMethod (
ret_type, call_conv, name, param, gen_param_count,
(PEAPI.Type[]) opt_list.ToArray (typeof (PEAPI.Type)),
code_gen);
}
is_resolved = true;
}
示例2: Resolve
public PEAPI.Permission Resolve (CodeGen code_gen)
{
string fname;
type_ref.Resolve (code_gen);
if (type_ref is ExternTypeRef) {
ExternAssembly ea = ((ExternTypeRef) type_ref).ExternRef as ExternAssembly;
if (ea == null)
//FIXME: module.. ?
throw new NotImplementedException ();
string name;
ExternTypeRef etr = type_ref as ExternTypeRef;
if (etr != null)
name = etr.Name;
else
name = type_ref.FullName;
fname = String.Format ("{0}, {1}", name, ea.AssemblyName.FullName);
} else {
fname = type_ref.FullName;
}
perm = new PEAPI.Permission (type_ref.PeapiType, fname);
foreach (PermissionMember member in members)
perm.AddMember (member.Resolve (code_gen));
return perm;
}
示例3: Define
public void Define (CodeGen code_gen, PEAPI.ClassDef classdef)
{
if (!is_resolved)
Resolve (code_gen, classdef);
if (addon != null) {
addon.Resolve (code_gen);
event_def.AddAddon (AsMethodDef (addon.PeapiMethod, "addon"));
}
if (fire != null) {
fire.Resolve (code_gen);
event_def.AddFire (AsMethodDef (fire.PeapiMethod, "fire"));
}
if (other_list != null) {
foreach (MethodRef otherm in other_list) {
otherm.Resolve (code_gen);
event_def.AddOther (AsMethodDef (otherm.PeapiMethod, "other"));
}
}
if (removeon != null) {
removeon.Resolve (code_gen);
event_def.AddRemoveOn (AsMethodDef (removeon.PeapiMethod, "removeon"));
}
}
示例4: AddTo
public void AddTo (CodeGen code_gen, PEAPI.MetaDataElement elem)
{
System.Text.UnicodeEncoding ue = new System.Text.UnicodeEncoding ();
foreach (DictionaryEntry entry in permissionset_table) {
PEAPI.SecurityAction sec_action = (PEAPI.SecurityAction) entry.Key;
SSPermissionSet ps = (SSPermissionSet) entry.Value;
code_gen.PEFile.AddDeclSecurity (sec_action,
ue.GetBytes (ps.ToXml ().ToString ()),
elem);
}
if (permissionset20_table == null)
return;
foreach (DictionaryEntry entry in permissionset20_table) {
PEAPI.SecurityAction sec_action = (PEAPI.SecurityAction) entry.Key;
MIPermissionSet ps = (MIPermissionSet) entry.Value;
code_gen.PEFile.AddDeclSecurity (sec_action,
ps.Resolve (code_gen),
elem);
}
}
示例5: Resolve
public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
if ((call_conv & PEAPI.CallConv.Vararg) == 0) {
string sig = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, false);
peapi_method = code_gen.ResolveMethod (sig);
} else {
ArrayList opt_list = new ArrayList ();
bool in_opt = false;
foreach (BaseTypeRef type in param) {
if (type is SentinelTypeRef) {
in_opt = true;
} else if (in_opt) {
type.Resolve (code_gen);
opt_list.Add (type.PeapiType);
}
}
string sig_only_required_params = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, false);
string sig_with_optional_params = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, true);
peapi_method = code_gen.ResolveVarargMethod (sig_only_required_params, sig_with_optional_params, code_gen,
(PEAPI.Type[]) opt_list.ToArray (typeof (PEAPI.Type)));
}
peapi_method.AddCallConv (call_conv);
is_resolved = true;
}
示例6: Resolve
public PEAPI.Property Resolve (CodeGen code_gen, PEAPI.ClassDef classdef)
{
if (is_resolved)
return prop_def;
PEAPI.Type[] type_list = new PEAPI.Type[arg_list.Count];
for (int i=0; i<type_list.Length; i++) {
BaseTypeRef arg_type = (BaseTypeRef) arg_list[i];
arg_type.Resolve (code_gen);
type_list[i] = arg_type.PeapiType;
}
type.Resolve (code_gen);
prop_def = classdef.AddProperty (name, type.PeapiType, type_list);
if ((attr & FeatureAttr.Rtspecialname) != 0)
prop_def.SetRTSpecialName ();
if ((attr & FeatureAttr.Specialname) != 0)
prop_def.SetSpecialName ();
prop_def.SetInstance ((attr & FeatureAttr.Instance) != 0);
if (customattr_list != null)
foreach (CustomAttr customattr in customattr_list)
customattr.AddTo (code_gen, prop_def);
is_resolved = true;
return prop_def;
}
示例7: Resolve
public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
PEAPI.Type[] param_list = new PEAPI.Type[param.Length];
string write_name;
ret_type.Resolve (code_gen);
int count = 0;
foreach (BaseTypeRef typeref in param) {
typeref.Resolve (code_gen);
param_list[count++] = typeref.PeapiType;
}
if (name == "<init>")
write_name = ".ctor";
else
write_name = name;
owner.Resolve (code_gen);
peapi_method = code_gen.PEFile.AddMethodToTypeSpec (owner.PeapiType, write_name,
ret_type.PeapiType, param_list, gen_param_count);
peapi_method.AddCallConv (call_conv);
is_resolved = true;
}
示例8: Resolve
public PEAPI.PermissionMember Resolve (CodeGen code_gen)
{
type_ref.Resolve (code_gen);
member = new PEAPI.PermissionMember (member_type, type_ref.PeapiType, name, value);
return member;
}
示例9: Resolve
public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
{
PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
PEAPI.Fault fault = new PEAPI.Fault (from, to);
return fault;
}
示例10: ResolveNoTypeSpec
public override void ResolveNoTypeSpec (CodeGen code_gen)
{
if (is_resolved)
return;
type = Modify (code_gen, type);
is_resolved = true;
}
示例11: Resolve
public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
{
PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
PEAPI.Finally phinally = new PEAPI.Finally (from, to);
return phinally;
}
示例12: Resolve
public PEAPI.PermissionSet Resolve (CodeGen code_gen)
{
ps = new PEAPI.PermissionSet (sec_action);
foreach (Permission perm in permissions)
ps.AddPermission (perm.Resolve (code_gen));
return ps;
}
示例13: Emit
public override void Emit (CodeGen code_gen, MethodDef meth,
PEAPI.CILInstructions cil)
{
if (operand != null)
cil.ldstr (operand);
else
cil.ldstr (b_operand);
}
示例14: Resolve
public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
{
PEAPI.CILLabel label = this_block.GetFromLabel (code_gen, method);
PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
PEAPI.Filter filter = new PEAPI.Filter (label, from, to);
return filter;
}
示例15: Resolve
public void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
peapi_field = code_gen.ResolveField (name, ret_type.FullName);
is_resolved = true;
}