void IExtensionApplication.Initialize()
{
// Initialize your plug-in application here
try
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
catch { };
}
private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.ToUpper().StartsWith("BOUNCYCASTLE.CRYPTO"))
{
return System.Reflection.Assembly.LoadFile(AssemblyDirectory() + "\\BouncyCastle.Crypto.dll");
}
else if (args.Name.ToUpper().StartsWith("IONIC.ZIP"))
{
return System.Reflection.Assembly.LoadFile(AssemblyDirectory() + "\\Ionic.Zip.dll");
}
else if (args.Name.ToUpper().StartsWith("ITEXT"))
{
return System.Reflection.Assembly.LoadFile(AssemblyDirectory() + "\\itextsharp.dll");
}
return null;
}
public static string AssemblyDirectory()
{
string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return System.IO.Path.GetDirectoryName(path);
}