A registry of all plugins being managed by the plugin manager.
		/// <summary>
		/// Initializes the singleton intances of the mod manager.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		/// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
		/// of managed <see cref="Plugin"/>s.</param>
		/// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the
		/// current game mode.</param>
		/// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the
		/// current game mode.</param>
		/// <param name="p_povOrderValidator">The object that validates plugin order.</param>
		/// <exception cref="InvalidOperationException">Thrown if the plugin manager has already
		/// been initialized.</exception>
		public static IPluginManager Initialize(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator)
		{
			if (m_pmgCurrent != null)
				throw new InvalidOperationException("The Plugin Manager has already been initialized.");
			m_pmgCurrent = new PluginManager(p_gmdGameMode, p_mprManagedPluginRegistry, p_aplPluginLog, p_polOrderLog, p_povOrderValidator);
			return m_pmgCurrent;
		}
 /// <summary>
 /// Initializes the singleton intances of the mod manager.
 /// </summary>
 /// <param name="p_gmdGameMode">The current game mode.</param>
 /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
 /// of managed <see cref="Plugin"/>s.</param>
 /// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the
 /// current game mode.</param>
 /// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the
 /// current game mode.</param>
 /// <param name="p_povOrderValidator">The object that validates plugin order.</param>
 /// <exception cref="InvalidOperationException">Thrown if the plugin manager has already
 /// been initialized.</exception>
 public static IPluginManager Initialize(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator)
 {
     if (m_pmgCurrent != null)
     {
         throw new InvalidOperationException("The Plugin Manager has already been initialized.");
     }
     m_pmgCurrent = new PluginManager(p_gmdGameMode, p_mprManagedPluginRegistry, p_aplPluginLog, p_polOrderLog, p_povOrderValidator);
     return(m_pmgCurrent);
 }
		/// <summary>
		/// Searches for plugins in the specified path, and loads
		/// any plugins that are found into a registry.
		/// </summary>
		/// <param name="p_pftFactory">The factory to use to create <see cref="Plugin"/>s.</param>
		/// <param name="p_pdvDiscoverer">The discoverer to use to search for plugins.</param>
		/// <returns>A registry containing all of the discovered plugin formats.</returns>
		public static PluginRegistry DiscoverManagedPlugins(IPluginFactory p_pftFactory, IPluginDiscoverer p_pdvDiscoverer)
		{
			Trace.TraceInformation("Discovering Managed Plugins...");
			Trace.Indent();

			PluginRegistry pgrRegistry = new PluginRegistry(p_pftFactory);
            if (p_pdvDiscoverer != null)
			    foreach (string strPlugin in p_pdvDiscoverer.FindPlugins())
			    {
				    Trace.TraceInformation("Found: {0}", strPlugin);
				    if (pgrRegistry.RegisterPlugin(strPlugin))
				    {
					    Trace.Indent();
					    Trace.TraceInformation("Registered.");
					    Trace.Unindent();
				    }
			    }
			Trace.Unindent();
			return pgrRegistry;
		}
        /// <summary>
        /// A simple constructor that initializes the object with its dependencies.
        /// </summary>
        /// <param name="p_gmdGameMode">The current game mode.</param>
        /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
        /// of managed <see cref="Plugin"/>s.</param>
        /// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the
        /// current game mode.</param>
        /// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the
        /// current game mode.</param>
        /// <param name="p_povOrderValidator">The object that validates plugin order.</param>
        private PluginManager(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator)
        {
            GameMode = p_gmdGameMode;
            ManagedPluginRegistry = p_mprManagedPluginRegistry;
            ActivePluginLog       = p_aplPluginLog;
            PluginOrderLog        = p_polOrderLog;
            OrderValidator        = p_povOrderValidator;

            if (GameMode.OrderedCriticalPluginNames != null)
            {
                foreach (string strPlugin in GameMode.OrderedCriticalPluginNames)
                {
                    ActivePluginLog.ActivatePlugin(strPlugin);
                }
                List <Plugin> lstPlugins = new List <Plugin>(PluginOrderLog.OrderedPlugins);
                if (!OrderValidator.ValidateOrder(lstPlugins))
                {
                    OrderValidator.CorrectOrder(lstPlugins);
                    PluginOrderLog.SetPluginOrder(lstPlugins);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Searches for plugins in the specified path, and loads
        /// any plugins that are found into a registry.
        /// </summary>
        /// <param name="p_pftFactory">The factory to use to create <see cref="Plugin"/>s.</param>
        /// <param name="p_pdvDiscoverer">The discoverer to use to search for plugins.</param>
        /// <returns>A registry containing all of the discovered plugin formats.</returns>
        public static PluginRegistry DiscoverManagedPlugins(IPluginFactory p_pftFactory, IPluginDiscoverer p_pdvDiscoverer)
        {
            Trace.TraceInformation("Discovering Managed Plugins...");
            Trace.Indent();

            PluginRegistry pgrRegistry = new PluginRegistry(p_pftFactory);

            if (p_pdvDiscoverer != null)
            {
                foreach (string strPlugin in p_pdvDiscoverer.FindPlugins())
                {
                    Trace.TraceInformation("Found: {0}", strPlugin);
                    if (pgrRegistry.RegisterPlugin(strPlugin))
                    {
                        Trace.Indent();
                        Trace.TraceInformation("Registered.");
                        Trace.Unindent();
                    }
                }
            }
            Trace.Unindent();
            return(pgrRegistry);
        }
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_txTransaction">The transaction into which we are enlisting.</param>
 /// <param name="p_prgPluginRegistry">The <see cref="PluginRegistry"/> whose actions are being transacted.</param>
 public TransactionEnlistment(Transaction p_txTransaction, PluginRegistry p_prgPluginRegistry)
 {
     CurrentTransaction     = p_txTransaction;
     EnlistedPluginRegistry = p_prgPluginRegistry;
 }
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		/// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
		/// of managed <see cref="Plugin"/>s.</param>
		/// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the
		/// current game mode.</param>
		/// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the
		/// current game mode.</param>
		/// <param name="p_povOrderValidator">The object that validates plugin order.</param>
		private PluginManager(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator)
		{
			GameMode = p_gmdGameMode;
			ManagedPluginRegistry = p_mprManagedPluginRegistry;
			ActivePluginLog = p_aplPluginLog;
			PluginOrderLog = p_polOrderLog;
			OrderValidator = p_povOrderValidator;

            if (GameMode.OrderedCriticalPluginNames != null)
            {
                foreach (string strPlugin in GameMode.OrderedCriticalPluginNames)
                    ActivePluginLog.ActivatePlugin(strPlugin);
                List<Plugin> lstPlugins = new List<Plugin>(PluginOrderLog.OrderedPlugins);
                if (!OrderValidator.ValidateOrder(lstPlugins))
                {
                    OrderValidator.CorrectOrder(lstPlugins);
                    PluginOrderLog.SetPluginOrder(lstPlugins);
                }
            }		
		}
			/// <summary>
			/// A simple constructor that initializes the object with the given values.
			/// </summary>
			/// <param name="p_txTransaction">The transaction into which we are enlisting.</param>
			/// <param name="p_prgPluginRegistry">The <see cref="PluginRegistry"/> whose actions are being transacted.</param>
			public TransactionEnlistment(Transaction p_txTransaction, PluginRegistry p_prgPluginRegistry)
			{
				CurrentTransaction = p_txTransaction;
				EnlistedPluginRegistry = p_prgPluginRegistry;
			}