void V_Data_E_CellClicked(object sender, FormAdders.EasyGridViewCollections.CellClickEventArgs e) { if (e.RowIndex < 0 || e.ColIndex < 0) { return; } String packetName = (V_Data.GetCell(e.RowIndex, 1).Value as String); if (e.ColIndex == (int)Titles.edit_button) //edit msg { CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct; cp.MakeMsgText(); //cp.MakeMsg(); String msgFile = _packetDir + "\\" + packetName + "\\Msg.txt"; DlgMsgMaker msgMaker = new DlgMsgMaker(cp, msgFile, _endian == Endians.Big); msgMaker.Location = this.Location; msgMaker.ShowDialog(); cp.MakePacket(_endian == Endians.Big); //cp.MakeMsg();//다시 메시지를 만들어준다. } else if (e.ColIndex == (int)Titles.send) //send msg { CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct; cp.MakePacket(_endian == Endians.Big); _sendFunc(cp.PacketBuffer, 0, cp.PacketDataSize, cp); ReleaseSelections(); V_Data.Rows[e.RowIndex].RowBackMode = FormAdders.EasyGridViewCollections.RowBackModes.Red; } else//내용보기 { V_Contents.RelativeObject["name"] = packetName; CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct; viewContent(cp); } }
void V_Data_E_TextChanged(object sender, FormAdders.CellTextChangedEventArgs e) { if (e.ColIndex == (int)Titles.name)//name change { if (Directory.Exists(_packetDir + "\\" + e.Text)) { MessageBox.Show("이미 같은 이름을 가진 메시지가 존재합니다. 다른이름으로 해 주세요."); e.IsCancel = true; return; } try { Directory.Move(_packetDir + "\\" + e.BeforeText, _packetDir + "\\" + e.Text); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.ToString()); e.IsCancel = true; return; } } else if (e.ColIndex == (int)Titles.comment)//comment change { String commentFile = _packetDir + "\\" + (V_Data.GetCell(e.RowIndex, 1).Value as String) + "\\Comment.txt"; File.WriteAllText(commentFile, e.Text); } //saveNameList(); }
void V_Data_E_CellClicked(object sender, FormAdders.EasyGridViewCollections.CellClickEventArgs e) { if (e.ColIndex == (int)Titles.edit_button) //edit msg { CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct; cp.MakeMsgText(); String msgFile = _packetDir + "\\" + (V_Data.GetCell(e.RowIndex, 1).Value as String) + "\\Msg.txt"; DlgMsgMaker msgMaker = new DlgMsgMaker(cp, msgFile, _endian == Endians.Big); msgMaker.Location = this.Location; msgMaker.ShowDialog(); } else if (e.ColIndex == (int)Titles.send) //send msg { CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct; cp.MakePacket(_endian == Endians.Big); _sendFunc(cp.PacketBuffer, 0, cp.PacketDataSize, cp.SimpleText); ReleaseSelections(); V_Data.Rows[e.RowIndex].RowBackMode = FormAdders.EasyGridViewCollections.RowBackModes.Red; } }
void V_Data_E_TextChanged(object sender, FormAdders.CellTextChangedEventArgs e) { if (e.ColIndex == (int)Titles.name)//name change { if (Directory.Exists(_packetDir + "\\" + e.Text)) { MessageBox.Show("이미 같은 이름을 가진 메시지가 존재합니다. 다른이름으로 해 주세요."); e.IsCancel = true; return; } try { Directory.Move(_packetDir + "\\" + e.BeforeText, _packetDir + "\\" + e.Text); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.ToString()); e.IsCancel = true; return; } if (_modifiedItems.ContainsKey(e.BeforeText)) { _modifiedItems.Add(e.Text, _modifiedItems[e.BeforeText]); _modifiedItems.Remove(e.BeforeText); } } else if (e.ColIndex == (int)Titles.comment)//comment change { String commentFile = _packetDir + "\\" + (V_Data.GetCell(e.RowIndex, 1).Value as String) + "\\Comment.txt"; File.WriteAllText(commentFile, e.Text); int itemIndex = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.itemIndex.ToString()]; int valueIndex = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.valueIndex.ToString()]; CPacketStruct parser = V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.parser.ToString()] as CPacketStruct; parser.Infos.Comment = e.Text; String name = (V_Data.GetCell(e.RowIndex, 1).Value as String); _modifiedItems[name] = parser; } //saveNameList(); }
bool DeleteLine(int rowIndex, bool isConfirm = true) { String name = V_Data.GetCell(rowIndex, (int)Titles.name).Value as String; if (isConfirm) { DialogResult result = MessageBox.Show("[" + name + "] 을 진짜 지울까요?", "삭제확인", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.No) { return(false); } } String dir = _packetDir + "\\" + name; String newDir = _packetDir + "\\Backups\\" + name; if (Directory.Exists(_packetDir + "\\Backups") == false) { Directory.CreateDirectory(_packetDir + "\\Backups"); } if (Directory.Exists(newDir)) { newDir += DateTime.Now.ToString("yyyyMMdd_HHmmss"); } try { Directory.Move(dir, newDir); } catch (Exception ex) { MessageBox.Show("문제가 있어서 삭제하지 못했습니다. 다음의 메시지를 확인해주세요." + ex.Message); return(false); } return(true); }