private static ShortcutFileContent ParseV4(XmlElement root) { XmlElement first = null; XmlElement second = null; //ちょっといいかげんだが、最初のElement、2個目のElementを。 foreach (XmlNode node in root.ChildNodes) { XmlElement e = node as XmlElement; if (e != null) { if (first == null) { first = e; } else if (second == null) { second = e; break; } } } if (second == null) { throw new FormatException("Unknown XML Format"); } StructuredText setting_text = new XmlStructuredTextReader(first).Read(); StructuredText parameter_text = new XmlStructuredTextReader(second).Read(); ISerializeService ss = TerminalSessionsPlugin.Instance.SerializeService; ITerminalSettings setting = ss.Deserialize(setting_text) as ITerminalSettings; if (setting == null) { throw new FormatException("TerminalSettings could not be loaded"); } ITerminalParameter param = ss.Deserialize(parameter_text) as ITerminalParameter; if (param == null) { throw new FormatException("TerminalParameter could not be loaded"); } return(new ShortcutFileContent(setting, param)); }
private static ShortcutFileContent ParseV4(XmlElement root) { XmlElement first = null; XmlElement second = null; //ちょっといいかげんだが、最初のElement、2個目のElementを。 foreach (XmlNode node in root.ChildNodes) { XmlElement e = node as XmlElement; if (e != null) { if (first == null) first = e; else if (second == null) { second = e; break; } } } if (second == null) throw new FormatException("Unknown XML Format"); StructuredText setting_text = new XmlStructuredTextReader(first).Read(); StructuredText parameter_text = new XmlStructuredTextReader(second).Read(); ISerializeService ss = TerminalSessionsPlugin.Instance.SerializeService; ITerminalSettings setting = ss.Deserialize(setting_text) as ITerminalSettings; if (setting == null) throw new FormatException("TerminalSettings could not be loaded"); ITerminalParameter param = ss.Deserialize(parameter_text) as ITerminalParameter; if (param == null) throw new FormatException("TerminalParameter could not be loaded"); return new ShortcutFileContent(setting, param); }