Ejemplo n.º 1
0
        private Panel CreateJSONNodeGroupBox(JSONNode n, Panel parent)
        {
            Panel rtn = new Panel()
            {
                Height   = 0,
                AutoSize = true,
                Parent   = parent,
                Tag      = n,
                Padding  = new Padding(0, 0, 0, 0)
            };

            //rtn.Click += PanelBoxClick;
            rtn.BackColor = FormConstValue.baseColor;

            int nowY = 2;

            if (n is JSONObject)
            {
                JSONObject o    = (JSONObject)n;
                string[]   keys = o.GetAllKeys();
                foreach (string s in keys)
                {
                    nowY = CreateGroupChild(o[s], s, rtn, nowY, true);
                }
            }
            else
            {
                for (int i = 0; i < n.Count; ++i)
                {
                    nowY = CreateGroupChild(n[i], i + "", rtn, nowY, false);
                }
            }

            return(rtn);
        }
Ejemplo n.º 2
0
        private JSONNode MakeTemplateObjectList(JSONNode n, int depth)
        {
            string intend = "";

            for (int i = 0; i < depth; ++i)
            {
                intend += "  ";
            }
            if (n.type == Parser.State.JSONType.Array)
            {
                TemplateObjectList.Items.Add(intend + "배열");
                return(null);
            }
            JSONObject o = (JSONObject)n;

            string[] keys = o.GetAllKeys();
            foreach (string k in keys)
            {
                TemplateObjectList.Items.Add(intend + k + " : " + Parser.State.JSONTypeFunc.GetTypeString(o[k].type));
                if (o[k].type == Parser.State.JSONType.Array || o[k].type == Parser.State.JSONType.Object)
                {
                    MakeTemplateObjectList(o[k], depth + 1);
                }
            }
            return(null);
        }