Exemplo n.º 1
0
        public TarsDisplayer Display <K, V>(Dictionary <K, V> map, string fieldName)
        {
            Indention(fieldName);
            if (map == null)
            {
                sb.Append("null").Append('\n');
                return(this);
            }
            if (map.Count == 0)
            {
                sb.Append(map.Count).Append(", {}").Append('\n');
                return(this);
            }

            sb.Append(map.Count).Append(", {").Append('\n');
            TarsDisplayer jd1 = new TarsDisplayer(sb, level + 1);
            TarsDisplayer jd2 = new TarsDisplayer(sb, level + 2);

            foreach (KeyValuePair <K, V> pair in map)
            {
                jd1.Display('(', null);
                jd2.Display(pair.Key, null);
                jd2.Display(pair.Value, null);
                jd1.Display(')', null);
            }
            Display('}', null);
            return(this);
        }
Exemplo n.º 2
0
        public TarsDisplayer Display <K, V>(Dictionary <K, V> m, string fieldName)
        {
            ps(fieldName);
            if (null == m)
            {
                sb.Append("null").Append('\n');
                return(this);
            }
            if (m.Count == 0)
            {
                sb.Append(m.Count).Append(", {}").Append('\n');
                return(this);
            }
            sb.Append(m.Count).Append(", {").Append('\n');
            TarsDisplayer jd1 = new TarsDisplayer(sb, _level + 1);
            TarsDisplayer jd  = new TarsDisplayer(sb, _level + 2);

            foreach (KeyValuePair <K, V> en in m)
            {
                jd1.Display('(', null);
                jd.Display(en.Key, null);
                jd.Display(en.Value, null);
                jd1.Display(')', null);
            }
            Display('}', null);
            return(this);
        }
Exemplo n.º 3
0
        public TarsDisplayer Display(int[] array, string fieldName)
        {
            Indention(fieldName);
            if (array == null)
            {
                sb.Append("null").Append('\n');
                return(this);
            }
            if (array.Length == 0)
            {
                sb.Append(array.Length).Append(", []").Append('\n');
                return(this);
            }
            sb.Append(array.Length).Append(", [").Append('\n');
            TarsDisplayer jd = new TarsDisplayer(sb, level + 1);

            foreach (int i in array)
            {
                jd.Display(i, null);
            }
            Display(']', null);
            return(this);
        }
Exemplo n.º 4
0
        public TarsDisplayer Display <T>(T[] v, string fieldName)
        {
            ps(fieldName);
            if (null == v)
            {
                sb.Append("null").Append('\n');
                return(this);
            }
            if (v.Length == 0)
            {
                sb.Append(v.Length).Append(", []").Append('\n');
                return(this);
            }
            sb.Append(v.Length).Append(", [").Append('\n');
            TarsDisplayer jd = new TarsDisplayer(sb, _level + 1);

            foreach (T o in v)
            {
                jd.Display(o, null);
            }
            Display(']', null);
            return(this);
        }