public static string GetPluginFolderName(IFieldDataPlugin plugin) { var folder = Path.GetDirectoryName(plugin.GetType().Assembly.Location); // ReSharper disable once AssignNullToNotNullAttribute return(new DirectoryInfo(folder) .Name); }
private void ResolveAssemblyPath() { AllowReflectionLoadsFromAssemblyFolder(); if (!string.IsNullOrEmpty(Context.AssemblyPath)) { var assembly = LoadAssembly(Context.AssemblyPath, message => Log.Error($"Can't load '{Context.AssemblyPath}': {message}")); if (assembly == null) { throw new ExpectedException($"Can't load plugin assembly."); } Plugin = FindAllPluginImplementations(assembly).Single(); return; } Plugin = GetSinglePluginOrThrow(); Context.AssemblyPath = Plugin.GetType().GetAssemblyPath(); }
public static string GetPluginNameAndVersion(IFieldDataPlugin plugin) { var pluginType = plugin.GetType(); return($"{pluginType.FullName} v{GetTypeVersion(pluginType)}"); }