Exemplo n.º 1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var result = ValueJsonConverter <string> .ReadValue(reader, serializer);

            switch (result.ToLowerInvariant())
            {
            case @"":
                return(UserEliteStatus.NotElite);

            case @"s":
                return(UserEliteStatus.SilverElite);

            case @"g":
                return(UserEliteStatus.GoldElite);

            case @"p":
                return(UserEliteStatus.PlatinumElite);

            case @"x":
                return(UserEliteStatus.Warned);

            default:
                throw new NotImplementedException($@"Unexpected value for User EliteStatus: {result}");
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var result = ValueJsonConverter <string> .ReadValue(reader, serializer);

            switch (result.ToLowerInvariant())
            {
            case @"b":
                return(UserEditor.Basic);

            case @"d":
                return(UserEditor.Detailed);

            default:
                throw new NotImplementedException($@"Unexpected value for User Editor: {result}");
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var result = ValueJsonConverter <string> .ReadValue(reader, serializer);

            switch (result.ToLowerInvariant())
            {
            case @"de_de":
                return(UserLocale.German);

            case @"en_us":
                return(UserLocale.English);

            case @"es_es":
                return(UserLocale.Spanish);

            case @"fr_fr":
                return(UserLocale.French);

            case @"lt_lt":
                return(UserLocale.Lithuanian);

            case @"pl_pl":
                return(UserLocale.Polish);

            case @"pt_br":
                return(UserLocale.Portugese);

            case @"fi_fi":
                return(UserLocale.Finnish);

            case @"sv_se":
                return(UserLocale.Swedish);

            case @"ru_ru":
                return(UserLocale.Russian);

            case @"zh_cn":
                return(UserLocale.Chinese);

            case @"ja_jp":
                return(UserLocale.Japanese);

            default:
                throw new ArgumentOutOfRangeException(nameof(result), result, null);
            }
        }
Exemplo n.º 4
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var result = ValueJsonConverter <string> .ReadValue(reader, serializer);

            switch (result.ToLowerInvariant())
            {
            case @"h":
                return(UserStartPane.Help);

            case @"a":
                return(UserStartPane.Analyze);

            case @"t":
                return(UserStartPane.Top10);

            default:
                throw new NotImplementedException($@"Unexpected value for User StartPane: {result}");
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var result = ValueJsonConverter <string> .ReadValue(reader, serializer);

            switch (result.ToLowerInvariant())
            {
            case @"n":
                return(UserPrivacy.Private);

            case @"y":
                return(UserPrivacy.Public);

            case @"o":
                return(UserPrivacy.Open);

            default:
                throw new NotImplementedException($@"Unexpected value for User Privacy: {result}");
            }
        }