コード例 #1
0
        public static YAMLNode ExportYAML(this IEnumerable <int> _this, bool isRaw)
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = isRaw ? SequenceStyle.Raw : SequenceStyle.Block;
            foreach (int value in _this)
            {
                node.Add(value);
            }
            return(node);
        }
コード例 #2
0
        public static YAMLNode ExportYAML(this IEnumerable <byte> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = SequenceStyle.Raw;
            foreach (byte value in _this)
            {
                node.Add(value);
            }
            return(node);
        }
コード例 #3
0
        public static YAMLNode ExportYAML(this IEnumerable <IYAMLExportable> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = SequenceStyle.Block;
            foreach (IYAMLExportable export in _this)
            {
                node.Add(export.ExportYAML());
            }
            return(node);
        }
コード例 #4
0
        public static YAMLNode ExportYAML(this IEnumerable <string> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = SequenceStyle.Block;
            foreach (string value in _this)
            {
                node.Add(value);
            }
            return(node);
        }
コード例 #5
0
        public static YAMLNode ExportYAML(this IEnumerable <float> _this)
        {
#warning TODO: check
            //throw new NotImplementedException();
            YAMLSequenceNode node = new YAMLSequenceNode();
            node.Style = SequenceStyle.Block;
            foreach (float value in _this)
            {
                node.Add(value);
            }
            return(node);
        }
コード例 #6
0
        public static YAMLNode ExportYAML(this IReadOnlyDictionary <uint, string> _this)
        {
#warning TODO: check
            YAMLSequenceNode node = new YAMLSequenceNode();
            node.Style = SequenceStyle.Block;
            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                map.Add(kvp.Key.ToString(), kvp.Value);
                node.Add(map);
            }
            return(node);
        }
コード例 #7
0
        public static YAMLNode ExportYAML(this IReadOnlyDictionary <string, float> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = SequenceStyle.Block;
            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                map.Add(kvp.Key, kvp.Value);
                node.Add(map);
            }
            return(node);
        }
コード例 #8
0
        public static YAMLNode ExportYAML <T>(this IReadOnlyDictionary <T, float> _this)
            where T : IYAMLExportable
        {
            YAMLSequenceNode node = new YAMLSequenceNode();

            node.Style = SequenceStyle.Block;
            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                YAMLNode        key = kvp.Key.ExportYAML();
                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);
        }