Ejemplo n.º 1
0
        public static IServiceCollection AddJsonLocalization(this IServiceCollection services,
                                                             IDictionaryBuilder dictionaryBuilder, Action <JsonLocalizationOptions> setupAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (dictionaryBuilder == null)
            {
                throw new ArgumentNullException(nameof(dictionaryBuilder));
            }

            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            void SetupWrapperAction(JsonLocalizationOptions options)
            {
                setupAction(options);
                I18N.BuildDictionary(dictionaryBuilder, options);
            }

            services.Configure <JsonLocalizationOptions>(SetupWrapperAction);
            services.AddScoped <II18N, I18N>();
            services.AddScoped <IKeyProvider, DefaultKeyProvider>();

            return(services);
        }
        public ITurnCalculatorLogic GetTurnCalculator()
        {
            IDictionaryBuilder    dictionaryBuilder = GetDictionaryBuilder();
            IEnglishDictionary    dictionary        = dictionaryBuilder.BuildDictionary();
            IPointCalculatorLogic pointCalculator   = GetPointCalculator();
            ILetterRackLogic      rackLogic         = GetLetterRackLogic();
            IGameBoardLogic       boardLogic        = GetGameBoardLogic();

            return(new ScrabbleTurnCalculatorLogic(dictionary, pointCalculator, boardLogic, rackLogic));
        }
Ejemplo n.º 3
0
        public static JObject ToJObject <TKey, TValue>(this IDictionaryBuilder <TKey, TValue> dictionaryBuilder)
        {
            var jObject = new JObject();

            foreach (var item in dictionaryBuilder)
            {
                jObject.Add(item.Key.ToString(), JToken.FromObject(item.Value));
            }

            return(jObject);
        }
Ejemplo n.º 4
0
        public static void BuildDictionary(IDictionaryBuilder dictionaryBuilder, JsonLocalizationOptions options)
        {
            if (dictionaryBuilder == null)
            {
                throw new ArgumentNullException(nameof(dictionaryBuilder));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            ClearDictionary();

            dictionaryBuilder.Build(Translations, options);
        }
        private static string BuildClientAccessUrl(
            AuthenticationGrantTypeClientCredential authenticationGrantTypeClientCredential,
            GetAuthenticationServicesAdto getAuthenticationServicesAdto)
        {
            IDictionaryBuilder <string, object> builder = DictionaryBuilder <string, object> .Create()
                                                          .Add("clientId", authenticationGrantTypeClientCredential.ClientId);

            if (!string.IsNullOrWhiteSpace(getAuthenticationServicesAdto.State))
            {
                builder.Add("state", getAuthenticationServicesAdto.State);
            }

            if (!string.IsNullOrWhiteSpace(getAuthenticationServicesAdto.RedirectUri))
            {
                builder.Add("redirectUri", getAuthenticationServicesAdto.RedirectUri);
            }

            return(authenticationGrantTypeClientCredential.ClientGrantAccessTokenUrl.Format(builder.Build()));
        }
        public static object ToObject <TKey, TValue>(this IDictionaryBuilder <TKey, TValue> dictionary)
        {
            dynamic expandoObject = dictionary as ExpandoObject;

            return(expandoObject);
        }
Ejemplo n.º 7
0
 public SystemConsole()
 {
     parameterDictionary = new Dictionary <string, string>();
     dictionaryBuilder   = DictionaryBuilder
                           .Create(parameterDictionary);
 }