The log that tracks plugins that have been enabled.
The plugin log can only be accessed by one install task at a time, so this object is a singleton to help enforce that policy. Note, however, that the singleton nature of the log is not meant to provide global access to the object. As such, there is no static accessor to retrieve the singleton instance. Instead, the Initialize(PluginRegistry, IActivePluginLogSerializer) method returns the only instance that should be used.
Ejemplo n.º 1
0
		/// <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 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_plsSerializer">The object that serializes and deserializes
		/// data from an active plugin log permanent store.</param>
		/// <exception cref="InvalidOperationException">Thrown if the plugins log has already
		/// been initialized.</exception>
		public static ActivePluginLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer)
		{
			if (m_aplCurrent != null)
				throw new InvalidOperationException("The Active Plugin Log has already been initialized.");
			m_aplCurrent = new ActivePluginLog(p_mprManagedPluginRegistry, p_plsSerializer);
			return m_aplCurrent;
		}
Ejemplo n.º 3
0
            /// <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_aplPluginLog">The <see cref="ActivePluginLog"/> whose actions are being transacted.</param>
            public TransactionEnlistment(Transaction p_txTransaction, ActivePluginLog p_aplPluginLog)
            {
                CurrentTransaction = p_txTransaction;
                EnlistedPluginLog  = p_aplPluginLog;
                m_ostActivePlugins = new ObservableSet <Plugin>(EnlistedPluginLog.m_ostActivePlugins, PluginComparer.Filename);
                m_rolActivePlugins = new ReadOnlyObservableList <Plugin>(m_ostActivePlugins);

                EnlistedPluginLog.m_ostActivePlugins.CollectionChanged += new NotifyCollectionChangedEventHandler(MasterPlugins_CollectionChanged);
            }
			/// <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_aplPluginLog">The <see cref="ActivePluginLog"/> whose actions are being transacted.</param>
			public TransactionEnlistment(Transaction p_txTransaction, ActivePluginLog p_aplPluginLog)
			{
				CurrentTransaction = p_txTransaction;
				EnlistedPluginLog = p_aplPluginLog;
				m_ostActivePlugins = new ObservableSet<Plugin>(EnlistedPluginLog.m_ostActivePlugins, PluginComparer.Filename);
				m_rolActivePlugins = new ReadOnlyObservableList<Plugin>(m_ostActivePlugins);

				EnlistedPluginLog.m_ostActivePlugins.CollectionChanged += new NotifyCollectionChangedEventHandler(MasterPlugins_CollectionChanged);
			}
Ejemplo n.º 5
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_plsSerializer">The object that serializes and deserializes
 /// data from an active plugin log permanent store.</param>
 /// <exception cref="InvalidOperationException">Thrown if the plugins log has already
 /// been initialized.</exception>
 public static ActivePluginLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer)
 {
     if (m_aplCurrent != null)
     {
         throw new InvalidOperationException("The Active Plugin Log has already been initialized.");
     }
     m_aplCurrent = new ActivePluginLog(p_mprManagedPluginRegistry, p_plsSerializer);
     return(m_aplCurrent);
 }
Ejemplo n.º 6
0
		/// <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);
                }
            }		
		}
Ejemplo n.º 7
0
 /// <summary>
 /// This disposes of the singleton object, allowing it to be re-initialized.
 /// </summary>
 public void Release()
 {
     m_aplCurrent = null;
 }
		/// <summary>
		/// This disposes of the singleton object, allowing it to be re-initialized.
		/// </summary>
		public void Release()
		{
			m_aplCurrent = null;
		}
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		public ManageMultiplePluginsTask(List<Plugin> p_lstPlugins, ActivePluginLog p_aplLog, bool p_booEnable)
		{
			PluginList = p_lstPlugins;
			APL = p_aplLog;
			EnablePlugins = p_booEnable;
		}
Ejemplo n.º 10
0
		/// <summary>
		/// A simpell constructor that initializes the object with the given services.
		/// </summary>
		/// <param name="p_ilgModInstallLog">The install log that tracks mod install info for the current game mode.</param>
		/// <param name="p_aplActivePluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the current game mode.</param>
		/// <param name="p_polPluginOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the current game mode.</param>
		/// <param name="p_mrpModRepository">The repository we are logging in to.</param>
		/// <param name="p_mmgModManager">The mod manager to use to manage mods.</param>
		/// <param name="p_pmgPluginManager">The manager to use to manage plugins.</param>
		/// <param name="p_amtMonitor">The download monitor to use to manage the monitored activities.</param>
		/// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param>
        public ServiceManager(IInstallLog p_ilgModInstallLog, ActivePluginLog p_aplActivePluginLog, IPluginOrderLog p_polPluginOrderLog, IModRepository p_mrpModRepository, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager, DownloadMonitor p_amtMonitor, ActivateModsMonitor p_ammMonitor, UpdateManager p_umgUpdateManager)
		{
			ModInstallLog = p_ilgModInstallLog;
			ActivePluginLog = p_aplActivePluginLog;
			PluginOrderLog = p_polPluginOrderLog;
			ModRepository = p_mrpModRepository;
			ModManager = p_mmgModManager;
			PluginManager = p_pmgPluginManager;
			DownloadMonitor = p_amtMonitor;
			UpdateManager = p_umgUpdateManager;
            ActivateModsMonitor = p_ammMonitor;
		}