using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Test_LoadXMLFile { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void buttonStart_Click(object sender, EventArgs e) { var load = new LoadXML(); load.FileName = @"C:\Temp\Test\Test.xml"; load.Topic = "NX-Portal"; load.Group = "Management"; load.Key = "Method"; //load.LoadAllValues = LoadXML.LoadAll.Yes; load.LoadAllValues = LoadXML.LoadAll.No; load.Load(); if (load.Values != null) { labelResult.Text = Ausgabe(load.FileName, load.Topic, load.Group, load.Key, load.Values); } load.Group = "NX"; load.Key = "Version"; load.Load(); if (load.Values != null) { labelResult.Text += Ausgabe2(load.Group, load.Key, load.Values); } else { labelResult.Text = "Keine Werte"; } } private string Ausgabe(string fileName, string topic, string group, string key, string[,] values) { string result = ""; result = "Filename: " + fileName; result += "\r\nTopic: " + topic; result += "\r\nGroup: " + group; result += "\r\nKey: " + key; result += "\r\n\r\nValues (ID - Methode - Standard): "; int z = 0; foreach (var item in values) { if (z==3) { z = 0; } if (z==2) { result += " - " + item; z++; } if (z==1) { result += " - " + item; z++; } if (z==0) { result += "\r\n" + item; z++; } } return result; } private string Ausgabe2(string group, string key, string[,] values) { string result = ""; result += "\r\n\r\nGroup: " + group; result += "\r\nKey: " + key; result += "\r\n\r\nValues (ID - Version - Standard): "; int z = 0; foreach (var item in values) { if (z == 3) { z = 0; } if (z == 2) { result += " - " + item; z++; } if (z == 1) { result += " - " + item; z++; } if (z == 0) { result += "\r\n" + item; z++; } } return result; } } }