Ejemplo n.º 1
0
        public async Task <string> GetGameConstantsAsync(EnumConstants constant)
        {
            var parameter = Regex.Replace(constant.ToString(), "([a-z])([A-Z])", "$1_$2").ToLower();
            var response  = await _request.GetResponseAsync($"constants/{parameter}");

            return(await response.Content.ReadAsStringAsync());
        }
Ejemplo n.º 2
0
        public string GetCommonPrefix()
        {
            if (EnumConstants.Count < 2)
            {
                return("");
            }

            string prefix = "";
            int    i      = 0;

            while (true)
            {
                char c = EnumConstants[0].Constant[i];
                if (EnumConstants.Any(e => e.Constant[i] != c))
                {
                    break;
                }
                if (EnumConstants.Any(e => e.Constant.Length == i))
                {
                    // Prefix is already one of the enumerators,
                    // can't use this prefix
                    return("");
                }
                i++;
                prefix += c;
            }
            return(prefix);
        }
        public IHttpActionResult SetLightingScene(LightSceneEntity lightscene)
        {
            LightSceneEntity lightScenetemp = new LightSceneEntity();

            lightscene.Value = EnumConstants.GetEnumValueFromDescription <LightSceneEnum>(lightscene.LightScene).ToString();
            var lightScene   = BackNetWriteAction.SetConfLightScene(lightscene);
            var lightLevel   = BackNetReadAction.GetConfLightLevel(lightscene.DeviceID);
            var deviceDetail = new DeviceDetailEnity
            {
                DeviceID        = lightScene.DeviceID,
                LightScene      = lightScene.LightScene,
                LightSceneValue = lightScene.Value,
                LightLevel      = lightLevel.LightLevel,
                //LightState = lightState.LightState
            };

            return(Ok(deviceDetail));
        }
Ejemplo n.º 4
0
        public string GetCommonSuffix()
        {
            if (EnumConstants.Count < 2)
            {
                return("");
            }

            string suffix = "";
            int    i      = 1;

            while (true)
            {
                string enumConstant = EnumConstants[0].Constant;
                char   c            = enumConstant[enumConstant.Length - i];
                if (EnumConstants.Any(e => e.Constant[e.Constant.Length - i] != c))
                {
                    break;
                }
                i++;
                suffix = c + suffix;
            }
            return(suffix);
        }