-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIconManager.cs
More file actions
36 lines (30 loc) · 1.26 KB
/
IconManager.cs
File metadata and controls
36 lines (30 loc) · 1.26 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
36
using System.Linq;
using TCAdminCustomMods.Configurations;
using TCAdminCustomMods.Providers;
namespace TCAdminCustomMods
{
public class IconManager : TCAdmin.Interfaces.Web.IconManager
{
public bool CanDisplayIcon(string moduleId, int pageId, int iconId)
{
var game = TCAdmin.GameHosting.SDK.Objects.Game.GetSelectedGame();
var generalConfig = GeneralConfiguration.GetConfigurationForGame(game);
var providerid = iconId - 4890;
if (generalConfig.SingleIcon)
{
return providerid ==1 && CustomModBase.GetCustomModBases()
.Select(customModBase =>
customModBase.GetConfigurationForGame(game).ToObject<CustomModProviderConfiguration>())
.Any(config => config != null && config.Enabled);
}
var providers = CustomModBase.GetCustomModBases();
var provider = providers.SingleOrDefault(p => p.Id == providerid);
if (provider != null)
{
var config = provider.GetConfigurationForGame(game).ToObject<CustomModProviderConfiguration>();
return config != null && config.Enabled;
}
return false;
}
}
}