/[AnywhereTS-MSSQL]/trunk/TSAdminTool/Keyboard.cs
ViewVC logotype

Contents of /trunk/TSAdminTool/Keyboard.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Wed Jul 11 14:19:13 2012 UTC (7 years, 7 months ago) by william
File size: 2764 byte(s)
imported from https://anywherets.svn.sourceforge.net/svnroot/anywherets/trunk/
Revision: 1
Author: beartown
Date: 3:10:40 AM, Monday, June 21, 2010
Message:
First upload. Still todo in order to get a fully working product: Replace Thinstation images with vanilla Thinstation, modify ImageDesigntimeConfig.cs, ImageRuntimeConfig.cs in order to support the Thinstation image
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows.Forms;
5
6 namespace AnywhereTS
7 { // Provides support functions for client keyboards
8 static class ATSKeyboard
9 { // The input cultures for rdesktop. Each culture is languagecode_countrycode or just languagecode
10 public static string[] keyboardCode = new string[] {"ar", "hr", "cs", "da", "nl", "nl_be", "en_gb", "en_nz", "en_us", "en_in", "et", "fr", "fr_be", "fr_ca", "fr_ch", "de", "de_ch", "hu", "it", "ja", "la", "lv", "lt", "mk", "no", "pl", "pt", "pt_br", "ro", "ru", "sl", "es", "sv", "sv_fi", "th", "tr"};
11 public static string[] keyboardDescription = new string[] { "Arabic", "Croatian", "Czech", "Danish", "Dutch", "Dutch-Belgium", "English-Great Britain", "English-New Zealand", "English-United States", "English-United States International", "Estonian", "French", "French-Belgium", "French-Canada", "French-Switzerland", "German", "German-Switzerland", "Hungarian", "Italian", "Japanese", "Latin", "Latvian", "Lithuanian", "Macedonian", "Norwegian", "Polish", "Portuguise", "Portuguise-Brazil", "Romanian", "Russian", "Slovenian", "Spanish", "Swedish", "Swedish-Finland", "Thai", "Turkish" };
12
13 // Returns the default keyboard map from the windows settings on the current computer.
14 public static string DefaultKeyboardMap()
15 {
16 string windowsMap = InputLanguage.DefaultInputLanguage.Culture.Name.ToLower();
17 windowsMap.Replace("-", "_"); // Convert to Thinstation format, i.e "en_us"
18 foreach (string keyb in keyboardCode)
19 {
20 if (keyb == windowsMap)
21 {
22 return keyb; // We found a match on language and country
23 }
24 }
25 // No match on language and country
26 windowsMap = windowsMap.Substring(0, 2);
27 foreach (string keyb in keyboardCode)
28 {
29 if (keyb == windowsMap)
30 {
31 return keyb; // We found a match on language only
32 }
33 }
34 // No match, select english as default
35 return "en_us";
36
37 }
38
39 // Returns the index for an keyboard map in string form.
40 public static int KeyboardCodeToIndex(string searchKeyboardCode)
41 {
42 for (int i = 0; i <= keyboardCode.GetUpperBound(0); i++)
43 {
44 if (keyboardCode[i] == searchKeyboardCode)
45 {
46 return i;
47 }
48 }
49 // Not found
50 MessageBox.Show("Error illegal keyboard code (24552)");
51 return 0;
52 }
53 }
54 }

  ViewVC Help
Powered by ViewVC 1.1.22