/// <summary> /// パラメーターの初期化 /// </summary> /// <param name="param"></param> public override void ParseParameter(string param) { string[] coms = param.Split(new char[] { ';' }); foreach (string com in coms) { string[] od = com.Split(new char[] { '=' }); if (od.Length < 2) { continue; } if (od[0].ToLower() == "centerlock") { _isCenterLock = Const.IsTrue(od[1]); } if (od[0].ToLower() == "samexy") { _isSameXY = Const.IsTrue(od[1]); } if (od[0].ToLower() == "trigger") { _trigger = new MouseState.Buttons(); string[] ts = od[1].Split(new char[] { '+' }); foreach (string t in ts) { if (t.ToLower() == "middle") { _trigger.IsButtonMiddle = true; } if (t.ToLower() == "button" || t.ToLower() == "left") { _trigger.IsButton = true; } if (t.ToLower() == "ctrl") { _trigger.IsCtrl = true; } if (t.ToLower() == "shift") { _trigger.IsShift = true; } } } else if (od[0].ToLower() == "cursor") { if (od.Length == 3) { string[] ts = od[2].Split(new char[] { '.' }); string[] trs = od[1].Split(new char[] { '+' }); MouseState.Buttons trg = new Tono.GuiWinForm.MouseState.Buttons(); foreach (string t in trs) { if (t.ToLower() == "middle") { trg.IsButtonMiddle = true; } if (t.ToLower() == "button" || t.ToLower() == "left") { trg.IsButton = true; } if (t.ToLower() == "ctrl") { trg.IsCtrl = true; } if (t.ToLower() == "shift") { trg.IsShift = true; } } if (od[2].ToLower().IndexOf("cursors") != -1) { Type t = typeof(System.Windows.Forms.Cursors); System.Reflection.PropertyInfo pi = t.GetProperty(ts[ts.Length - 1].ToString()); if (pi != null) { _EventCursor = (Cursor)pi.GetValue(null, Array.Empty <object>()); } } } } } }
/// <summary> /// 指定ファイルのXMLからメッセージを読み込む /// </summary> /// <param name="filename">ファイル名(フルパス)</param> /// <param name="recCheck">循環参照防止用 ファイル名記憶辞書</param> private void _init(string filename, IDictionary recCheck) { // 循環参照防止 if (recCheck.Contains(filename)) { return; } else { recCheck[filename] = this; } // 読み込み処理 var xd = new XmlDocument(); xd.Load(filename); var root = xd.DocumentElement; var week = root.GetElementsByTagName("mes"); foreach (XmlNode node in week) { // load 属性の処理 if (node.Attributes != null) { XmlNode n2 = node.Attributes["load"]; if (n2 != null) { object load = n2.Value; _code = load.ToString(); _init(makeMesFilename(load.ToString()), recCheck); } } // 値の処理 string key; if (node.Attributes != null && node.Attributes["key"] != null) { key = node.Attributes["key"].Value; } else { continue; } if (node.Attributes != null && node.Attributes["ver"] != null) { object ver = node.Attributes["ver"].Value; key = key + "@" + ver.ToString(); } // 下位メッセージの処理 var innnerN = 0; foreach (XmlNode cnode in node.ChildNodes) { if (node.NodeType == XmlNodeType.Element) { if (cnode.Attributes != null && cnode.Attributes["key"] != null) { var ckey = cnode.Attributes["key"].Value; _dat[key + "@" + ckey] = cnode.InnerText; innnerN++; } } } if (innnerN == 0) { _dat[key] = node.InnerText; } } // フォントの読み込み foreach (XmlNode fnode in root.GetElementsByTagName("font")) { if (fnode.Attributes != null) { if (fnode.Attributes["key"] == null) { continue; } if (fnode.Attributes["face"] == null) { continue; } if (fnode.Attributes["size"] == null) { continue; } var ckey = fnode.Attributes["key"].Value; var face = fnode.Attributes["face"].Value; var size = float.Parse(fnode.Attributes["size"].Value); string b = "0", u = "0", s = "0", i = "0"; if (fnode.Attributes["bold"] != null) { b = fnode.Attributes["bold"].Value; } if (fnode.Attributes["underline"] != null) { u = fnode.Attributes["underline"].Value; } if (fnode.Attributes["stlikeout"] != null) { s = fnode.Attributes["stlikeout"].Value; } if (fnode.Attributes["italic"] != null) { i = fnode.Attributes["italic"].Value; } SetFont(ckey, face, size, Const.IsTrue(b), Const.IsTrue(u), Const.IsTrue(i), Const.IsTrue(s)); } } }