public static bool TryGet(PluginData data, out PluginInstance instance) { instance = null; if (data.Status == PluginStatus.Error || !data.TryLoadAssembly(out Assembly a)) { return(false); } Type pluginType = a.GetTypes().FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t)); if (pluginType == null) { LogFile.WriteLine($"Failed to load {data} because it does not contain an IPlugin"); data.Error(); return(false); } instance = new PluginInstance(data, a, pluginType); return(true); }
private void ThrowError(string error) { LogFile.WriteLine(error); data.Error(); Dispose(); }