Example #1
0
        public GuessingGameService(IChatbotContextFactory contextFactory,
                                   TwitchClient client, TwitchAPI api, IConfigService configService,
                                   ILogger <IGuessingGameService> logger)
        {
            this.contextFactory = contextFactory;
            this.Client         = client;
            this.Api            = api;
            _configService      = configService;
            _logger             = logger;

            _streamerChannel        = _configService.Get <string>("StreamerChannel");
            _secondsForGuessingGame = configService.Get <int>("SecondsForGuessingGame");

            if (_configService.Get <bool>("DevelopmentBuild"))
            {
                Api.V5.Chat.GetChatRoomsByChannelAsync(_configService.Get <string>("ChannelId"), _configService.Get <string>("ChatbotAccessToken"))
                .ContinueWith(
                    rooms =>
                {
                    if (!rooms.IsCompletedSuccessfully)
                    {
                        return;
                    }
                    DevelopmentRoomId = rooms.Result.Rooms.SingleOrDefault(r => r.Name == "dev")?.Id;
                });
            }
        }
Example #2
0
        public Message Create(VehicleQueryResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var emailAddress = _configService.Get("SENDGRID_FROM_EMAIL");

            var message = new Message
            {
                Content    = $"Number of Queries ({result.StartDate} - {result.EndDate}) = {result.NumberOfQueries}",
                Recipients = new List <EmailAddress>
                {
                    new EmailAddress
                    {
                        Address = emailAddress,
                        Name    = "MOTLookup"
                    }
                },
                From = new EmailAddress
                {
                    Address = emailAddress,
                    Name    = "MOTLookup"
                },
                Subject = _configService.Get("SUBJECT")
            };

            return(message);
        }
Example #3
0
 public void Process(TwitchClient client, string username, string commandText, bool isMod, JoinedChannel joinedChannel)
 {
     client.SendMessage(joinedChannel,
                        username == "Chatbot"
             ? $"Check out {_configService.Get<string>("StreamerChannel")}'s merch over at: {_configService.Get<string>("MerchLink")}"
             : $"Hey @{username}, check out {_configService.Get<string>("StreamerChannel")}'s merch over at: {_configService.Get<string>("MerchLink")}");
 }
 public void Process(TwitchClient client, string username, string commandText, bool isMod, JoinedChannel joinedChannel)
 {
     client.SendMessage(joinedChannel,
                        username == "Chatbot"
             ? $"The full playlist can be found at: {_configService.Get<string>("WebPlaylistUrl")}/stream/playlist You can now request/edit/remove requests over there too!"
             : $"Hey @{username}, the full playlist can be found at: {_configService.Get<string>("WebPlaylistUrl")}/stream/playlist You can now request/edit/remove requests over there too!");
 }
Example #5
0
        public void Update(string username)
        {
            var bitsToVip           = _configService.Get <double>("BitsToVip");
            var donationAmountToVip = _configService.Get <double>("DonationAmountToVip");

            _updateDonationVipsRepository.Update(username, bitsToVip, donationAmountToVip);
        }
Example #6
0
 public void Process(TwitchClient client, string username, string commandText, bool isMod, JoinedChannel joinedChannel)
 {
     client.SendMessage(joinedChannel,
                        username == "Chatbot"
             ? $"Check me out on insta: {_configService.Get<string>("InstagramLink")}"
             : $"Hey {username}, check me out on insta: {_configService.Get<string>("InstagramLink")}");
 }
Example #7
0
        public void Give(List <UserSubDetail> userSubDetails)
        {
            var tier2ExtraVips = _configService.Get <int>("Tier2ExtraVip");
            var tier3ExtraVips = _configService.Get <int>("Tier3ExtraVip");

            _giveSubVipsRepository.Give(userSubDetails, tier2ExtraVips, tier3ExtraVips);
        }
