コード例 #1
0
        public void MergeYamlC()
        {
            var res = MiniYaml.MergeStrict(parentList, childList).Last();

            Assert.That(res.Key, Is.EqualTo("Child"));
            InheritanceTest(res.Value.Nodes);
        }
コード例 #2
0
ファイル: MiniYamlTest.cs プロジェクト: zhangolove/OpenRA
        public void MergeYamlA()
        {
            var a = MiniYaml.FromString(mixedMergeA, "mixedMergeA");
            var b = MiniYaml.FromString(mixedMergeB, "mixedMergeB");

            // Merge order should not matter
            // Note: All the Merge* variants are different plumbing over the same
            // internal logic.  Testing only MergeStrict is sufficent.
            TestMixedMerge(MiniYaml.MergeStrict(a, b).First().Value);
            TestMixedMerge(MiniYaml.MergeStrict(b, a).First().Value);
        }
コード例 #3
0
        public IReadOnlyDictionary <string, ISpriteSequence> ParseSequences(ModData modData, TileSet tileSet, SpriteCache cache, MiniYamlNode node)
        {
            var sequences = new Dictionary <string, ISpriteSequence>();
            var nodes     = node.Value.ToDictionary();

            MiniYaml defaults;

            if (nodes.TryGetValue("Defaults", out defaults))
            {
                nodes.Remove("Defaults");
                nodes = nodes.ToDictionary(kv => kv.Key, kv => MiniYaml.MergeStrict(kv.Value, defaults));

                foreach (var n in nodes)
                {
                    n.Value.Value = n.Value.Value ?? defaults.Value;
                }
            }

            foreach (var kvp in nodes)
            {
                using (new Support.PerfTimer("new Sequence(\"{0}\")".F(node.Key), 20))
                {
                    try
                    {
                        sequences.Add(kvp.Key, CreateSequence(modData, tileSet, cache, node.Key, kvp.Key, kvp.Value));
                    }
                    catch (FileNotFoundException ex)
                    {
                        // Eat the FileNotFound exceptions from missing sprites
                        OnMissingSpriteError(ex.Message);
                    }
                }
            }

            return(new ReadOnlyDictionary <string, ISpriteSequence>(sequences));
        }
コード例 #4
0
        public void MergeYamlA()
        {
            var res = MiniYaml.MergeStrict(parent, child);

            InheritanceTest(res.Nodes);
        }