Ejemplo n.º 1
0
        public static string GetPluginFolderName(IFieldDataPlugin plugin)
        {
            var folder = Path.GetDirectoryName(plugin.GetType().Assembly.Location);

            // ReSharper disable once AssignNullToNotNullAttribute
            return(new DirectoryInfo(folder)
                   .Name);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        public static string GetPluginNameAndVersion(IFieldDataPlugin plugin)
        {
            var pluginType = plugin.GetType();

            return($"{pluginType.FullName} v{GetTypeVersion(pluginType)}");
        }