Example #8
0
        private async void InitialiseGameTimer(string songName, int songLengthInSeconds)
        {
            if (_configService.Get <bool>("DevelopmentBuild") && !Client.JoinedChannels.Select(jc => jc.Channel)
                .Any(jc => jc.Contains(DevelopmentRoomId)))
            {
                Client.JoinRoom(_configService.Get <string>("ChannelId"), DevelopmentRoomId);
            }

            if (songLengthInSeconds < _secondsForGuessingGame)
            {
                return;
            }

            if (!OpenGuessingGame(songName))
            {
                Client.SendMessage(string.IsNullOrEmpty(DevelopmentRoomId) ? _streamerChannel : DevelopmentRoomId, "I couldn't start the guessing game :S");
                return;
            }

            SetGuessingGameState(true);

            Client.SendMessage(string.IsNullOrEmpty(DevelopmentRoomId) ? _streamerChannel : DevelopmentRoomId,
                               $"The guessing game has begun! You have {_secondsForGuessingGame} seconds to !guess the accuracy that {_streamerChannel} will get on {songName}!");

            await Task.Delay(TimeSpan.FromSeconds(_secondsForGuessingGame));

            if (!CloseGuessingGame())
            {
                Client.SendMessage(string.IsNullOrEmpty(DevelopmentRoomId) ? _streamerChannel : DevelopmentRoomId, "I couldn't close the guessing game for some reason... SEND HALP");
            }

            Client.SendMessage(string.IsNullOrEmpty(DevelopmentRoomId) ? _streamerChannel : DevelopmentRoomId, "The guessing game has now closed. Good luck everyone!");

            SetGuessingGameState(false);
        }
