public bool add_page() { try { Target_Path target = new Target_Path(); //InternetExplorer explorer = get_browser(); //if (explorer == null) // return false; target.path = (string)Automation.execute("standard.grab_text"); Generic_Form form = new Generic_Form(target, "new web page"); if (form.ShowDialog() == DialogResult.OK) { pages.Add(target.command, target); save_dictionary(pages, Global.configuration.settings_path("web_pages.xml")); Automation.reload(); return(true); } } catch (Exception ex) { Feedback.print(ex); } return(false); }
public bool add_folder() { try { Target_Path target = new Target_Path(); Automation.sendkeys("%d^a"); target.path = (string)Automation.execute("standard.grab_text"); Generic_Form form = new Generic_Form(target, "new folder"); if (form.ShowDialog() == DialogResult.OK) { folders.Add(target.command, target); save_dictionary(folders, Global.configuration.settings_path("folders.xml")); Automation.reload(); return(true); } } catch (Exception ex) { Feedback.print(ex); } return(false); }
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; } }