Created
September 8, 2011 18:37
-
-
Save qpfiffer/1204229 to your computer and use it in GitHub Desktop.
Fun times with C# Reflection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Reflection; | |
namespace DLL_Pirate | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Assembly toPirate; | |
if (System.IO.File.Exists("AVEInternals.dll")) | |
{ | |
toPirate = Assembly.LoadFrom("AVEInternals.dll"); | |
} | |
else | |
{ | |
Console.WriteLine("ARG, YE FILE DONT EXIST!"); | |
Console.ReadLine(); | |
return; | |
} | |
Type[] typeArray = null; | |
try | |
{ | |
typeArray = toPirate.GetTypes(); | |
} | |
catch (ReflectionTypeLoadException ex) | |
{ | |
Console.WriteLine("EXCEPTION, YAR! HERE IT BE: " + ex.Message); | |
foreach (Exception exception in ex.LoaderExceptions) | |
{ | |
Console.WriteLine("THESE SWINE-LOVIN' LOADER EXCEPTIONS: " + exception); | |
} | |
Console.ReadLine(); | |
} | |
if (typeArray != null) | |
{ | |
Console.WriteLine("BLLEALSLFLSLAFSDLRARAGAGAGAGGEGE!"); | |
foreach (Type type in typeArray) | |
{ | |
Console.WriteLine(type); | |
} | |
//ConstructorInfo[] cStructs = toPirate.GetType("AVE.Downloader").GetConstructors(); | |
//foreach (ConstructorInfo cStructor in cStructs) | |
//{ | |
// Console.WriteLine(cStructor); | |
//} | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment