public static YAMLNode ExportYAML <T>(this IReadOnlyDictionary <T, float> _this, IExportContainer container)
            where T : IYAMLExportable
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.BlockCurve);

            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                YAMLNode        key = kvp.Key.ExportYAML(container);
                if (key.NodeType == YAMLNodeType.Scalar)
                {
                    map.Add(key, kvp.Value);
                }
                else
                {
                    map.Add("first", key);
                    map.Add("second", kvp.Value);
                }
                node.Add(map);
            }
            return(node);
        }
Example #2
0
        public static YAMLNode ExportYAMLArrayPPtr <T1, T2>(this IReadOnlyDictionary <T1, T2[]> _this, IAssetsExporter exporter)
            where T1 : IYAMLExportable
            where T2 : IYAMLExportable
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.Block);

            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                YAMLNode        key = kvp.Key.ExportYAML(exporter);
                if (key.NodeType == YAMLNodeType.Scalar)
                {
                    map.Add(key, kvp.Value.ExportYAML(exporter));
                }
                else
                {
                    map.Add("first", key);
                    map.Add("second", kvp.Value.ExportYAML(exporter));
                }
                node.Add(map);
            }
            return(node);
        }