static void Main(string[] args) { Console.WriteLine("Hello World!"); Common common = new Common() { B = 30 }; NodeReflection reflection = new NodeReflection(); Node node = reflection.GetReflectNode(common); Debug.WriteLine(node.ToString()); Common result = reflection.CreateObject <Common>(node); Debug.WriteLine("value {0} {1} {2}", result.A, result.B, result.C); string xml = "<?xml version=\"1.0\"?><name>value</name>"; XmlPacker packer = new XmlPacker(); packer.IgnoreWhitespace = true; packer.Parse(node); string packed = packer.ToString(); Debug.WriteLine(packed); }
public void SaveAndReload() { commonClass = new Common() { A = 30, B = 10.5f }; NodeReflection reflection = new NodeReflection(); Node node = reflection.GetReflectNode(commonClass); Assert.AreEqual((int)node["A"].Value.Value, 30); Assert.AreEqual((float)node["B"].Value.Value, 10.5f); Common result = reflection.CreateObject <Common>(node); Assert.AreEqual(result.A, commonClass.A); Assert.AreEqual(result.B, commonClass.B); }