private void initialize(string new_grammar, string filename, Dictionary <string, Target_Path> target) { //file_name = Global.configuration.settings_path(file_name); target.Clear(); Global.configuration.load_block(filename, (file_name) => { try { Familiar_Document grammar_document = Familiar_Document.find_document(new_grammar); if (grammar_document == null) { throw new Exception("Could not find Grammar!"); } choices = grammar_document.get_rule_choice("pages"); //choices.children.Clear(); //if (!File.Exists(file_name)) // throw new Exception("Could not find File!"); XmlDocument document = new XmlDocument(); document.Load(file_name); foreach (XmlElement element in document.ChildNodes[1].ChildNodes) { Target_Path program = new Target_Path(); program.path = element.GetAttribute("path"); program.command = element.FirstChild.InnerText; if (target.ContainsKey(program.command)) { continue; } target.Add(program.command, program); Element_Base new_item = choices.create_child(typeof(Element_Item)); new_item.text = program.command; } } catch { } }); }
public void initialize_external_programs(Familiar_Document new_library) { Familiar_Document library = new_library; Element_Choice choices = library.get_rule_choice("programs"); choices.children.Clear(); programs.Clear(); XmlDocument document = new XmlDocument(); document.Load(Global.configuration.settings_path("external_programs.xml")); foreach (XmlElement element in document.ChildNodes[1].ChildNodes) { Target_Path program = new Target_Path(); program.path = element.GetAttribute("path"); program.arguments = get_element_text(element, "arguments"); program.working_directory = get_element_text(element, "directory"); string command = get_element_text(element, "command"); programs.Add(command, program); Element_Base new_item = choices.create_child(typeof(Element_Item)); new_item.text = command; } }