コード例 #1
0
 public ClipboardManager(
     [Import] Lazy <MapElementFactory> factory,
     [Import] Lazy <SerialisedObjectFormatter> formatter
     )
 {
     _factory            = factory.Value;
     _formatter          = formatter.Value;
     SizeOfClipboardRing = 10;
     Ring = new List <ClipboardEntry>();
 }
コード例 #2
0
        public void TestEscapedQuotes()
        {
            SerialisedObjectFormatter fmt = new SerialisedObjectFormatter();

            using Stream input = Streamify($@"Test
{{
    {Q}Key\{Q}With\{Q}Quotes{Q} {Q}Quoted\{Q}Value{Q}
}}
");
            List <SerialisedObject> output = fmt.Deserialize(input).ToList();

            Assert.AreEqual(1, output.Count);
            Assert.AreEqual("Test", output[0].Name);
            Assert.AreEqual(0, output[0].Children.Count);
            Assert.AreEqual(1, output[0].Properties.Count);
            Assert.AreEqual("Key\"With\"Quotes", output[0].Properties[0].Key);
            Assert.AreEqual("Quoted\"Value", output[0].Properties[0].Value);
        }
コード例 #3
0
        public void TestLoadingSimple()
        {
            SerialisedObjectFormatter fmt = new SerialisedObjectFormatter();

            using Stream input = Streamify($@"Test
{{
    {Q}Key1{Q} {Q}Value1{Q}
    {Q}Key2{Q} {Q}Value2{Q}
}}
");
            List <SerialisedObject> output = fmt.Deserialize(input).ToList();

            Assert.AreEqual(1, output.Count);
            Assert.AreEqual("Test", output[0].Name);
            Assert.AreEqual(0, output[0].Children.Count);
            Assert.AreEqual(2, output[0].Properties.Count);
            Assert.AreEqual("Key1", output[0].Properties[0].Key);
            Assert.AreEqual("Key2", output[0].Properties[1].Key);
            Assert.AreEqual("Value1", output[0].Properties[0].Value);
            Assert.AreEqual("Value2", output[0].Properties[1].Value);
        }
コード例 #4
0
        public void TestLoadingKeyOrder()
        {
            SerialisedObjectFormatter fmt = new SerialisedObjectFormatter();

            using Stream input = Streamify($@"Test
{{
    {Q}Key{Q} {Q}1{Q}
    {Q}Key{Q} {Q}3{Q}
    {Q}Key{Q} {Q}2{Q}
}}
");
            List <SerialisedObject> output = fmt.Deserialize(input).ToList();

            Assert.AreEqual(1, output.Count);
            Assert.AreEqual("Test", output[0].Name);
            Assert.AreEqual(0, output[0].Children.Count);
            Assert.AreEqual(3, output[0].Properties.Count);
            Assert.AreEqual("Key", output[0].Properties[0].Key);
            Assert.AreEqual("Key", output[0].Properties[1].Key);
            Assert.AreEqual("Key", output[0].Properties[2].Key);
            Assert.AreEqual("1", output[0].Properties[0].Value);
            Assert.AreEqual("3", output[0].Properties[1].Value);
            Assert.AreEqual("2", output[0].Properties[2].Value);
        }
コード例 #5
0
 public VmfBspSourceProvider([Import] Lazy <SerialisedObjectFormatter> formatter, [Import] Lazy <MapElementFactory> factory, [Import] Lazy <SquareGridFactory> squareGridFactory)
 {
     _formatter         = formatter.Value;
     _factory           = factory.Value;
     _squareGridFactory = squareGridFactory.Value;
 }
コード例 #6
0
 public HammerVmfFormat()
 {
     _formatter = new SerialisedObjectFormatter();
 }
コード例 #7
0
 public NativeBspSourceProvider([Import] Lazy <SerialisedObjectFormatter> formatter, [Import] Lazy <MapElementFactory> factory)
 {
     _formatter = formatter.Value;
     _factory   = factory.Value;
 }
コード例 #8
0
        public void TestLoadingChildren()
        {
            SerialisedObjectFormatter fmt = new SerialisedObjectFormatter();

            using Stream input = Streamify($@"Test1
{{
    {Q}A{Q} {Q}1{Q}
    Test2
    {{
        {Q}B{Q} {Q}2{Q}
        Test3
        {{
            {Q}C{Q} {Q}3{Q}
        }}
    }}
    Test2
    {{
    }}
    Test2
    {{
        {Q}D{Q} {Q}4{Q}
    }}
}}
Test4
{{
    {Q}E{Q} {Q}5{Q}
}}
");
            List <SerialisedObject> output = fmt.Deserialize(input).ToList();

            Assert.AreEqual(2, output.Count);

            Assert.AreEqual("Test1", output[0].Name);
            Assert.AreEqual(3, output[0].Children.Count);
            Assert.AreEqual("A", output[0].Properties[0].Key);

            Assert.AreEqual("Test2", output[0].Children[0].Name);
            Assert.AreEqual(1, output[0].Children[0].Children.Count);
            Assert.AreEqual(1, output[0].Children[0].Properties.Count);
            Assert.AreEqual("B", output[0].Children[0].Properties[0].Key);
            Assert.AreEqual("2", output[0].Children[0].Properties[0].Value);

            Assert.AreEqual("Test3", output[0].Children[0].Children[0].Name);
            Assert.AreEqual(0, output[0].Children[0].Children[0].Children.Count);
            Assert.AreEqual(1, output[0].Children[0].Children[0].Properties.Count);
            Assert.AreEqual("C", output[0].Children[0].Children[0].Properties[0].Key);
            Assert.AreEqual("3", output[0].Children[0].Children[0].Properties[0].Value);

            Assert.AreEqual("Test2", output[0].Children[1].Name);
            Assert.AreEqual(0, output[0].Children[1].Children.Count);
            Assert.AreEqual(0, output[0].Children[1].Properties.Count);

            Assert.AreEqual("Test2", output[0].Children[2].Name);
            Assert.AreEqual("D", output[0].Children[2].Properties[0].Key);
            Assert.AreEqual("4", output[0].Children[2].Properties[0].Value);

            Assert.AreEqual("Test4", output[1].Name);
            Assert.AreEqual(0, output[1].Children.Count);
            Assert.AreEqual("E", output[1].Properties[0].Key);
            Assert.AreEqual("5", output[1].Properties[0].Value);
        }