*** empty log message ***
[m17n/m17n-lib-cs.git] / input.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Xml;
5 using M17N;
6 using M17N.Core;
7 using M17N.Input;
8
9 public class Test
10 {
11   public static void Main()
12   {
13     //M17n.debug = true;
14     MDatabase.ApplicationDir = "/usr/local/share/m17n-xml";
15     MText desc, title;
16     MInputMethod.Variable[] vars;
17     MInputMethod.Command[] cmds;
18
19 #if false
20     MDatabase.Tag tag = new MDatabase.Tag ("input-method",
21                                            "t", "nil", "vi-base");
22     MDatabase mdb = MDatabase.Find (tag);
23     XmlNode node = mdb.Load ("map-alnum", "input-method", "map-list", "map");
24
25     Console.WriteLine (node.OuterXml);
26
27 #elif true
28     MInputMethod im = MInputMethod.Find ("vi", "telex");
29
30     if (im.Info (out desc, out title, out vars, out cmds))
31       {
32         Console.WriteLine ("{0}, {1}, {2}, {3}", desc, title, vars, cmds);
33         im.Open ();
34       }
35 #else
36     MInputMethod[] ims = MInputMethod.List ();
37     foreach (MInputMethod im in ims)
38       {
39
40         Console.Write ("(<{0}, {1}, {2}>", im.Language, im.Name, im.SubName);
41         if (im.Info (out desc, out title, out vars, out cmds))
42           Console.Write (" {0}, {1}, {2}, {3}", desc, title, vars, cmds);
43         if (! im.Open ())
44           Console.Write (" open fail");
45         Console.WriteLine (")");
46       }
47 #endif
48   }
49 }