/// <summary> /// Sets the load order of the plugins. /// </summary> /// <remarks> /// The returned list of sorted plugins will include plugins that were not /// included in the specified order list, if plugins exist that weren't included. /// The extra plugins will be apeended to the end of the given order. /// </remarks> /// <param name="p_strPlugins">The list of plugins in the desired order.</param> public void SetLoadOrder(string[] p_strPlugins) { string[] strSortedPlugins = p_strPlugins; UInt32 uintStatus = 0; using (StringArrayManualMarshaler ammMarshaler = new StringArrayManualMarshaler("UTF8")) uintStatus = m_dlgSetLoadOrder(m_ptrBossDb, ammMarshaler.MarshalManagedToNative(StripPluginDirectory(strSortedPlugins)), Convert.ToUInt32(strSortedPlugins.Length)); HandleStatusCode(uintStatus); }
/// <summary> /// Sets the list of active plugins. /// </summary> /// <param name="p_strActivePlugins">The list of plugins to set as active.</param> public void SetActivePlugins(string[] p_strActivePlugins) { try { UInt32 uintStatus = 0; using (StringArrayManualMarshaler ammMarshaler = new StringArrayManualMarshaler("UTF8")) uintStatus = m_dlgSetActivePlugins(m_ptrBossDb, ammMarshaler.MarshalManagedToNative(StripPluginDirectory(p_strActivePlugins)), Convert.ToUInt32(p_strActivePlugins.Length)); HandleStatusCode(uintStatus); } catch { MessageBox.Show("The selected plugin has been manually removed." + Environment.NewLine + "Restart NMM or select again your game on Change Game Mode to refresh the plugin list."); } }
/// <summary> /// Marshal the given pointer to an array of plugins. /// </summary> /// <remarks> /// This adjusts the plugin paths to be in the format expected by the mod manager. /// </remarks> /// <param name="p_ptrPluginArray">The pointer to the array of plugin names to marshal.</param> /// <param name="p_uintLength">the length of the array to marshal.</param> /// <returns>The array of plugins names pointed to by the given pointer.</returns> protected string[] MarshalPluginArray(IntPtr p_ptrPluginArray, UInt32 p_uintLength) { if (p_ptrPluginArray == IntPtr.Zero) { return(null); } string[] strPlugins = null; using (StringArrayManualMarshaler ammMarshaler = new StringArrayManualMarshaler("UTF8")) strPlugins = ammMarshaler.MarshalNativeToManaged(p_ptrPluginArray, Convert.ToInt32(p_uintLength)); for (Int32 i = strPlugins.Length - 1; i >= 0; i--) { strPlugins[i] = Path.Combine(GameMode.PluginDirectory, strPlugins[i]); } return(strPlugins); }
/// <summary> /// Marshal the given pointer to an array of plugins. /// </summary> /// <remarks> /// This adjusts the plugin paths to be in the format expected by the mod manager. /// </remarks> /// <param name="p_ptrPluginArray">The pointer to the array of plugin names to marshal.</param> /// <param name="p_uintLength">the length of the array to marshal.</param> /// <returns>The array of plugins names pointed to by the given pointer.</returns> protected string[] MarshalPluginArray(IntPtr p_ptrPluginArray, UInt32 p_uintLength) { if (p_ptrPluginArray == IntPtr.Zero) return null; string[] strPlugins = null; using (StringArrayManualMarshaler ammMarshaler = new StringArrayManualMarshaler("UTF8")) strPlugins = ammMarshaler.MarshalNativeToManaged(p_ptrPluginArray, Convert.ToInt32(p_uintLength)); for (Int32 i = strPlugins.Length - 1; i >= 0; i--) strPlugins[i] = Path.Combine(GameMode.PluginDirectory, strPlugins[i]); return strPlugins; }