Ejemplo n.º 1
0
        private string GetTag()
        {
            string text1 = JsonText.transfer(line1.GetJsonText());
            string text2 = JsonText.transfer(line2.GetJsonText());
            string text3 = JsonText.transfer(line3.GetJsonText());
            string text4 = JsonText.transfer(line4.GetJsonText());

            if (Cmd1.Text != "")
            {
                text1 = text1.Substring(0, text1.Length - 1) + ",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"" + Cmd1.Text + "\\\"}}";
            }
            if (Cmd2.Text != "")
            {
                text2 = text2.Substring(0, text2.Length - 1) + ",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"" + Cmd2.Text + "\\\"}}";
            }
            if (Cmd3.Text != "")
            {
                text3 = text3.Substring(0, text3.Length - 1) + ",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"" + Cmd3.Text + "\\\"}}";
            }
            if (Cmd4.Text != "")
            {
                text4 = text4.Substring(0, text4.Length - 1) + ",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"" + Cmd4.Text + "\\\"}}";
            }

            if (give.IsChecked == true || item.IsChecked == true)
            {
                return("{BlockEntityTag:{Text1:\"" + text1 + "\",Text2:\"" + text2 + "\",Text3:\"" + text3 + "\",Text4:\"" + text4 + "\"}}");
            }
            else
            {
                return("{Text1:\"" + text1 + "\",Text2:\"" + text2 + "\",Text3:\"" + text3 + "\",Text4:\"" + text4 + "\"}");
            }
        }
Ejemplo n.º 2
0
        private string GetTag()
        {
            string tit = "title:\"自定义Json书\",", aut = "author:\"author\",";

            if (title.Text != "" && title.Text != null)
            {
                tit = "title:\"" + title.Text + "\",";
            }
            if (author.Text != "" && author.Text != null)
            {
                aut = "author:\"" + author.Text + "\",";
            }
            string txt = "";

            for (int i = 0; i < pageList.Children.Count - 1; i++)
            {
                BookPage p = pageList.Children[i] as BookPage;
                txt += "\"" + JsonText.transfer(p.doc.GetJsonText()) + "\",";
            }

            return("{" + tit + aut + "pages:[" + txt.Substring(0, txt.Length - 1) + "]}");
        }