public void TestMethod1()
        {
            var a = YAMLDocument.WriteMappingsSequence(
                typeof(TestMethod1_Type),
                new TestMethod1_Type {
                Field1 = "1", Field2 = "2"
            },
                new TestMethod1_Type {
                Field1 = "3", Field2 = "4"
            }
                );

            var t = new TextField {
                multiline = true, text = a, width = 400, height = 400
            }.AttachTo(this);

            var n = (TestMethod1_Type[])
                    YAMLDocument.FromMappingsSequence(
                typeof(TestMethod1_Type), a
                );

            Trace.Assert(n[0].Field1 == "1");
            Trace.Assert(n[0].Field2 == "2");

            Trace.Assert(n[1].Field1 == "3");
            Trace.Assert(n[1].Field2 == "4");
        }
示例#2
0
        public void TestMethod1()
        {
            var a = YAMLDocument.WriteMappingsSequence(
                typeof(TestMethod1_Type),
                new TestMethod1_Type {
                Field1 = "1", Field2 = "2"
            },
                new TestMethod1_Type {
                Field1 = "3", Field2 = "4"
            }
                );

            Console.WriteLine(a);

            var n = (TestMethod1_Type[])
                    YAMLDocument.FromMappingsSequence(
                typeof(TestMethod1_Type), a
                );

            Trace.Assert(n[0].Field1 == "1");
            Trace.Assert(n[0].Field2 == "2");

            Trace.Assert(n[1].Field1 == "3");
            Trace.Assert(n[1].Field2 == "4");
        }
        public static GameReference[] FromYAML(this GameReference[] a, string data)
        {
            var z = (object[])YAMLDocument.FromMappingsSequence(typeof(GameReference), data);

            return((GameReference[])a.MergeArray(typeof(GameReference), z, GameReference.Equals));
        }