Ejemplo n.º 1
0
        public static bool VistaMappingsNeedSaving()
        {
            // Check whether the current boot mappings and the proposed boot mappings
            // are the same: if not, they need saving

            byte[] map = RegistryProvider.GetScancodeMapFromRegistry(MapLocation.KeyMapperVistaMappingsCache);

            if (map == null)
            {
                return(false);
            }

            Collection <KeyMapping> maps = GetMappingsFromScancodeMap(map);

            if (maps.Count != mappings.Count)
            {
                return(true);
            }

            foreach (KeyMapping km in maps)
            {
                if (mappings.Contains(km) == false)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        private static void GetMappingsFromRegistry(MapLocation location)
        {
            var mappings = new Collection <KeyMapping>();

            byte[] map = RegistryProvider.GetScancodeMapFromRegistry(location);

            if (map != null)
            {
                mappings = GetMappingsFromScancodeMap(map);
            }

            switch (location)
            {
            case MapLocation.LocalMachineKeyboardLayout:
                MappingsManager.mappings = mappings;
                break;

            case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                savedBootMappings = mappings;
                break;

            default:
                throw new InvalidOperationException("Unknown value for MapLocation: " + location);
            }
        }
Ejemplo n.º 3
0
        private static void GetMappingsFromRegistry(MapLocation location)
        {
            var mappings = new Collection <KeyMapping>();

            MappingType type = MappingType.Null;

            switch (location)
            {
            case MapLocation.LocalMachineKeyboardLayout:
            case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                type = MappingType.Boot;
                break;

            case MapLocation.CurrentUserKeyboardLayout:
            case MapLocation.KeyMapperCurrentUserKeyboardLayout:
                type = MappingType.User;
                break;
            }


            byte[] map = RegistryProvider.GetScancodeMapFromRegistry(location);

            if (map != null)
            {
                mappings = GetMappingsFromScancodeMap(map, type);
            }

            switch (location)
            {
            case MapLocation.LocalMachineKeyboardLayout:
                _bootMappings = mappings;
                break;

            case MapLocation.CurrentUserKeyboardLayout:
                _userMappings = mappings;
                break;

            case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                _savedBootMappings = mappings;
                break;

            case MapLocation.KeyMapperCurrentUserKeyboardLayout:
                _savedUserMappings = mappings;
                break;

            default:
                break;
            }
        }