Example #1
0
        public static YAMLNode ExportYAML(this IEnumerable <IEnumerable <string> > _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.Block);

            foreach (IEnumerable <string> export in _this)
            {
                node.Add(export.ExportYAML());
            }
            return(node);
        }
Example #2
0
        public static YAMLNode ExportYAML(this IEnumerable <string> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.Block);

            foreach (string value in _this)
            {
                node.Add(value);
            }
            return(node);
        }
        public static YAMLNode ExportYAML(this IReadOnlyDictionary <string, float> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.BlockCurve);

            foreach (var kvp in _this)
            {
                YAMLMappingNode map = new YAMLMappingNode();
                map.Add(kvp.Key, kvp.Value);
                node.Add(map);
            }
            return(node);
        }
        public static YAMLNode ExportYAML <T>(this IReadOnlyDictionary <Tuple <T, long>, string> _this, Func <T, int> converter)
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.BlockCurve);

            foreach (var kvp in _this)
            {
                YAMLMappingNode keyNode = new YAMLMappingNode();
                keyNode.Add(converter(kvp.Key.Item1), kvp.Key.Item2);
                YAMLMappingNode kvpMap = new YAMLMappingNode();
                kvpMap.Add("first", keyNode);
                kvpMap.Add("second", kvp.Value);
                node.Add(kvpMap);
            }
            return(node);
        }
        public static YAMLNode ExportYAML(this IReadOnlyDictionary <Tuple <ushort, ushort>, float> _this)
        {
            YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.BlockCurve);

            foreach (var kvp in _this)
            {
                YAMLMappingNode keyNode = new YAMLMappingNode();
                keyNode.Add(kvp.Key.Item1, kvp.Key.Item2);
                YAMLMappingNode kvpMap = new YAMLMappingNode();
                kvpMap.Add("first", keyNode);
                kvpMap.Add("second", kvp.Value);
                node.Add(kvpMap);
            }
            return(node);
        }
Example #6
0
 public static YAMLNode ExportYAML(this IEnumerable <uint> _this, bool isRaw)
 {
     if (isRaw)
     {
         StringBuilder sb = new StringBuilder();
         foreach (uint value in _this)
         {
             sb.AppendHex(value);
         }
         return(new YAMLScalarNode(sb.ToString()));
     }
     else
     {
         YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.Block);
         foreach (uint value in _this)
         {
             node.Add(value);
         }
         return(node);
     }
 }
 public static YAMLNode ExportYAML(this IReadOnlyList <short> _this, bool isRaw)
 {
     if (isRaw)
     {
         StringBuilder sb = new StringBuilder(_this.Count * 4);
         foreach (short value in _this)
         {
             sb.AppendHex(value);
         }
         return(new YAMLScalarNode(sb.ToString(), true));
     }
     else
     {
         YAMLSequenceNode node = new YAMLSequenceNode(SequenceStyle.Block);
         foreach (short value in _this)
         {
             node.Add(value);
         }
         return(node);
     }
 }