1
- namespace QModManager . API
1
+ using QModManager . Checks ;
2
+
3
+ namespace QModManager . API
2
4
{
3
5
using System . Collections . Generic ;
4
6
using System . Collections . ObjectModel ;
10
12
/// Services offered to mods.
11
13
/// </summary>
12
14
/// <seealso cref="IQModServices" />
13
- public class QModServices : IQModServices
15
+ public class QModServices : IQModServices
14
16
{
15
17
private static readonly Dictionary < string , IQMod > knownMods = new Dictionary < string , IQMod > ( ) ;
16
18
17
19
internal static void LoadKnownMods ( List < QMod > loadedMods )
18
20
{
19
- foreach ( QMod mod in loadedMods )
21
+ foreach ( QMod mod in loadedMods )
20
22
knownMods . Add ( mod . Id , mod ) ;
21
23
}
22
24
@@ -39,7 +41,7 @@ private QModServices()
39
41
/// <returns></returns>
40
42
public IQMod FindModById ( string modId )
41
43
{
42
- if ( knownMods . TryGetValue ( modId , out IQMod mod ) && mod . Enable )
44
+ if ( knownMods . TryGetValue ( modId , out IQMod mod ) && mod . Enable )
43
45
{
44
46
return mod ;
45
47
}
@@ -56,7 +58,7 @@ public IQMod FindModById(string modId)
56
58
/// </returns>
57
59
public bool ModPresent ( string modId )
58
60
{
59
- if ( knownMods . TryGetValue ( modId , out IQMod mod ) )
61
+ if ( knownMods . TryGetValue ( modId , out IQMod mod ) )
60
62
{
61
63
return mod . Enable ;
62
64
}
@@ -72,9 +74,9 @@ public bool ModPresent(string modId)
72
74
/// <exception cref="System.NotImplementedException"></exception>
73
75
public IQMod FindModByAssembly ( Assembly modAssembly )
74
76
{
75
- foreach ( IQMod mod in knownMods . Values )
77
+ foreach ( IQMod mod in knownMods . Values )
76
78
{
77
- if ( mod . LoadedAssembly == modAssembly )
79
+ if ( mod . LoadedAssembly == modAssembly )
78
80
{
79
81
return mod ;
80
82
}
@@ -138,5 +140,22 @@ public void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSi
138
140
var callingMod = GetMod ( ReflectionHelper . CallingAssemblyByStackTrace ( ) ) ;
139
141
MainMenuMessages . Add ( msg , callingMod ? . DisplayName , size , color , autoformat ) ;
140
142
}
143
+
144
+ /// <summary>
145
+ /// Gets the currently running game.
146
+ /// </summary>
147
+ /// <value>
148
+ /// The currently running game.
149
+ /// </value>
150
+ public QModGame CurrentlyRunningGame => Patcher . CurrentlyRunningGame ;
151
+
152
+
153
+ /// <summary>
154
+ /// Gets a value indicating whether Nitrox is being used.
155
+ /// </summary>
156
+ /// <value>
157
+ /// <c>true</c> if Nitrox is being used; otherwise, <c>false</c>.
158
+ /// </value>
159
+ public bool NitroxRunning => NitroxCheck . IsRunning ;
141
160
}
142
161
}
0 commit comments