From cd53574fba0838f8ef0d552e6476ad9d97d6a528 Mon Sep 17 00:00:00 2001 From: wesley Date: Fri, 22 Mar 2024 01:35:19 +0100 Subject: [PATCH] 1st commit --- xmlserializetest.sln | 25 +++ xmlserializetest/App.config | 6 + xmlserializetest/Form1.Designer.cs | 113 ++++++++++ xmlserializetest/Form1.cs | 208 ++++++++++++++++++ xmlserializetest/Form1.resx | 120 ++++++++++ xmlserializetest/Groups.cs | 45 ++++ xmlserializetest/MetaData.cs | 95 ++++++++ xmlserializetest/Program.cs | 22 ++ xmlserializetest/Properties/AssemblyInfo.cs | 36 +++ .../Properties/Resources.Designer.cs | 70 ++++++ xmlserializetest/Properties/Resources.resx | 117 ++++++++++ .../Properties/Settings.Designer.cs | 29 +++ xmlserializetest/Properties/Settings.settings | 7 + xmlserializetest/Res.cs | 107 +++++++++ xmlserializetest/Result.cs | 138 ++++++++++++ xmlserializetest/Table.cs | 44 ++++ xmlserializetest/Tests.cs | 62 ++++++ xmlserializetest/xmlserializetest.csproj | 90 ++++++++ 18 files changed, 1334 insertions(+) create mode 100644 xmlserializetest.sln create mode 100644 xmlserializetest/App.config create mode 100644 xmlserializetest/Form1.Designer.cs create mode 100644 xmlserializetest/Form1.cs create mode 100644 xmlserializetest/Form1.resx create mode 100644 xmlserializetest/Groups.cs create mode 100644 xmlserializetest/MetaData.cs create mode 100644 xmlserializetest/Program.cs create mode 100644 xmlserializetest/Properties/AssemblyInfo.cs create mode 100644 xmlserializetest/Properties/Resources.Designer.cs create mode 100644 xmlserializetest/Properties/Resources.resx create mode 100644 xmlserializetest/Properties/Settings.Designer.cs create mode 100644 xmlserializetest/Properties/Settings.settings create mode 100644 xmlserializetest/Res.cs create mode 100644 xmlserializetest/Result.cs create mode 100644 xmlserializetest/Table.cs create mode 100644 xmlserializetest/Tests.cs create mode 100644 xmlserializetest/xmlserializetest.csproj diff --git a/xmlserializetest.sln b/xmlserializetest.sln new file mode 100644 index 0000000..95e8110 --- /dev/null +++ b/xmlserializetest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.34407.143 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xmlserializetest", "xmlserializetest\xmlserializetest.csproj", "{BDDB1FFF-DFB1-44A3-86E4-355EA797758F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BDDB1FFF-DFB1-44A3-86E4-355EA797758F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BDDB1FFF-DFB1-44A3-86E4-355EA797758F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BDDB1FFF-DFB1-44A3-86E4-355EA797758F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BDDB1FFF-DFB1-44A3-86E4-355EA797758F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BFB01376-3231-4349-9D67-1BA84FCC6C40} + EndGlobalSection +EndGlobal diff --git a/xmlserializetest/App.config b/xmlserializetest/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/xmlserializetest/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/xmlserializetest/Form1.Designer.cs b/xmlserializetest/Form1.Designer.cs new file mode 100644 index 0000000..92dd4b7 --- /dev/null +++ b/xmlserializetest/Form1.Designer.cs @@ -0,0 +1,113 @@ + +namespace xmlserializetest +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.lbGroups = new System.Windows.Forms.ListBox(); + this.lbPins = new System.Windows.Forms.ListBox(); + this.lbTests = new System.Windows.Forms.ListBox(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(712, 121); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(856, 674); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // lbGroups + // + this.lbGroups.FormattingEnabled = true; + this.lbGroups.ItemHeight = 16; + this.lbGroups.Location = new System.Drawing.Point(223, 121); + this.lbGroups.Name = "lbGroups"; + this.lbGroups.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.lbGroups.Size = new System.Drawing.Size(189, 356); + this.lbGroups.TabIndex = 1; + this.lbGroups.SelectedIndexChanged += new System.EventHandler(this.lbGroups_SelectedIndexChanged); + // + // lbPins + // + this.lbPins.FormattingEnabled = true; + this.lbPins.ItemHeight = 16; + this.lbPins.Location = new System.Drawing.Point(436, 121); + this.lbPins.Name = "lbPins"; + this.lbPins.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; + this.lbPins.Size = new System.Drawing.Size(189, 356); + this.lbPins.TabIndex = 2; + this.lbPins.SelectedIndexChanged += new System.EventHandler(this.lbPins_SelectedIndexChanged); + // + // lbTests + // + this.lbTests.FormattingEnabled = true; + this.lbTests.ItemHeight = 16; + this.lbTests.Location = new System.Drawing.Point(12, 122); + this.lbTests.Name = "lbTests"; + this.lbTests.Size = new System.Drawing.Size(187, 356); + this.lbTests.TabIndex = 3; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1711, 899); + this.Controls.Add(this.lbTests); + this.Controls.Add(this.lbPins); + this.Controls.Add(this.lbGroups); + this.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.ListBox lbGroups; + private System.Windows.Forms.ListBox lbPins; + private System.Windows.Forms.ListBox lbTests; + } +} + diff --git a/xmlserializetest/Form1.cs b/xmlserializetest/Form1.cs new file mode 100644 index 0000000..d00d5f4 --- /dev/null +++ b/xmlserializetest/Form1.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public partial class Form1 : Form + { + List docs = new List(); + List groupData = new List(); + List pinData = new List(); + List groups = new List(); + List pins = new List(); + List tests = new List(); + + public Form1() + { + InitializeComponent(); + Main(); + } + + public void Main() + { + //const string FILENAME = @"d:\result.xml"; + //XmlReaderSettings settings = new XmlReaderSettings(); + //settings.IgnoreWhitespace = true; + //XmlReader reader = XmlReader.Create(FILENAME); + //XmlSerializer serializer = new XmlSerializer(typeof(Result)); + //Result doc = (Result)serializer.Deserialize(reader); + + + foreach (var file in Directory.EnumerateFiles(@"D:\curves\", "*.xml")) + { + XmlReaderSettings settings = new XmlReaderSettings(); + settings.IgnoreWhitespace = true; + XmlReader reader = XmlReader.Create(file); + XmlSerializer serializer = new XmlSerializer(typeof(Result)); + Result doc = (Result)serializer.Deserialize(reader); + docs.Add(doc); + PrintGroups(doc); + PrintTests(doc); + PopulateTests(doc); + groups.AddRange(GetGroups(doc)); + } + + + + + groups = groups.Distinct().ToList(); + lbGroups.DataSource = groups; + + } + + void PopulateTests(Result doc) + { + foreach (var test in doc.ResultHeader.Tests.Test) + { + if(test.TestType == "Thermo.CTS.Scimitar.Components.ParametricContainer") + tests.Add(test.Name); + } + + lbTests.DataSource = tests.Distinct().ToList(); + + } + + public void PlotData(List data) + { + chart1.Series.Clear(); + int i=0; + foreach (var curve in data) + { + i++; + string name = i.ToString(); + var s = new Series(name); + s.ChartType = SeriesChartType.Line; + chart1.Series.Add(s); + foreach (var vi in curve.Curve.Vi) + { + chart1.Series[name].Points.AddXY(vi.v, vi.i); + } + } + chart1.DataBind(); + } + + void PrintGroups (Result doc) + { + foreach (var group in doc.ResultHeader.Groups.Group) + { + Console.WriteLine(group.Name); + foreach (var pin in group.Pin) + { + Console.WriteLine("PinName : {0}, desc: {1}",pin.Name,pin.Desc); + } + + } + } + + List GetGroups (Result doc) + { + List groups = new List(); + + foreach (var group in doc.ResultHeader.Groups.Group) + { + Console.WriteLine(group.Name); + foreach (var pin in group.Pin) + { + groups.Add(pin.Desc); + } + + } + return groups; + } + + List GetPinsFromGroups(Result doc) + { + List pins = new List(); + + foreach (var group in doc.ResultHeader.Groups.Group) + { + var groups = lbGroups.SelectedItems; + Console.WriteLine(group.Name); + if (groups.Contains(group.Name)) + { + foreach (var pin in group.Pin) + { + pins.Add(pin.Name); + } + + } + + } + return pins.Distinct().ToList(); + } + + + + void PrintTests ( Result doc) + { + foreach ( var test in doc.ResultHeader.Tests.Test) + { + Console.WriteLine(test.Name); + } + } + + private void lbGroups_SelectedIndexChanged(object sender, EventArgs e) + { + groupData.Clear(); + foreach (var doc in docs) + { + groups.Clear(); + foreach (var group in lbGroups.SelectedItems) + { + groups.Add(group.ToString()); + } + + List tests = new List(); + foreach (var test in lbTests.SelectedItems) + { + tests.Add(test.ToString()); + } + + groupData.AddRange(doc.DataSection.GetResultsByTestNameAndGroups(tests, groups)); + lbPins.DataSource = GetPinsFromGroups(doc); + + } + + PlotData(groupData); + + + } + private void PlotPins () + { + pinData.Clear(); + foreach (var doc in docs) + { + pins.Clear(); + foreach (var pin in lbPins.SelectedItems) + { + pins.Add(pin.ToString()); + } + + List tests = new List(); + foreach (var test in lbTests.SelectedItems) + { + tests.Add(test.ToString()); + } + + pinData.AddRange(doc.DataSection.GetResultsByTestNameAndPins(tests, pins)); + } + PlotData(pinData); + } + + private void lbPins_SelectedIndexChanged(object sender, EventArgs e) + { + PlotPins(); + } + } +} diff --git a/xmlserializetest/Form1.resx b/xmlserializetest/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/xmlserializetest/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/xmlserializetest/Groups.cs b/xmlserializetest/Groups.cs new file mode 100644 index 0000000..ad308b3 --- /dev/null +++ b/xmlserializetest/Groups.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public class Groups + { + [XmlAttribute("xmlns")] + public string Xmlns { get; set; } + + [XmlElement("group")] + public Group[] Group { get; set; } + + } + + public class Group + { + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("desc")] + public string Desc { get; set; } + [XmlAttribute("type")] + public string Type { get; set; } + [XmlAttribute("color")] + public string Color { get; set; } + + + [XmlElement("pin")] + public Pin[] Pin { get; set; } + } + + + + public class Pin + { + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("desc")] + public string Desc { get; set; } + } + + +} diff --git a/xmlserializetest/MetaData.cs b/xmlserializetest/MetaData.cs new file mode 100644 index 0000000..2d4de61 --- /dev/null +++ b/xmlserializetest/MetaData.cs @@ -0,0 +1,95 @@ +using System; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public class MetaData + { + [XmlAttribute("job")] + public string Job { get; set; } + [XmlAttribute("batch")] + public string Batch { get; set; } + [XmlAttribute("batch_size")] + public string BatchSize { get; set; } + [XmlAttribute("TesterIDN")] + public string TesterIDN { get; set; } + + [XmlElement("report", Namespace = "")] + public Report Report { get; set; } + + } + + + public class Report + { + [XmlAttribute("Customer")] + public string Customer { get; set; } + [XmlAttribute("CustomerAddress")] + public string CustomerAddress { get; set; } + [XmlAttribute("Caption")] + public string Caption { get; set; } + [XmlAttribute("CalibrationLocation")] + public string CalibrationLocation { get; set; } + [XmlAttribute("PassFail")] + public string PassFail { get; set; } + [XmlAttribute("CertificateNo")] + public string CertificateNo { get; set; } + [XmlAttribute("TestedBy")] + public string TestedBy { get; set; } + [XmlAttribute("CalDate")] + public string CalDate { get; set; } + [XmlAttribute("ApprovedBy")] + public string ApprovedBy { get; set; } + [XmlAttribute("ApprovedDate")] + public string ApprovedDate { get; set; } + [XmlAttribute("PrintDataReport")] + public string PrintDataReport { get; set; } + [XmlAttribute("PrintCalCertificate")] + public string PrintCalCertificate { get; set; } + [XmlAttribute("IncludeGraphs")] + public string IncludeGraphs { get; set; } + [XmlAttribute("IncludeTolerance")] + public string IncludeTolerance { get; set; } + [XmlAttribute("HideRepetetiveTestNames")] + public string HideRepetetiveTestNames { get; set; } + [XmlAttribute("AlwaysPrintCalEquipmentTable")] + public string AlwaysPrintCalEquipmentTable { get; set; } + [XmlAttribute("IsAClassCertificate")] + public string IsAClassCertificate { get; set; } + [XmlAttribute("ProcedureUsed")] + public string ProcedureUsed { get; set; } + [XmlAttribute("Temperature")] + public string Temperature { get; set; } + [XmlAttribute("Humidity")] + public string Humidity { get; set; } + [XmlAttribute("CalDueDate")] + public string CalDueDate { get; set; } + [XmlAttribute("ReceivedDate")] + public string ReceivedDate { get; set; } + [XmlAttribute("Comments")] + public string Comments { get; set; } + [XmlAttribute("xmlns")] + public string Xmlns { get; set; } + + [XmlElement("tester")] + public Tester Tester { get; set; } + + } + + public class Tester + { + [XmlAttribute("ModelNo")] + public string ModelNo { get; set; } + [XmlAttribute("SerialNo")] + public string SerialNo { get; set; } + [XmlAttribute("Options")] + public string Options { get; set; } + [XmlAttribute("AsReceivedCondition")] + public string AsReceivedCondition { get; set; } + [XmlAttribute("AsLeftCondition")] + public string AsLeftCondition { get; set; } + + } +} diff --git a/xmlserializetest/Program.cs b/xmlserializetest/Program.cs new file mode 100644 index 0000000..88bbf94 --- /dev/null +++ b/xmlserializetest/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace xmlserializetest +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/xmlserializetest/Properties/AssemblyInfo.cs b/xmlserializetest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f8a3c49 --- /dev/null +++ b/xmlserializetest/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("xmlserializetest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("xmlserializetest")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bddb1fff-dfb1-44a3-86e4-355ea797758f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/xmlserializetest/Properties/Resources.Designer.cs b/xmlserializetest/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7126d1c --- /dev/null +++ b/xmlserializetest/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace xmlserializetest.Properties +{ + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("xmlserializetest.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/xmlserializetest/Properties/Resources.resx b/xmlserializetest/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/xmlserializetest/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/xmlserializetest/Properties/Settings.Designer.cs b/xmlserializetest/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0415d57 --- /dev/null +++ b/xmlserializetest/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace xmlserializetest.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/xmlserializetest/Properties/Settings.settings b/xmlserializetest/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/xmlserializetest/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/xmlserializetest/Res.cs b/xmlserializetest/Res.cs new file mode 100644 index 0000000..2c0eefa --- /dev/null +++ b/xmlserializetest/Res.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public class Res + { + [XmlAttribute("dO")] + public string dO { get; set; } + [XmlAttribute("dT")] + public string dT { get; set; } + [XmlAttribute("fC")] + public string fC { get; set; } + [XmlAttribute("lGZ")] + public string lGZ { get; set; } + [XmlAttribute("lPG")] + public string lPG { get; set; } + + [XmlAttribute("lPZ")] + public string lPZ { get; set; } + [XmlAttribute("lZG")] + public string lZG { get; set; } + [XmlAttribute("lZPC")] + public string lZPC { get; set; } + [XmlAttribute("lZV")] + public string lZV { get; set; } + [XmlAttribute("pG")] + public string pG { get; set; } + + [XmlAttribute("pin")] + public string pin { get; set; } + [XmlAttribute("sL")] + public string sL { get; set; } + [XmlAttribute("socket")] + public string socket { get; set; } + [XmlAttribute("supply")] + public string supply { get; set; } + [XmlAttribute("tN")] + public string tN { get; set; } + + [XmlAttribute("tR")] + public string tR { get; set; } + [XmlAttribute("tS")] + public string tS { get; set; } + [XmlAttribute("tT")] + public string tT { get; set; } + + [XmlElement("spot")] + public Spot[] Spot { get; set; } + + [XmlElement("curve")] + public Curve Curve { get; set; } + + //[XmlArray("curve")] + //[XmlArrayItem("vi",typeof(Vi))] + //public Vi[] Vi { get; set; } + + } + + public class Spot + { + [XmlAttribute("fT")] + public string fT { get; set; } + [XmlAttribute("lmt")] + public double lmt { get; set; } + [XmlAttribute("resid")] + public string resid { get; set; } + + [XmlElement("vi")] + public Vi[] Vi { get; set; } + + } + + public class Curve + { + + [XmlAttribute("fT")] + public string fT { get; set; } + [XmlAttribute("fV")] + public double fV { get; set; } + [XmlAttribute("lmt")] + public double lmt { get; set; } + [XmlAttribute("resid")] + public string resid { get; set; } + [XmlAttribute("sV")] + public double sV { get; set; } + + [XmlElement("vi")] + public Vi[] Vi { get; set; } + + } + + public class Vi + { + [XmlAttribute("i")] + public double i { get; set; } + [XmlAttribute("v")] + public double v { get; set; } + + } + + +} diff --git a/xmlserializetest/Result.cs b/xmlserializetest/Result.cs new file mode 100644 index 0000000..6bb67bf --- /dev/null +++ b/xmlserializetest/Result.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + [XmlRoot("result", Namespace = "keytek-result-schema")] + public class Result + { + [XmlAttribute("xmlns")] + public string Xmlns { get; set; } + [XmlAttribute("version")] + public string Version { get; set; } + [XmlAttribute("id")] + public string Id { get; set; } + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("desc")] + public string Desc { get; set; } + [XmlAttribute("createdOn")] + public string CreatedOn { get; set; } + [XmlAttribute("permissionSet")] + public string PermissionSet { get; set; } + [XmlAttribute("modifiedOn")] + public string ModifiedOn { get; set; } + [XmlAttribute("path")] + public string Path { get; set; } + [XmlAttribute("productLine")] + public string ProductLine { get; set; } + [XmlAttribute("testplanName")] + public string TestplanName { get; set; } + [XmlAttribute("deviceName")] + public string DeviceName { get; set; } + [XmlAttribute("deviceID")] + public string DeviceID { get; set; } + [XmlAttribute("comments")] + public string Comments { get; set; } + [XmlAttribute("operatorName")] + public string OperatorName { get; set; } + [XmlAttribute("rundDate")] + public string RunDate { get; set; } + [XmlAttribute("testOutcome")] + public string TestOutcome { get; set; } + [XmlAttribute("totalRuntime")] + public string TotalRuntime { get; set; } + [XmlAttribute("mappingName")] + public string MappingName { get; set; } + [XmlAttribute("runMode")] + public string RunMode { get; set; } + [XmlAttribute("batchCode")] + public string BatchCode { get; set; } + [XmlAttribute("useParallelZapping")] + public string UseParallelZapping { get; set; } + [XmlAttribute("mappingSelMode")] + public string MappingSelMode { get; set; } + [XmlAttribute("fixtureId")] + public string FixtureId { get; set; } + [XmlAttribute("offsetX")] + public string OffsetX { get; set; } + [XmlAttribute("offsetY")] + public string OffsetY { get; set; } + [XmlAttribute("physicalPsuAssignments")] + public string PhysicalPsuAssignments { get; set; } + [XmlAttribute("offlineData")] + public string OfflineData { get; set; } + [XmlAttribute("socket")] + public string Socket { get; set; } + [XmlAttribute("manualTest")] + public string ManualTest { get; set; } + [XmlAttribute("offlineDeviceName")] + public string OfflineDeviceName { get; set; } + [XmlAttribute("offlineTestplanName")] + public string OfflineTestplanName { get; set; } + + [XmlElement("resultHeader")] + public ResultHeader ResultHeader { get; set; } + [XmlElement("dataSection")] + public DataSection DataSection { get; set; } + + } + public class ResultHeader + { + [XmlAttribute("shouldSerializeHeaders")] + public string ShouldSerializeHeaders { get; set; } + + [XmlElement("metadata")] + public MetaData MetaData { get; set; } + + [XmlElement("table", Namespace = "")] + public Table Table { get; set; } + + [XmlElement("groups", Namespace = "")] + public Groups Groups { get; set; } + + [XmlElement("tests", Namespace = "")] + public Tests Tests { get; set; } + + } + public class DataSection + { + [XmlElement("res")] + public Res[] Res { get; set; } + + public List GetResultsByTestNameAndGroups(List testnames, List groupnames) + { + List results = new List(); + + foreach (var res in this.Res) + { + if ((testnames.Contains(res.dO) ) & (groupnames.Contains(res.pG) )) + { + results.Add(res); + } + } + return results; + } + + public List GetResultsByTestNameAndPins(List testnames, List pinnames) + { + List results = new List(); + + foreach (var res in this.Res) + { + if ((testnames.Contains(res.dO)) & (pinnames.Contains(res.pin))) + { + results.Add(res); + } + } + return results; + } + } + +} diff --git a/xmlserializetest/Table.cs b/xmlserializetest/Table.cs new file mode 100644 index 0000000..90b5323 --- /dev/null +++ b/xmlserializetest/Table.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public class Table + { + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("useMonospaceFont")] + public string UseMonospaceFont { get; set; } + [XmlAttribute("headersVisible")] + public string HeadersVisible { get; set; } + [XmlAttribute("transientColumnIndex")] + public string TransientColumnIndex { get; set; } + [XmlAttribute("xmlns")] + public string Xmlns { get; set; } + + [XmlElement("rows")] + public Rows Rows { get; set; } + } + + + public class Rows + { + [XmlElement("row")] + public Row[] Row { get; set; } + } + + public class Row + { + [XmlElement("cell")] + public Cell[] Cell { get; set; } + } + + public class Cell + { + [XmlText] + public string cell; + } + +} diff --git a/xmlserializetest/Tests.cs b/xmlserializetest/Tests.cs new file mode 100644 index 0000000..e91ec47 --- /dev/null +++ b/xmlserializetest/Tests.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace xmlserializetest +{ + public class Tests + { + [XmlAttribute("xmlns")] + public string Xmlns { get; set; } + + [XmlElement("test", Namespace = "")] + public Test[] Test { get; set; } + + } + public class Test + { + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("desc")] + public string Desc { get; set; } + [XmlAttribute("testType")] + public string TestType { get; set; } + + [XmlElement("summary")] + public Summary Summary { get; set; } + + } + + public class Summary + { + [XmlElement("section")] + public Section Section { get; set; } + } + + public class Section + { + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("indentation")] + public string Indentation { get; set; } + [XmlAttribute("typeName")] + public string TypeName { get; set; } + + [XmlElement("heading")] + public XmlCDataSection[] Heading { get; set; } + + [XmlElement("desc")] + public Desc[] Desc { get; set; } + + } + + public class Desc + { + [XmlAttribute("header")] + public string Header { get; set; } + + [XmlText] + public string desc { get; set; } + } +} diff --git a/xmlserializetest/xmlserializetest.csproj b/xmlserializetest/xmlserializetest.csproj new file mode 100644 index 0000000..d401b26 --- /dev/null +++ b/xmlserializetest/xmlserializetest.csproj @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {BDDB1FFF-DFB1-44A3-86E4-355EA797758F} + WinExe + xmlserializetest + xmlserializetest + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file