/// <summary>
		/// Initializes the plugin log.
		/// </summary>
		/// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
		/// of managed <see cref="Plugin"/>s.</param>
		/// <param name="p_posOrderSerializer">The object that serializes and deserializes
		/// data from an active plugin log permanent store.</param>
		/// <param name="p_povOrderValidator">The object that validates plugin order.</param>
		/// <exception cref="InvalidOperationException">Thrown if the plugin order log has already
		/// been initialized.</exception>
		public static PluginOrderLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator)
		{
			if (m_polCurrent != null)
				throw new InvalidOperationException("The Plugin Order Log has already been initialized.");
			m_polCurrent = new PluginOrderLog(p_mprManagedPluginRegistry, p_posOrderSerializer, p_povOrderValidator);
			return m_polCurrent;
		}
		/// <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;
		}
示例#3
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
 /// of managed <see cref="Plugin"/>s.</param>
 /// <param name="p_posOrderSerializer">The object that serializes and deserializes
 /// data from a plugin order log permanent store.</param>
 /// <param name="p_povOrderValidator">The object that validates plugin order.</param>
 private PluginOrderLog(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator)
 {
     ManagedPluginRegistry = p_mprManagedPluginRegistry;
     LogSerializer         = p_posOrderSerializer;
     OrderValidator        = p_povOrderValidator;
     LoadPluginOrder();
     m_rolOrderedPlugins = new ReadOnlyObservableList <Plugin>(m_oclOrderedPlugins);
 }
        /// <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 its dependencies.
		/// </summary>
		/// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
		/// of managed <see cref="Plugin"/>s.</param>
		/// <param name="p_posOrderSerializer">The object that serializes and deserializes
		/// data from a plugin order log permanent store.</param>
		/// <param name="p_povOrderValidator">The object that validates plugin order.</param>
		private PluginOrderLog(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator)
		{			
			ManagedPluginRegistry = p_mprManagedPluginRegistry;
			LogSerializer = p_posOrderSerializer;
			OrderValidator = p_povOrderValidator;
			LoadPluginOrder();
			m_rolOrderedPlugins = new ReadOnlyObservableList<Plugin>(m_oclOrderedPlugins);
		}
 /// <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>
		/// 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);
                }
            }		
		}
示例#8
0
 /// <summary>
 /// Initializes the plugin log.
 /// </summary>
 /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
 /// of managed <see cref="Plugin"/>s.</param>
 /// <param name="p_posOrderSerializer">The object that serializes and deserializes
 /// data from an active plugin log permanent store.</param>
 /// <param name="p_povOrderValidator">The object that validates plugin order.</param>
 /// <exception cref="InvalidOperationException">Thrown if the plugin order log has already
 /// been initialized.</exception>
 public static PluginOrderLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator)
 {
     if (m_polCurrent != null)
     {
         throw new InvalidOperationException("The Plugin Order Log has already been initialized.");
     }
     m_polCurrent = new PluginOrderLog(p_mprManagedPluginRegistry, p_posOrderSerializer, p_povOrderValidator);
     return(m_polCurrent);
 }