/// <summary>
        /// Creates an instance of the plugin passing it the specified host.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <returns>
        /// Created plugin instance.
        /// </returns>
        public IPlugin Create(IHawkeyeHost host)
        {
            var plugin = new ReflectorPluginCore(this);

            plugin.Initialize(host);
            return(plugin);
        }
Пример #2
0
 /// <summary>
 /// Initializes this plugin passing it the specified host.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <exception cref="System.ArgumentNullException">host</exception>
 public void Initialize(IHawkeyeHost host)
 {
     if (host == null) throw new ArgumentNullException("host");
     Host = host;
     initialized = true;
     OnInitialized();
 }
Пример #3
0
        /// <summary>
        /// Loads all the plugins (passing them the specified host)
        /// from previously discovered plugin descriptors.
        /// </summary>
        /// <param name="host">The host.</param>
        public void LoadAll(IHawkeyeHost host)
        {
            var plugins = new List <IPlugin>();

            foreach (var descriptor in PluginDescriptors)
            {
                var pluginName = "?"; // Unlikely, but descriptor.Name could throw...
                try
                {
                    pluginName = descriptor.Name;
                    log.Debug(string.Format("Loading plugin '{0}':", pluginName));
                    var instance = descriptor.Create(host);
                    if (instance == null)
                    {
                        log.Warning("--> Created plugin is null. Nothing to load.");
                    }
                    else
                    {
                        plugins.Add(instance);
                        log.Debug("--> OK");
                    }
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("--> Plugin '{0}' could not be loaded: {1}", pluginName, ex.Message), ex);
                }
            }

            Plugins = plugins.ToArray();
        }
Пример #4
0
 /// <summary>
 /// Initializes this plugin passing it the specified host.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <exception cref="System.ArgumentNullException">host</exception>
 public void Initialize(IHawkeyeHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     Host        = host;
     initialized = true;
     OnInitialized();
 }
Пример #5
0
 /// <summary>
 ///     Gets an object containing the Hawkeye settings object.
 /// </summary>
 /// <remarks>
 ///     The returned settings store is read-only.
 /// </remarks>
 /// <returns>
 ///     An <see cref="ISettingsStore" /> representing the Hawkeye
 ///     application settings.
 /// </returns>
 public static ISettingsStore GetHawkeyeSettings(this IHawkeyeHost host)
 {
     return(host.GetSettings(string.Empty));
 }
Пример #6
0
 /// <summary>
 ///     Gets a logger instance for the specified type.
 /// </summary>
 /// <typeparam name="T">The type for which to log.</typeparam>
 /// <returns>
 ///     An instance of an object implementing <see cref="ILogService" /> .
 /// </returns>
 public static ILogService GetLogger <T>(this IHawkeyeHost host)
 {
     return(host.GetLogger(typeof(T)));
 }
Пример #7
0
 /// <summary>
 ///     Gets the default logger.
 /// </summary>
 /// <returns>
 ///     An instance of an object implementing <see cref="ILogService" /> .
 /// </returns>
 public static ILogService GetLogger(this IHawkeyeHost host)
 {
     return(host.GetLogger(null));
 }
Пример #8
0
 /// <summary>
 /// Creates an instance of the plugin passing it the specified host.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <returns>
 /// Created plugin instance.
 /// </returns>
 public IPlugin Create(IHawkeyeHost host)
 {
     var plugin = new CapturePluginCore(this);
     plugin.Initialize(host);
     return plugin;
 }
Пример #9
0
 /// <summary>
 ///     Initializes this plugin passing it the specified host.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="host" />
 /// </exception>
 /// <inheritdoc />
 public void Initialize(IHawkeyeHost host)
 {
     Host          = host ?? throw new ArgumentNullException(nameof(host));
     IsInitialized = true;
     OnInitialized();
 }
Пример #10
0
        /// <summary>
        /// Loads all the plugins (passing them the specified host) 
        /// from previously discovered plugin descriptors.
        /// </summary>
        /// <param name="host">The host.</param>
        public void LoadAll(IHawkeyeHost host)
        {
            var plugins = new List<IPlugin>();

            foreach (var descriptor in PluginDescriptors)
            {
                var pluginName = "?"; // Unlikely, but descriptor.Name could throw...
                try
                {
                    pluginName = descriptor.Name;
                    log.Debug(string.Format("Loading plugin '{0}':", pluginName));
                    var instance = descriptor.Create(host);
                    if (instance == null)
                        log.Warning("--> Created plugin is null. Nothing to load.");
                    else
                    {
                        plugins.Add(instance);
                        log.Debug("--> OK");
                    }
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("--> Plugin '{0}' could not be loaded: {1}", pluginName, ex.Message), ex);
                }
            }

            Plugins = plugins.ToArray();
        }