Advertisement
Guest User

Proxy.cs

a guest
Jun 22nd, 2014
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. class Proxy : MarshalByRefObject {
  2.     Assembly assembly;
  3.     MethodInfo meth;
  4.     void LoadIfNeeded( ) {
  5.         if( meth == null ) {
  6.             assembly = Assembly.LoadFile( Directory.GetCurrentDirectory( ) + "\\dll" );
  7.             meth = assembly.GetType( "PP3" ).GetMethod( "Run" );
  8.             Activator.CreateInstance( typeof( Proxy ) );
  9.         }
  10.     }
  11.     public byte[] GetILCode( ) {
  12.         LoadIfNeeded( );
  13.         return meth.GetMethodBody( ).GetILAsByteArray( );
  14.     }
  15.     public int GetMaxStackSize( ) {
  16.         LoadIfNeeded( );
  17.         return meth.GetMethodBody( ).MaxStackSize;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement