Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public static ModIoConfiguration GetModIoConfigurationForCurrentGame()
        {
            var selectedGame = TCAdmin.GameHosting.SDK.Objects.Game.GetSelectedGame();
            var customModBase = CustomModBase.GetCustomModBases().FirstOrDefault(x => x.Name == "Mod.IO");
            if (customModBase == null)
            {
                throw new Exception("Mod.IO is not installed as a Custom Mod Provider");
            }

            var modIoConfiguration = customModBase.GetConfigurationForGame(selectedGame).ToObject<ModIoConfiguration>();
            if (modIoConfiguration == null)
            {
                throw new Exception("Mod.IO configuration is not set for this game.");
            }

            return modIoConfiguration;
        }