Example #9
0
        private async Task UpdatePrivateKey()
        {
            try
            {
                var privateKeyPath = await _configService.Get("JWTPrivateKeyPath");

                var privateKeyPassword = await _configService.Get("JWTPassword");

                if (privateKeyPath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                {
                    using (var httpClient = new HttpClient())
                    {
                        var bytes = await httpClient.GetByteArrayAsync(privateKeyPath);

                        rsaWithThumbprint = CertificateHelper.GetRsaFromPrivateKeyFile(bytes, privateKeyPassword);
                    }
                }
                else
                {
                    rsaWithThumbprint = CertificateHelper.GetRsaFromPrivateKeyFile(privateKeyPath, privateKeyPassword);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #10
0
        public async Task GuessingGameStart(string songName, int songLengthInSeconds)
        {
            var twitchClient = _twitchClientFactory.Get();

            var secondsForGuessingGame = _configService.Get <int>("SecondsForGuessingGame");
            var streamerChannelName    = _configService.Get <string>("StreamerChannel");

            if (songLengthInSeconds < secondsForGuessingGame)
            {
                return;
            }

            if (!_openGuessingGameRepository.Open(songName))
            {
                twitchClient.SendMessage(streamerChannelName, "I couldn't start the guessing game :S");
                return;
            }

            SetGuessingGameState(true);

            twitchClient.SendMessage(streamerChannelName,
                                     $"The guessing game has begun! You have {secondsForGuessingGame} seconds to !guess the accuracy that {streamerChannelName} will get on {songName}!");

            await Task.Delay(TimeSpan.FromSeconds(secondsForGuessingGame));

            if (!_closeGuessingGameRepository.Close())
            {
                twitchClient.SendMessage(streamerChannelName, "I couldn't close the guessing game for some reason... SEND HALP");
            }

            twitchClient.SendMessage(streamerChannelName, "The guessing game has now closed. Good luck everyone!");

            SetGuessingGameState(false);
        }
Example #11
0
 public SafeBlockProvider(IConfigService configService, ILogger logger)
 {
     var exceptionHandlePolicies = configService.Get<ExceptionHandlePolicy>("ExceptionHandlePolicy");
     this.logger = logger;
     this.retryCount = configService.Get<int>("ExceptionPolicy", "RetryCount");
     this.exceptionPolicies = new Dictionary<string, ExceptionPolicy>();
     this.Load(exceptionHandlePolicies);
 }
Example #12
0
        public SafeBlockProvider(IConfigService configService, ILogger logger)
        {
            var exceptionHandlePolicies = configService.Get <ExceptionHandlePolicy>("ExceptionHandlePolicy");

            this.logger            = logger;
            this.retryCount        = configService.Get <int>("ExceptionPolicy", "RetryCount");
            this.exceptionPolicies = new Dictionary <string, ExceptionPolicy>();
            this.Load(exceptionHandlePolicies);
        }
        public bool OpenPlaylistWeb()
        {
            var isPlaylistOpened = OpenPlaylist();

            _client.SendMessage(string.IsNullOrEmpty(_developmentRoomId) ? _configService.Get <string>("StreamerChannel") : _developmentRoomId,
                                isPlaylistOpened ? "The playlist is now open!" : "I couldn't open the playlist :(");

            return(true);
        }
Example #14
0
        public MongoService(IConfigService config)
        {
            var user   = config.Get("MONGO_USER") ?? "mongo";
            var pass   = config.Get("MONGO_PASS") ?? "mongo";
            var dbName = config.Get("MONGO_DB") ?? "events";

            _client = GetClient(user, pass);
            _db     = _client.GetDatabase(dbName);
        }
Example #15
0
        private void Reconnect()
        {
            var creds = new ConnectionCredentials(
                _configService.Get <string>("ChatbotNick"),
                _secretService.GetSecret <string>("ChatbotPass"));

            _client = new TwitchClient();
            _client.Initialize(creds, _configService.Get <string>("StreamerChannel"));
            _client.Connect();
        }
Example #16
0
        public string Transfer(List <CrashApply> applys, Payment payment, string notifyUrl)
        {
            //服务器异步通知页面路径
            var alipayConfig = _configService.Get <AlipayConfig>();
            var config       = new AlipayConfig2
            {
                Partner  = alipayConfig.Partner,
                SellerId = alipayConfig.SellerId,
                Md5Key   = alipayConfig.MD5Key,
                SignType = SignType.MD5
            };

            string  detailData = string.Empty;
            decimal amount     = 0;

            foreach (var apply in applys)
            {
                if (apply.ApplyState != ApplyState.ApplyPassed)
                {
                    Logger.Operation($"提现转账失败,扣除冻结金额处理失败,TransactionNo:{apply.TransactionNo},原因:提现转账申请状态不合法", PaymentProcessModule.Instance, Security.SecurityLevel.Danger);
                    continue;
                }
                detailData      += $"{apply.TransactionNo}^{apply.Account}^{apply.RealName}^{ apply.Money}^提现|";
                amount          += apply.Money;
                apply.ApplyState = ApplyState.Transfering;
                _currencyService.Update(apply);
            }
            detailData = detailData.Trim('|');

            var paras = new Dictionary <string, object>();

            paras.Add("detail_data", detailData);
            paras.Add("batch_fee", amount);
            paras.Add("batch_num", applys.Count);

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("_input_charset", "utf-8");
            sParaTemp.Add("service", "batch_trans_notify");
            sParaTemp.Add("notify_url", notifyUrl);
            sParaTemp.Add("email", config.SellerId);
            sParaTemp.Add("account_name", alipayConfig.AccountName);
            sParaTemp.Add("pay_date", DateTime.Now.ToString("yyyyMMdd"));
            sParaTemp.Add("batch_no", KeyGenerator.GetOrderNumber());
            sParaTemp.Add("batch_fee", paras["batch_fee"].ToString());
            sParaTemp.Add("batch_num", paras["batch_num"].ToString());
            sParaTemp.Add("detail_data", paras["detail_data"].ToString());

            //建立请求
            string sHtmlText = new Submit(config).BuildRequest(sParaTemp, "get", "确认");

            return(sHtmlText);
        }
Example #17
0
 private void JoinChannel()
 {
     if (_isDevelopmentBuild)
     {
         ScheduleStreamTasks(); // If we are in development we should leave chatty tasks running
     }
     else
     {
         _client.SendMessage(_streamerChannel, $"BEEP BOOP: {_configService.Get<string>("ChatbotNick")} online!");
     }
 }
Example #18
0
        public MongoService(IConfigService config)
        {
            var user   = config.Get("MONGO_USER") ?? "mongo";
            var pass   = config.Get("MONGO_PASS") ?? "mongo";
            var events = config.Get("MONGO_DB_EVENTS") ?? "events";
            var proj   = config.Get("MONGO_DB_PROJECTION") ?? "projections";

            var client = GetClient(user, pass);

            _dbEvents      = client.GetDatabase(events);
            _dbProjections = client.GetDatabase(proj);
        }
Example #19
0
        private void ReadFilter()
        {
            if (string.IsNullOrEmpty(this.ObjectName))
            {
                throw new Exception("ObjectName is empty in filter");
            }
            CriteriaOperator projectOperator   = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + ProjectConfigId, null));
            CriteriaOperator iterationOperator = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + IterationConfigId, null));
            CriteriaOperator memberOperator    = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + MemberConfigId, null));

            this.Context.SetFilter("ProjectId", projectOperator);
            Context.SetFilter("ProjectIterationId", iterationOperator);
            Context.SetFilter("MemberId", memberOperator);
        }
