// Loads a setup from a dll file thats implements the ISetup interface private void InitializeConfiguration() { try { ISetup setup = InterfaceLoader.Get <ISetup>(); if (setup is null) { throw new Exception("Could not find external configuration"); } setup.Initialize(Configuration); } catch { Configuration = new Configuration(); } }
// Check wether a .dll file implementing IDoBadStuff is available // if its available, it replaces the default bad stuff object private void InitializeBadStuff() { try { DoBadStuff = InterfaceLoader.Get <IDoBadStuff>(true); if (DoBadStuff is null) { DoBadStuff = new DefaultBadStuff(); } } catch (Exception ex) { DoBadStuff = new DefaultBadStuff(); if (Configuration.DebugMode) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }