Beispiel #1
0
        public static TransitionLayer ToTransitionLayerKey(this UpstreamKeyId index)
        {
            IEnumerable <TransitionLayer> values = Enum.GetValues(typeof(TransitionLayer)).OfType <TransitionLayer>();

            foreach (TransitionLayer val in values)
            {
                KeyIndexAttribute attr = val.GetPossibleAttribute <TransitionLayer, KeyIndexAttribute>();
                if (attr != null && attr.Index == index)
                {
                    return(val);
                }
            }

            return(0);
        }
Beispiel #2
0
        public static bool HasKeyEnabled(this TransitionLayer trans, UpstreamKeyId index)
        {
            IEnumerable <TransitionLayer> values = Enum.GetValues(typeof(TransitionLayer)).OfType <TransitionLayer>();

            foreach (TransitionLayer val in values)
            {
                if (!trans.HasFlag(val))
                {
                    continue;
                }

                KeyIndexAttribute attr = val.GetPossibleAttribute <TransitionLayer, KeyIndexAttribute>();
                if (attr != null && attr.Index == index)
                {
                    return(true);
                }
            }

            return(false);
        }