Example #20
0
        public PluginPanel(IConfigService configService)
        {
            _configService = configService;
            InitializeComponent();

            isEnabledCheckBox.Checked     = _configService.Get(c => c.Enabled);
            showFrequencyCheckBox.Checked = _configService.Get(c => c.ShowFrequency);
            showRdsCheckBox.Checked       = _configService.Get(c => c.ShowRds);
            discordAppIdTextBox.Text      = _configService.Get(c => c.DiscordAppId);

            showFrequencyCheckBox.Enabled = isEnabledCheckBox.Checked;
            showRdsCheckBox.Enabled       = isEnabledCheckBox.Checked;
            discordAppIdTextBox.Enabled   = isEnabledCheckBox.Checked;
        }
        public void ConfigService_SelectAll()
        {
            IConfigService          service    = this.GetService <IConfigService>();
            List <ConfigIndexModel> configList = service.Get();

            Assert.IsTrue(configList.Count > 0, "There are no records in the Config Table");
        }
        public async void Process(TwitchClient client, string username, string commandText, bool isMod, JoinedChannel joinedChannel)
        {
            try
            {
                var twitchApi = _twitchApiFactory.Get();
                var users = await twitchApi.Helix.Users.GetUsersAsync(logins: new List<string>(new[] {username}));
                var userId = users.Users[0].Id;

                if (userId == null) return;

                var follows = await twitchApi.Helix.Users.GetUsersFollowsAsync(fromId:userId, toId: _configService.Get<string>("ChannelId"));

                var followedChannel = follows?.Follows?.SingleOrDefault();
                if (followedChannel == null) return;

                var monthsFollowed = Math.Abs(12 * (followedChannel.FollowedAt.Year - DateTime.UtcNow.Year) +
                                              followedChannel.FollowedAt.Month - DateTime.UtcNow.Month);

                client.SendMessage(joinedChannel,
                    $"Hey @{username}, you have followed {_configService.Get<string>("StreamerChannel")} for {monthsFollowed} months!");
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Error in FollowageCommand");
            }
        }
Example #23
0
        public string Get(string username)
        {
            var conversionAmount = _configService.Get <int>("BytesToVip");
            var bytes            = _getUserByteCountRepository.Get(username, conversionAmount);

            return(bytes.ToString("n3"));
        }
Example #24
0
        public ElasticService(IConfigService config)
        {
            var url      = config.Get("ELASTICSEARCH_URL") ?? "http://elastic:9200";
            var settings = new ConnectionSettings(new Uri(url));

            _client = new ElasticClient(settings);
        }
        public async Task RemoveAndRefundAllRequests()
        {
            var currentRequests = _getCurrentRequestsRepository.GetCurrentRequests();

            if (currentRequests == null)
            {
                return;
            }

            var refundVips = currentRequests?.VipRequests?.Where(sr => sr.IsSuperVip || sr.IsVip).Select(sr =>
                                                                                                         new VipRefund
            {
                Username     = sr.Username,
                VipsToRefund = sr.IsSuperVip ? _configService.Get <int>("SuperVipCost") :
                               sr.IsVip ? 1 :
                               0
            }).ToList() ?? new List <VipRefund>();

            _refundVipCommand.Refund(refundVips);

            foreach (var refund in refundVips)
            {
                await _vipService.UpdateClientVips(refund.Username).ConfigureAwait(false);
            }

            _clearRequestsRepository.ClearRequests(currentRequests.RegularRequests);
            _clearRequestsRepository.ClearRequests(currentRequests.VipRequests);
        }
