You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.0 KiB
72 lines
2.0 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
using System.Xml; |
|
using System.Xml.XPath; |
|
using System.IO; |
|
using System.Xml.Linq; |
|
using Wmhelp.XPath2; |
|
using System.Windows.Forms; |
|
|
|
namespace Vlimport |
|
{ |
|
public class Transporter |
|
{ |
|
static List<Operations> operations = new List<Operations>(); //Объявляю список |
|
|
|
public void CollectItems(string filePath, ListBox Itemlist) |
|
{ |
|
|
|
XmlDocument xDoc = new XmlDocument(); |
|
xDoc.Load(filePath.ToString()); |
|
XmlElement xRoot = xDoc.DocumentElement; |
|
|
|
|
|
|
|
XmlNodeList mySearch = xRoot.XPath2SelectNodes("//Object[ends-with(@Name,'_oper')]"); |
|
|
|
|
|
foreach (XmlNode oper in mySearch) |
|
{ |
|
|
|
//Operations operation = new Operations(); |
|
|
|
|
|
|
|
var operId = oper.XPath2SelectSingleNode("//Attribute[@Name='indexoper']").Attributes["Value"].Value; |
|
var operName = oper.XPath2SelectSingleNode("//Attribute[@Name='nameoper']").Attributes["Value"].Value; |
|
|
|
operations.Add(new Operations(operId, operName)); |
|
|
|
foreach (XmlNode step in oper.XPath2SelectNodes("//Object[ends-with(@Name,'_step')]")) |
|
{ |
|
var stepNum = step.XPath2SelectSingleNode("//Attribute[@Name='numstep']").Attributes["Value"].Value; |
|
var stepName = step.XPath2SelectSingleNode("//Attribute[@Name='name']").Attributes["Value"].Value; |
|
|
|
operations.Add(new Operations(stepNum, stepName)); |
|
|
|
} |
|
|
|
} |
|
foreach (Operations op in operations) |
|
{ |
|
Itemlist.Items.Add(op); |
|
} |
|
|
|
} |
|
|
|
public void addItems() |
|
{ |
|
using (TextWriter tw = new StreamWriter("SavedList.txt")) |
|
{ |
|
foreach (Operations oop in operations) |
|
tw.WriteLine(oop); |
|
} |
|
|
|
|
|
} |
|
|
|
} |
|
}
|
|
|