public static void HandleError(Exception ex, Plugin plugin)
 {
   WindowHelper.HandleError(
     "The '{0}' plugin failed with exception while initialization. {1}"
       .FormatWith(plugin.PluginFolder, ex.InnerException != null ? ex.InnerException.Message : string.Empty), 
     true, ex);
 }
    private static void ExecuteInitProcessors(Plugin plugin)
    {
      using (new ProfileSection("Execute <init> processors for plugins"))
      {
        ProfileSection.Argument("plugin", plugin);

        try
        {
          var xml = plugin.PluginXmlDocument;
          const string xpath = "/plugin/init/processor";

          foreach (XmlElement processorNode in xml.SelectElements(xpath))
          {
            ExecuteInitProcessor(processorNode);
          }

          ProfileSection.Result("Done");
        }
        catch (Exception ex)
        {
          HandleError(ex, plugin);

          ProfileSection.Result("Failed");
        }
      }
    }
    private static void LoadEnabledPlugin(Plugin plugin)
    {
      using (new ProfileSection("Loading enabled plugin"))
      {
        ProfileSection.Argument("plugin", plugin);

        try
        {
          plugin.Load();
          ProfileSection.Result("Loaded");
        }
        catch (Exception ex)
        {
          WindowHelper.HandleError("Error while loading {0} plugin".FormatWith(plugin.PluginFolder), true, ex);
          ProfileSection.Result("Failed");
        }
      }
    }
 public Item(Plugin path, Profile profile)
 {
   this.profile = profile;
   this.Plugin = path;
 }