コード例 #1
0
        public static string SDLCodetoDx(string sdlCode, KeyboardType keyboardType)
        {
            KeyboardTranslation kbt = new KeyboardTranslation();

            if (sdlCode == null || sdlCode == "")
            {
                return("");
            }

            if (keyboardType == KeyboardType.UK)
            {
                var uk = kbt.dxKeys.Where(a => a.SDLK.ToString() == sdlCode.Replace("keyboard ", "")).ToList();
                if (uk.Count == 0)
                {
                    return(sdlCode);
                }

                if (uk.First().DxUK.Contains("SDLK_"))
                {
                    // no dx lookup was found
                    return("keyboard " + uk.First().SDLK);
                }

                return(uk.First().DxUK);
            }

            return(sdlCode);
        }
コード例 #2
0
        public static string DXtoSDLCode(string dxString, KeyboardType keyboardType)
        {
            KeyboardTranslation kbt = new KeyboardTranslation();

            if (keyboardType == KeyboardType.UK)
            {
                var uk = kbt.dxKeys.Where(a => a.DxUK == dxString).ToList();
                if (uk.Count == 0)
                {
                    return(dxString);
                }

                return("keyboard " + uk.First().SDLK.ToString());
            }
            return(dxString);
        }