-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpers.cs
More file actions
35 lines (33 loc) · 1.29 KB
/
Helpers.cs
File metadata and controls
35 lines (33 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace WeatherElectric;
/// <summary>
/// Various helper methods.
/// </summary>
public static class Helpers
{
/// <summary>
/// Checks if an assembly is loaded. Case insensitive.
/// </summary>
/// <param name="assemblyName">Name of assembly to check for</param>
/// <returns>Bool</returns>
public static bool IsAssemblyLoaded(string assemblyName)
{
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly.GetName().Name?.ToLower() == assemblyName.ToLower())
return true;
}
return false;
}
/// <summary>
/// Checks if the current game matches the given name and author. Case insensitive.
/// </summary>
/// <param name="gameName">Product name of the game. Found in app.info or at the top of every MelonLoader log.</param>
/// <param name="gameAuthor">Company name of the game. Found in app.info or at the top of every MelonLoader log.</param>
/// <returns></returns>
public static bool CheckGame(string gameName, string gameAuthor)
{
var currentGame = Application.productName.ToLower();
var currentAuthor = Application.companyName.ToLower();
return currentGame == gameName.ToLower() && currentAuthor == gameAuthor.ToLower();
}
}