General.WriteLogLine("Loading plugin '"+name+"' from '"+shortfilename+"'...");
try
{
// Load assembly
asm=Assembly.LoadFile(filename);
}
catch(Exception)
{
General.ErrorLogger.Add(ErrorType.Error,"Could not load plugin \""+shortfilename+"\", the DLL file could not be read. This file is not supposed to be in the Plugins subdirectory.");
General.ErrorLogger.Add(ErrorType.Warning,"Plugin \""+shortfilename+"\" has more than one plug. The following class is used to create in instance: "+t.FullName);
// Can't load this plugin because it is meant for a newer version
General.ErrorLogger.Add(ErrorType.Error,"Could not load plugin \""+shortfilename+"\", the Plugin is made for Doom Builder 2 core revision "+plug.MinimumRevision+" and you are running revision "+thisrevision+".");
General.ErrorLogger.Add(ErrorType.Error,"Could not load plugin \""+shortfilename+"\", plugin is missing the plug. This file is not supposed to be in the Plugins subdirectory.");
thrownewInvalidProgramException();
}
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
publicvoidDispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
asm=null;
// Done
isdisposed=true;
}
}
#endregion
#region==================Methods
// This creates a stream to read a resource or returns null when not found
General.ErrorLogger.Add(ErrorType.Error,"Failed to create class instance '"+t.Name+"' from plugin '"+name+"' "+e.InnerException.GetType().Name+" at target: "+e.InnerException.Message);