Example #26
0
        private async void CheckChat()
        {
            try
            {
                var streamerChannel = _configService.Get <string>("StreamerChannel");

                var streamStatus = _getStreamStatusQuery.Get(streamerChannel);

                if (streamStatus)
                {
                    var client = new HttpClient();

                    var currentChatters =
                        await client.GetAsync($"https://tmi.twitch.tv/group/user/{streamerChannel}/chatters");

                    if (currentChatters.IsSuccessStatusCode)
                    {
                        var chattersModel =
                            JsonConvert.DeserializeObject <TmiChattersIntermediate>(currentChatters.Content
                                                                                    .ReadAsStringAsync().Result);

                        _giveViewershipBytesCommand.Give(chattersModel.ChattersIntermediate);
                    }
                    else
                    {
                        _logger.LogError("Could not retrieve Chatters JSON from TMI service");
                    }
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Couldn't access the TMI Service");
            }
        }
        public void Remove(string username)
        {
            using (var context = _chatbotContextFactory.Create())
            {
                var superVip = context.SongRequests.SingleOrDefault(sr =>
                                                                    !sr.Played &&
                                                                    sr.SuperVipRequestTime != null &&
                                                                    sr.RequestUsername == username
                                                                    );

                if (superVip == null)
                {
                    return;
                }

                var user = context.Users.Find(username);

                if (user == null)
                {
                    return;
                }

                var superVipCost = _configService.Get <int>("SuperVipCost");

                user.ModGivenVipRequests += superVipCost;
                superVip.Played           = true;

                context.SaveChanges();
            }
        }
Example #28
0
        public async Task SetupPrintfulWebhook()
        {
            var currentSettings = await _printfulClient.GetWebhookConfiguration();

            // Only try to setup if webhook is not configured
            if (string.IsNullOrWhiteSpace(currentSettings?.WebhookInfo?.WebhookReturnUrl))
            {
                var request = new SetUpWebhookConfigurationRequest
                {
                    WebhookReturnUrl     = $"{_configService.Get<string>("WebsiteLink")}/MerchWebhook/Event",
                    EnabledWebhookEvents = new List <string>
                    {
                        WebhookEventType.PackageShipped.ToWebhookTypeString(),
                    WebhookEventType.PackageReturned.ToWebhookTypeString(),
                    WebhookEventType.OrderFailed.ToWebhookTypeString(),
                    WebhookEventType.OrderCancelled.ToWebhookTypeString(),
                    WebhookEventType.ProductSynced.ToWebhookTypeString(),
                    WebhookEventType.ProductUpdated.ToWebhookTypeString(),
                    WebhookEventType.OrderPutOnHold.ToWebhookTypeString(),
                    WebhookEventType.OrderRemoveHold.ToWebhookTypeString()
                    },
                    OptionalParams = new object {}
                };

                var result = await _printfulClient.SetWebhookConfiguration(request);
            }
        }
Example #29
0
        public static IDebug Create(IConfigService configService)
        {
            var traceConfiguration = configService.Get <TraceConfiguration>("Trace", "Trace");

            traceConfiguration.Fill();
            return(new Debug(traceConfiguration.GetTraceCollection(), traceConfiguration.GetDefaultTrace()));
        }
Example #30
0
        public static IInstrumentation Create(IConfigService configService)
        {
            var instrumentationConfiguration = configService.Get <InstrumentationConfiguration>("Instrumentation", "Instrumentation");

            instrumentationConfiguration.Fill();
            return(new Instrumentation(instrumentationConfiguration.GetCounterCollection(), instrumentationConfiguration.GetDefaultCounter()));
        }
        public bool RefundSuperVip(string username, bool deferSave = false)
        {
            try
            {
                using (var context = _chatbotContextFactory.Create())
                {
                    var user = context.Users.SingleOrDefault(u => u.Username == username);

                    if (user == null)
                    {
                        return(false);
                    }

                    user.ModGivenVipRequests += _configService.Get <int>("SuperVipCost");

                    if (!deferSave)
                    {
                        context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"Error when refunding Super Vip. username: {username}, deferSave: {deferSave}");
                return(false);
            }
        }
Example #32
0
 IServiceHost IServiceHostFactory.Create(IConfigService configService, IUtilityProvider utility)
 {
     var hostConfig = configService.Get<WCFSelfHostConfig>(ConfigGroup, ServiceName);
     int length = hostConfig.BaseAddresses.Length;
     Uri[] uris = new Uri[length];
     for (int init = 0; init < length; init++)
     {
         uris[init] = new Uri(hostConfig.BaseAddresses[init]);
     }
     return new WCFSelfHost(Type.GetType(hostConfig.Type), uris);
 }
Example #33
0
        internal static IPrintService Create(IConfigService configService, ILogger logger)
        {
            IPrintService printService = null;
            PrintServiceConfig printServiceConfig = configService.Get<PrintServiceConfig>("PrintManager", "ServiceConfig", null);
            if (null == printServiceConfig)
            {
                printService = new PrintServiceNull();
                logger.LogDebug("PrintService", "Print Service not configured. All request to print will throw exception");
            }
            else
            {
                printService = new PrintService(printServiceConfig, logger);
            }

            return printService;
        }
Example #34
0
        internal ThreadProviderFactory(IConfigService configService)
        {
            ThreadProvider threadProvider = configService.Get<ThreadProvider>("Threading", "Provider", ThreadProvider.ThreadPool);
            switch (threadProvider)
            {
                case ThreadProvider.ThreadPool:
                    this.provider = ThreadPoolThreadProvider.Instance;
                    break;

                case ThreadProvider.UserThread:
                    this.provider = UserThreadProvider.Instance;
                    break;

                default:
                case ThreadProvider.None:
                    throw new ArgumentOutOfRangeException("Threading.Provider", "Invalid Threading Provider configured");
            }
        }
Example #35
0
 public static IDebug Create(IConfigService configService)
 {
     var traceConfiguration = configService.Get<TraceConfiguration>("Trace", "Trace");
     traceConfiguration.Fill();
     return new Debug(traceConfiguration.GetTraceCollection(), traceConfiguration.GetDefaultTrace());
 }
        public static void Configure(IConfigService configService, IUtilityProvider _utilityProvider, IResourceService _iResourceSerive)
        {
            utilityProvider = _utilityProvider;
            iResourceService = _iResourceSerive;
            /*Call LoadCommandConfig Method to Load all the Command Configuration through ConfigService.*/
            IEnumerable<CommandConfig> commands = configService.Get<CommandConfig>("CommandTypeConfig");
            IEnumerable<CommandActionConfig> actionConfigList = configService.Get<CommandActionConfig>("CommandActionTypeConfig");

            foreach (CommandActionConfig actionConfig in actionConfigList)
            {
                ControllerCreateParams controllerConfig = new ControllerCreateParams();
                controllerConfig.Name = actionConfig.ActionKey;
                controllerConfig.AllowAnonymous = actionConfig.AllowAnonymous;
                controllerConfig.ExceptionPolicy = actionConfig.ExceptionPolicy;
                controllerConfig.TaskId = actionConfig.TaskId;
                CommandConfig cmd = commands.Where<CommandConfig>(o => o.CommandKey == actionConfig.CommandConfig).FirstOrDefault();
                if (cmd != null)
                {
                    Type commandType = Type.GetType(cmd.CommandUri);
                    controllerConfig.CommandType = commandType;


                    if (commandType != null)
                    {
                        while (commandType.Name != typeof(ProcessCommand<,>).Name && commandType.Name != typeof(ParameterizedActionCommand<>).Name && commandType.Name != typeof(RequestCommand<>).Name && commandType.Name != typeof(ExecutorCommand).Name)
                        {
                            commandType = commandType.BaseType;
                        }

                        Type[] param = commandType.GetGenericArguments();

                        if (commandType.Name == typeof(ProcessCommand<,>).Name)
                        {
                            controllerConfig.RequestViewModel = param[0];
                            controllerConfig.ReponseViewModel = param[1];
                            controllerConfig.ControllerType = typeof(Processor<,,>).MakeGenericType(
                                new Type[] { controllerConfig.CommandType, controllerConfig.RequestViewModel, controllerConfig.ReponseViewModel });
                        }
                        else if (commandType.Name == typeof(ParameterizedActionCommand<>).Name)
                        {
                            controllerConfig.RequestViewModel = param[0];
                            controllerConfig.ControllerType = typeof(ParamterizedExecutor<,>).MakeGenericType(
                                new Type[] { controllerConfig.CommandType, controllerConfig.RequestViewModel });
                        }
                        else if (commandType.Name == typeof(RequestCommand<>).Name)
                        {
                            controllerConfig.ReponseViewModel = param[0];
                            controllerConfig.ControllerType = typeof(Requestor<,>).MakeGenericType(
                                new Type[] { controllerConfig.CommandType, controllerConfig.ReponseViewModel });
                        }
                        else if (commandType.Name == typeof(ExecutorCommand).Name)
                        {
                            controllerConfig.ControllerType = typeof(Executor<>).MakeGenericType(
                                new Type[] { controllerConfig.CommandType });
                        }


                        controllerConfig.DivId = actionConfig.RefreshDiv;
                        controllerConfig.ViewName = actionConfig.ViewName;
                        ResultType result;
                        Enum.TryParse(actionConfig.ResultType, out result);
                        controllerConfig.ResultBuilder = result;
                        ControllerBag.Add(controllerConfig.Name, controllerConfig);
                    }
                    else
                    {
                        utilityProvider.GetLogger().LogFatal("Controller Configurator", 9000);
                    }
                }
                else
                {
                    utilityProvider.GetLogger().LogFatal("Controller Configurator", 9001);
                }
            }
        }
 public static IInstrumentation Create(IConfigService configService)
 {
     var instrumentationConfiguration = configService.Get<InstrumentationConfiguration>("Instrumentation", "Instrumentation");
     instrumentationConfiguration.Fill();
     return new Instrumentation(instrumentationConfiguration.GetCounterCollection(), instrumentationConfiguration.GetDefaultCounter());
 }