1st commit

This commit is contained in:
2024-03-22 01:35:19 +01:00
parent b224604cd1
commit cd53574fba
18 changed files with 1334 additions and 0 deletions

25
xmlserializetest.sln Normal file
View File

@@ -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

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

113
xmlserializetest/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,113 @@

namespace xmlserializetest
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

208
xmlserializetest/Form1.cs Normal file
View File

@@ -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<Result> docs = new List<Result>();
List<Res> groupData = new List<Res>();
List<Res> pinData = new List<Res>();
List<string> groups = new List<string>();
List<string> pins = new List<string>();
List<string> tests = new List<string>();
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<Res> 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<string> GetGroups (Result doc)
{
List<string> groups = new List<string>();
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<string> GetPinsFromGroups(Result doc)
{
List<string> pins = new List<string>();
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<string> tests = new List<string>();
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<string> tests = new List<string>();
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();
}
}
}

120
xmlserializetest/Form1.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -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")]

View File

@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace xmlserializetest.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

107
xmlserializetest/Res.cs Normal file
View File

@@ -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; }
}
}

138
xmlserializetest/Result.cs Normal file
View File

@@ -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<Res> GetResultsByTestNameAndGroups(List<string> testnames, List<string> groupnames)
{
List<Res> results = new List<Res>();
foreach (var res in this.Res)
{
if ((testnames.Contains(res.dO) ) & (groupnames.Contains(res.pG) ))
{
results.Add(res);
}
}
return results;
}
public List<Res> GetResultsByTestNameAndPins(List<string> testnames, List<string> pinnames)
{
List<Res> results = new List<Res>();
foreach (var res in this.Res)
{
if ((testnames.Contains(res.dO)) & (pinnames.Contains(res.pin)))
{
results.Add(res);
}
}
return results;
}
}
}

44
xmlserializetest/Table.cs Normal file
View File

@@ -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;
}
}

62
xmlserializetest/Tests.cs Normal file
View File

@@ -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; }
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BDDB1FFF-DFB1-44A3-86E4-355EA797758F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>xmlserializetest</RootNamespace>
<AssemblyName>xmlserializetest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Groups.cs" />
<Compile Include="MetaData.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Res.cs" />
<Compile Include="Result.cs" />
<Compile Include="Table.cs" />
<Compile Include="Tests.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>