private void btn_Compare_Click(object sender, EventArgs e) { try { HttpPost post = new HttpPost(); post.addPostValues("content", "GET", false); string strFeedBack = post.PostWebRequest(tbURL.Text, GlobalsConfig.defaultEncoder); if (strFeedBack.Length <= 0) { MessageBox.Show("返回数据为空,请检查URL或请求列表[-1001]"); return; } if (strFeedBack[0] != '{') { MessageBox.Show(strFeedBack); return; } //将文件1和文件2存至临时文件中 string sFileNew = TmpFileManager.createTmpFile(GlobalsConfig.defaultEncoder.GetBytes(tbContent.Text)); string sFileOld = TmpFileManager.createTmpFile(GlobalsConfig.defaultEncoder.GetBytes(strFeedBack)); CompareForm cmpForm = new CompareForm(sFileOld, sFileNew, tbURL.Text); cmpForm.ShowDialog(); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { HttpPost poster = new HttpPost(); string strNewFiles = File.ReadAllText(m_sFileNew, GlobalsConfig.defaultEncoder); poster.addPostValues("content", strNewFiles, false); string strFeedback = poster.PostWebRequest(m_sCommitURL, GlobalsConfig.defaultEncoder); if (strFeedback == "OK") { string strsuccess = "======================================\r\n" + "=\r\n= 提交成功\r\n=\r\n======================================"; MessageBox.Show(this, strsuccess); // 打开检查用网页 System.Diagnostics.Process.Start(ConfigureManager.getCheckUrl()); Close(); } else { MessageBox.Show(this, strFeedback); } } catch(Exception ex) { MessageBox.Show(ex.Message); } }