Пример #1
0
 static private FieldInfo Pointer(MethodBase method)
 {
     foreach (var _instruction in method.Body())
     {
         if (_instruction.Code == OpCodes.Ldsfld)
         {
             var _field = _instruction.Value as FieldInfo;
             if (_field.Name == "<Pointer>")
             {
                 return(_field);
             }
         }
     }
     throw new NotSupportedException(string.Format($"type '{ method.DeclaringType.AssemblyQualifiedName }' is not managed by CNeptune and cannot be supervised."));
 }
Пример #2
0
 static private FieldInfo Authentic(MethodBase method)
 {
     foreach (var _instruction in method.Body())
     {
         if (_instruction.Code == OpCodes.Ldsfld)
         {
             var _field = _instruction.Value as FieldInfo;
             if (_field.Name == "<Pointer>")
             {
                 return(_field.DeclaringType.GetField("<Authentic>", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly));
             }
         }
     }
     return(null);
 }
Пример #3
0
 static public Collection <Instruction> Body(this MethodBase method)
 {
     return(new Collection <Instruction>(method.Body(method.GetBodyAsByteArray())));
 }