private void buttonX3_Click(object sender, EventArgs e) { string strPath = Application.StartupPath; string strFileNameRight = "ScriptRight.lua"; string strFileNameLeft = "ScriptLeft.lua"; string strFileRight = strPath + "\\" + strFileNameRight; string strFileLeft = strPath + "\\" + strFileNameLeft; StringBuilder strbComparerDir = new StringBuilder("", 255); hisItem ItemLeft = this.listBox1.SelectedItems[0] as hisItem; hisItem ItemRight = this.listBox1.SelectedItems[1] as hisItem; StringToFile(ItemLeft.Code, strFileLeft, Encoding.GetEncoding("gb2312")); StringToFile(ItemRight.Code, strFileRight, Encoding.GetEncoding("gb2312")); GetPrivateProfileString("Advance", "ComparerDir", "", strbComparerDir, 255, strPath + "\\GameDesingerTools.ini"); if (strbComparerDir.ToString() == "") { MessageBox.Show("请确定在GameDesingerTools.ini中设置 Beyond Compare 相应路径!"); } else { try { string strArgs = "\"" + strFileLeft + "\" \"" + strFileRight + "\""; Process.Start(strbComparerDir.ToString(), strArgs); } catch (Exception ex) { throw new Exception("启动 Beyond Compare 失败,请确定已经安装并且路径正确!"); } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.SelectedItems.Count == 1) { this.buttonX1.Enabled = true; this.buttonX3.Enabled = false; hisItem hi = listBox1.SelectedItem as hisItem; this.strRetCode = hi.strCode; } else if (this.listBox1.SelectedItems.Count == 2) { this.buttonX1.Enabled = false; this.buttonX3.Enabled = true; } else { this.buttonX1.Enabled = false; this.buttonX3.Enabled = false; } }
private void fillListBox(ListBox lb, string fieldid, string tabid, string curCode) { if (this.m_conn == null) { return; } SqlDb sdb = new SqlDb(); sdb.SetConnection(this.m_conn); string sql = ""; if (fieldid == "0") { sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where (fieldid is NULL or fieldid=0) and modtabid={0} order by logtime", tabid); } else { sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where fieldid={0} and modtabid={1} order by logtime", fieldid, tabid); } DataSet ds = sdb.ExeSqlDs(sql, "script"); foreach (DataRow r in ds.Tables[0].Rows) { int id = int.Parse(r["logid"].ToString().Trim()); string logtime = r["logtime"].ToString().Trim(); string reason = r["reason"].ToString().Trim(); string author = r["author"].ToString().Trim(); Byte[] ab = r["scriptcode"] as Byte[]; string strCode = ab == null? "" : Encoding.UTF8.GetString(ab); hisItem hi = new hisItem(id, logtime, strCode, reason, author); lb.Items.Add(hi); } hisItem hi1 = new hisItem(curCode); lb.Items.Add(hi1); }
private void fillListBox(ListBox lb, string fieldid, string tabid, string curCode) { if (this.m_conn == null) return; SqlDb sdb = new SqlDb(); sdb.SetConnection(this.m_conn); string sql = ""; if(fieldid == "0") { sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where (fieldid is NULL or fieldid=0) and modtabid={0} order by logtime", tabid); } else { sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where fieldid={0} and modtabid={1} order by logtime", fieldid, tabid); } DataSet ds = sdb.ExeSqlDs(sql, "script"); foreach (DataRow r in ds.Tables[0].Rows) { int id = int.Parse(r["logid"].ToString().Trim()); string logtime = r["logtime"].ToString().Trim(); string reason = r["reason"].ToString().Trim(); string author = r["author"].ToString().Trim(); Byte[] ab = r["scriptcode"] as Byte[]; string strCode = ab == null? "" : Encoding.UTF8.GetString(ab); hisItem hi = new hisItem(id, logtime, strCode, reason, author); lb.Items.Add(hi); } hisItem hi1 = new hisItem(curCode); lb.Items.Add(hi1); }