using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO.Compression;
[XmlRoot(ElementName = "export")]
public partial class SchematicExport
public const string version = "D";
[XmlAttribute("version")]
[System.ComponentModel.Browsable(false), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never), System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public string Version { get { return version; } set { } }
public Design design { get; set; }
[XmlArrayItem(typeof(Component), ElementName = "comp")]
public List<Component> components;
[XmlArrayItem(typeof(LibPart), ElementName = "libpart")]
public List<LibPart> libparts;
[XmlArrayItem(typeof(Library), ElementName = "library")]
public List<Library> libraries;
[XmlArrayItem(typeof(Net), ElementName = "net")]
public partial class SchematicExport
public string source { get; set; }
get => _date.ToString("dd/MM/yyyy HH:mm:ss");
set => _date = DateTime.Parse(value);
public string tool { get; set; }
public List<Sheet> sheets { get; }
public int number { get; set; }
public string name { get; set; }
public string tstamps { get; set; }
public TitleBlock title_block { get; set; }
public string title { get; set; }
public string company { get; set; }
public string rev { get; set; }
get => _date.ToString("yyyy-MM-dd");
set => _date = DateTime.Parse(value);
public string source { get; set; }
public List<Comment> comments;
public Comment(int number, string value) : this()
comments = new List<Comment>();
public TitleBlock(string title, string company, string rev, string date, string source)
title_block = new TitleBlock();
tstamps = DateTime.Now.ToFileTime().ToString("X8");
public Sheet(int number, string name) : this()
sheets = new List<Sheet>();
public Design(string source, string date, string tool) : this()
public string reference { get; set; }
public string value { get; set; }
public string footprint { get; set; }
[XmlArrayItem(typeof(Field), ElementName = "field")]
public List<Field> fields;
public LibSource libsource { get; set; }
public SheetPath sheetpath { get; set; }
public string tstamp { get; set; }
public string lib { get; set; }
public string part { get; set; }
public string description { get; set; }
public string names { get; set; }
public string tstamps { get; set; }
fields = new List<Field>();
libsource = new LibSource();
sheetpath = new SheetPath();
tstamp = DateTime.Now.ToFileTime().ToString("X8");
public Component(string reference, string value, string footprint) : this()
this.reference = reference;
this.footprint = footprint;
public string lib { get; set; }
public string part { get; set; }
[XmlArrayItem(typeof(Field), ElementName = "field")]
public List<Field> fields;
[XmlArrayItem(typeof(string), ElementName = "fp")]
public List<string> footprints;
[XmlArrayItem(typeof(Pin), ElementName = "pin")]
public string num { get; set; }
public string name { get; set; }
public string type { get; set; }
public Pin(string num, string name, string type) : this()
fields = new List<Field>();
footprints = new List<string>();
public LibPart(string lib, string part) : this()
public string logical { get; set; }
public string uri { get; set; }
public Library(string logical, string uri) : this()
public string code { get; set; }
public string name { get; set; }
public string reference { get; set; }
public string pin { get; set; }
public Node(string reference, string pin) : this()
this.reference = reference;
nodes = new List<Node>();
public Net(string code, string name) : this()
public string name { get; set; }
public string value { get; set; }
public Field(string name, string value) : this()
components = new List<Component>();
libparts = new List<LibPart>();
libraries = new List<Library>();
public void Serialze(string filename)
XmlSerializer _xmlSerializer = new XmlSerializer(typeof(SchematicExport));
using (var _textWriter = new StreamWriter(filename))
_xmlSerializer.Serialize(_textWriter, this);
public static SchematicExport Create(string filename)
if (!System.IO.File.Exists(filename))
throw new Exception("File not existing");
SchematicExport _schematicExport = null;
XmlSerializer _serializer = new XmlSerializer(typeof(SchematicExport));
StreamReader _reader = new StreamReader(filename);
_schematicExport = (SchematicExport)_serializer.Deserialize(_reader);
public static void Test()
var filename = "Question55031869.xml";
var root = new SchematicExport();
Console.WriteLine(File.ReadAllText(filename));
public static void Main()
Console.WriteLine("Roslyn 2.0 Compiler; Environment version: " + Environment.Version);
Console.WriteLine("Uncaught exception: ");