private void run() { var path = "D:\\Desktop\\赛思\\Xrm代码片段\\XrmJS.json"; string jsonText = ""; string templateString = ""; using (StreamReader sr = new StreamReader(path)) { jsonText = sr.ReadToEnd(); } JsonData jd = JsonMapper.ToObject(jsonText); count = jd.Count; for (int i = 0; i < jd.Count; i++) { currentNo = i + 1; //MessageBox.Show(jd[i][0]["prefix"].ToString()); var lableText = string.Format("当前{0},总共{1}", currentNo, count); label1.SetPropertyThreadSafe(() => label1.Text, lableText); var snippet = string.Format(textBox1.Text, jd[i][0]["prefix"].ToString(), replaceString(getBody(jd[i][0]["body"])), replaceString(jd[i][0]["description"].ToString())); richTextBox1.SetPropertyThreadSafe(() => richTextBox1.Text, snippet); CSHelper.saveFile(snippet, jd[i][0]["prefix"].ToString(), "snippet"); } }