コード例 #1
0
        private static IControllerElementMappings GetDefaultDeviceMappings(IControllerLayout realDevice,
                                                                           IControllerLayout virtualDevice)
        {
            var mappedElements = from element in virtualDevice.Layout
                                 select new MappedControllerElement(element.Key,
                                                                    realDevice.Layout[element.Key] != null ? element.Key : ControllerElement.NoElement);

            var elementCollection = new ControllerElementMappings(realDevice.LayoutId, virtualDevice.LayoutId);

            foreach (var element in mappedElements)
            {
                elementCollection.Add(element);
            }

            return(elementCollection);
        }
コード例 #2
0
        private static IControllerElementMappings GetDefaultKeyboardMappings(IControllerLayout realKeyboard,
                                                                             IControllerLayout virtualDevice)
        {
            var mappedElements = from element in virtualDevice.Layout
                                 select new MappedControllerElement(element.Key,
                                                                    ControllerElementMappings.DefaultKeyboardMappings.ContainsKey(element.Key)
                        ? ControllerElementMappings.DefaultKeyboardMappings[element.Key]
                        : ControllerElement.KeyNone);
            var elementCollection = new ControllerElementMappings(realKeyboard.LayoutId, virtualDevice.LayoutId);

            foreach (var element in mappedElements)
            {
                elementCollection.Add(element);
            }

            return(elementCollection);
        }