public void LoadJob(string jobFileName) { this.Clear(); //var xmlDoc = new XmlDocument(); if (!File.Exists(jobFileName)) { throw new FileNotFoundException(); } var doc = new XmlDocument(); doc.Load(jobFileName); //XPathDocument xPathDoc = new XPathDocument(jobFileName); //XPathNavigator nav = xPathDoc.CreateNavigator(); var job = new CentipedeJob(jobFileName, doc) { FileName = jobFileName }; //var it = nav.Select("//Actions/*"); IEnumerable <XmlElement> it = doc.GetElementsByTagName("Actions")[0].ChildNodes.OfType <XmlElement>(); foreach (XmlElement actionElement in it) { AddAction(job, Action.FromXml(actionElement, this)); } this.Job = job; this.OnAfterLoad(EventArgs.Empty); }
public static List <IAction> FromClipboard(ICentipedeCore core) { var data = (string)Clipboard.GetData(DataFormats.Text); var doc = new XmlDocument(); doc.LoadXml(data); var clipBoardElement = doc.GetFirstElementByName(ElementName); if (clipBoardElement == null) { throw new ApplicationException(); } return(clipBoardElement.ChildNodes.OfType <XmlElement>() .Select(element => (IAction)Action.FromXml(element, core)) .ToList()); }