private void listenfromLicenseServer() { try { int buffersize = 0; byte[] msgbuffer; byte[] buffer = new byte[55600]; int buffercount = sock.Receive(buffer); logWriter("수신! : " + buffercount.ToString() + " bytes"); EndPoint ep = sock.RemoteEndPoint; IPEndPoint statiep = (IPEndPoint)ep; logWriter("sender IP : " + statiep.Address.ToString()); logWriter("sender port : " + statiep.Port.ToString()); if (buffer != null && buffer.Length != 0) { msgbuffer = new byte[buffercount]; for (int i = 0; i < buffercount; i++) { msgbuffer[i] = buffer[i]; } string msg = Encoding.UTF8.GetString(msgbuffer); msg = msg.Trim(); logWriter("수신메시지 : " + msg); stringDele dele = new stringDele(disposeLicenseResult); Invoke(dele, msg); } } catch (Exception ex) { logWriter(ex.ToString()); } }
private void btn_confirm_MouseClickForAdd(object sender, MouseEventArgs e) { try { string pass = checkpass.tbx_pass.Text.Trim(); //grant&password&comcd&comName&expiredate string reqMessage = "grant&" + pass + "&" + addcompany.tbx_code.Text + "&" + addcompany.tbx_name.Text + "&" + addcompany.tbx_expire.Text; stringDele dele = new stringDele(sendRequest); Invoke(dele, reqMessage); } catch (Exception ex) { logWriter(ex.ToString()); } }
/// <summary> /// 파일에서 라이센스정보를 읽어, 유효성검사를 한다. /// </summary> private void registerLicenseInfo() { try { LogWrite("라이선스 체크중....."); mLicenseHandler = new LicenseHandler(ConstDef.APP_DATA_CONFIG_DIR); mLicenseHandler.LogWriteHandler += this.OnLogWrite; //파일읽음&라이센스값 decode if (mLicenseHandler.ReadLicense()) { stringDele dele = new stringDele(disposeLicenseResult); Invoke(dele, mLicenseHandler.ResultMessage); } } catch (Exception ex) { LogWrite(ex.ToString()); } }
private void StripMn_busy_Click(object sender, EventArgs e) { stringDele dele = new stringDele(changeMyStat); Invoke(dele, "통화중"); string statmsg = "20|" + this.myid + "|busy"; SendMsg(statmsg, server); }
private void StripMn_logout_Click(object sender, EventArgs e) { stringDele dele = new stringDele(changeMyStat); Invoke(dele, "오프라인 표시"); string statmsg = "20|" + this.myid + "|logout"; SendMsg(statmsg, server); }
/// <summary> /// 수신된 메시지를 분석하여 각 요청에 맞게 처리 /// </summary> /// <param name="obj">ArrayList로 형변환할 Object</param> protected void MsgFilter(object obj, IPEndPoint iep) { try { string msg = ((string)obj).Trim(); //수신 메시지 string tempFormKey; string[] tempMsg = msg.Split('|'); string code = tempMsg[0]; switch (code) { #region //일반메신저기능 case "f"://로그인 실패시(f|n or p) try { FormTextCtrlDelegate informationMsg = new FormTextCtrlDelegate(ShowMessageBox); if (tempMsg[1].Equals("n")) { Invoke(informationMsg, "등록되지 않은 사용자 입니다."); } else Invoke(informationMsg, "비밀번호가 틀렸습니다."); Loginfail fail = new Loginfail(logInFail); Invoke(fail, null); } catch (Exception e) { }; break; case "g": //로그인 성공시 (g|name|team|company|com_cd) connected = true; stringDele changeProgressStyle = new stringDele(chageProgressbar); Invoke(changeProgressStyle, "로딩중"); //MiniCTI config 파일 설정 FileInfo tempfileinfo = new FileInfo(XmlConfigFullPath);//"C:\\MiniCTI\\config\\MiniCTI_config_demo.xml"); if (!tempfileinfo.Exists) { logWrite("MiniCTI config 파일 없음"); FileInfo temp = new FileInfo(XmlConfigOrgFullPath);//Application.StartupPath + "\\MiniCTI_config_demo.xml"); temp.CopyTo(tempfileinfo.FullName); } setCRM_DB_HOST(XmlConfigFullPath, serverIP);//"c:\\MiniCTI\\config\\MiniCTI_config_demo.xml", serverIP); //서버측에서 전달된 이름 저장 myname = tempMsg[1]; myid = this.id.Text; com_cd = tempMsg[4]; logWrite("로그인 성공! (" + DateTime.Now.ToString() + ")"); //개인 정보를 Client_Form 에 표시 FormTextCtrlDelegate FlushName = new FormTextCtrlDelegate(FlushInfo); FormTextCtrlDelegate FlushTeam = new FormTextCtrlDelegate(Flushteam); Invoke(FlushName, tempMsg[1]); if (tempMsg[2].Length > 0) { Invoke(FlushTeam, tempMsg[2]); } else { Invoke(FlushTeam, tempMsg[3]); } //화면의 모든 콘트롤에 keydown이벤트설정 this.KeyDown += new KeyEventHandler(Client_Form_KeyDown); int count = this.Controls.Count; for (int i = 0; i < count; i++) { this.Controls[i].KeyDown += new KeyEventHandler(Client_Form_KeyDown); } //쪽지 및 대화 저장 폴더, 파일 생성 MemoUtils.MemoFileCheck(this.myid); DialogFileCheck(); FileDirCheck(); if (checkThread == null) { checkThread = new Thread(new ThreadStart(SendCheck)); checkThread.Start(); logWrite("SendCheck 스레드 시작"); } break; case "M": //다른 클라이언트 목록 및 접속상태 정보(M|팀이름|id!멤버이름|id!멤버이름) if (tempMsg[1].Equals("e")) { //모든 팀트리 정보 전송완료 메시지일 경우 -> Client_Form을 로그인 상태로 하위 구성요소를 활성화 한다. PanelCtrlDelegate loginPanel = new PanelCtrlDelegate(LogInPanelVisible); //로그인 패널 컨트롤 호출용 PanelCtrlDelegate TreeViewPanel = new PanelCtrlDelegate(TreeViewVisible); //memTreeView 컨트롤호출용 PanelCtrlDelegate btnCtrl = new PanelCtrlDelegate(ButtonCtrl);//각종 버튼 컨트롤호출용 Invoke(TreeViewPanel, true); // 버튼 활성화 Invoke(btnCtrl, true); //tooltip 설정 tooltip.AutoPopDelay = 0; tooltip.AutomaticDelay = 2000; tooltip.InitialDelay = 100; Invoke(loginPanel, false); //crm 프로그램 실행 Thread thread = new Thread(new ThreadStart(SetUserInfo)); thread.Start(); //NoParamDele dele = new NoParamDele(SetUserInfo); //Invoke(dele); } else { // 팀트리 정보를 수신한 경우 ArrayList list = new ArrayList(); if (tempMsg.Length > 2) { string teamName = tempMsg[1]; for (int i = 2; i < tempMsg.Length; i++) {//배열 순서 2번째 부터인 id!name을 추출 if (tempMsg[i].Length != 0) { list.Add(tempMsg[i]); string[] memInfo = tempMsg[i].Split('!'); //<id>와 <name>을 분리하여 memInfo에 저장 MemberInfoList[memInfo[0]] = memInfo[1]; //key=id, value=name logWrite("MemberInfoList[" + memInfo[0] + "] = " + memInfo[1]); //다른 상담원의 <소속>과 <id>를 hashtable에 저장(key=id, value=소속) if (teamName.Trim() == "") { //소속이 미지정인 경우 teamName = MsgrMsg.UNDEFINED_TEAM; } TeamInfoList[memInfo[0]] = teamName; logWrite("TeamInfoList[" + memInfo[0] + "] = " + teamName); //logWrite("사용자 정보 등록 : 이름(" + memInfo[1] + ") 아이디(" + memInfo[0] + ")"); } } ChildNodeDelegate AddMemNode = new ChildNodeDelegate(MakeMemTree); object[] ar = { teamName, list }; Invoke(AddMemNode, ar); treesource[teamName] = list; memTree.Tag = treesource; logWrite(teamName + " 팀 리스트 생성!"); //델리게이트 생성 } } break; case "y": //로그인 Client 리스트 y|id|상태값 string team = (string)TeamInfoList[tempMsg[1]]; int Port = 8883; logWrite("팀 : "+team+" 사용자 id : " + tempMsg[1] + " port : " + Port.ToString()); //InList[tempMsg[1]] = server; //로그인 리스트 테이블에 저장(key=id, value=IPEndPoint) ChangeStat changelogin = new ChangeStat(ChangeMemStat); Invoke(changelogin, new object[] { tempMsg[1], tempMsg[2] }); break; case "IP": //로그인 Client 리스트 IP|id|ip주소 Port = 8883; logWrite(" 사용자 id : " + tempMsg[1] + "IP 주소 : " + tempMsg[2] + " port : " + Port.ToString()); InList[tempMsg[1]] = new IPEndPoint(IPAddress.Parse(tempMsg[2]), Port); //로그인 리스트 테이블에 저장(key=id, value=IPEndPoint) break; case "a": //중복로그인 시도를 알려줌 Loginfail relogin = new Loginfail(ReLogin); Invoke(relogin, null); break; case "u": //서버측에서 강제 로그아웃 메시지 수신한 경우 LogOutDelegate logoutDel = new LogOutDelegate(LogOut); Invoke(logoutDel, null); break; case "d": //상대방 대화메시지일 경우 (d|Formkey|id/id/...|name|메시지) tempFormKey = ChatUtils.GetFormKey(tempMsg[1], myid); string[] ids = tempMsg[2].Split('/'); if (!ids[0].Equals(myid)) { if (ChatFormList.Contains((string)tempFormKey) && ChatFormList[(string)tempFormKey] != null) { //이미 발신자와 채팅중일 경우 ChatForm form = (ChatForm)ChatFormList[(string)tempFormKey]; AddChatMsgDelegate addMsg = new AddChatMsgDelegate(form.PostUserMessage); Invoke(addMsg, new object[] { ids[0], tempMsg[3], tempMsg[4] });//id/id... 첫번째가 문자올린 대화자 //if() 사용자 상태에 따라 //form.Activate(); } else { //새로운 대화요청일 경우, 대화창 생성 ArrangeCtrlDelegate OpenChatForm = new ArrangeCtrlDelegate(NewChatForm); Invoke(OpenChatForm, new object[] { tempMsg }); } } break; case "c": //c|formkey|id/id/..|name //대화중 초대가 일어난 경우 { tempFormKey = ChatUtils.GetFormKey(tempMsg[1], myid); ChatForm form = (ChatForm)ChatFormList[(string)tempFormKey]; if (form != null) { string[] addedIdArray = tempMsg[2].Split('/'); AddChatterDelegate addChatter = new AddChatterDelegate(form.AddChatterToNode); foreach (string addedId in addedIdArray) { UserObject userObj = ChatUtils.FindUserObjectTagFromTreeNodes(memTree.Nodes, addedId); Invoke(addChatter, new object[] { userObj }); } string newFormKey = ChatUtils.GetFormKeyWithMultiUsersAdded(tempFormKey, myid, tempMsg[2]); SetChatFormKeyUpdate(form, newFormKey, tempFormKey); } else { logWrite(string.Format("'c' key[{0}]를 갖는 채팅창이 존재하지 않음.", tempFormKey)); } } break; case "C": //보낸공지 읽음확인 수신(C|확인자id|noticeid) ArrangeCtrlDelegate NoticeDetailResultFormAdd = new ArrangeCtrlDelegate(NoticeReaderAdd); Invoke(NoticeDetailResultFormAdd, new object[] { tempMsg }); break; case "q": //다자 대화중 상대방이 대화창 나감 (q|Formkey|id) { tempFormKey = ChatUtils.GetFormKey(tempMsg[1], myid); ChatForm form = (ChatForm)ChatFormList[(string)tempFormKey]; if (form != null) { //노드삭제 DelChatterDelegate delchatter = new DelChatterDelegate(form.DeleteChatter); Invoke(delchatter, new object[] { tempMsg[2], GetUserName(tempMsg[2]) }); //formkey 변경 string newFormKey = ChatUtils.GetFormKeyWithUserQuit(tempFormKey, myid, tempMsg[2]); SetChatFormKeyUpdate(form, newFormKey, tempFormKey); } else { logWrite(string.Format("'q' key[{0}]를 갖는 채팅창이 존재하지 않음.", tempFormKey)); } } break; case "dc": //다자 대화중 상대방이 연결 끊김 (dc|Formkey|id) { tempFormKey = ChatUtils.GetFormKey(tempMsg[1], myid); ChatForm form = (ChatForm)ChatFormList[(string)tempFormKey]; if (form != null) { //노드삭제 DelChatterDelegate delchatter = new DelChatterDelegate(form.DeleteChatter); Invoke(delchatter, new object[] { tempMsg[2], GetUserName(tempMsg[2]) }); //formkey 변경 string newFormKey = ChatUtils.GetFormKeyWithUserQuit(tempFormKey, myid, tempMsg[2]); SetChatFormKeyUpdate(form, newFormKey, tempFormKey); } else { logWrite(string.Format("'dc' key[{0}]를 갖는 채팅창이 존재하지 않음.", tempFormKey)); } } break; case "m"://메모를 수신한 경우 m|name|id|message|수신자id ArrangeCtrlDelegate memo = new ArrangeCtrlDelegate(MakeMemo); Invoke(memo, new object[] { tempMsg }); MemoUtils.MemoFileWrite(this.myid, msg + "|" + DateTime.Now.ToString()); break; #endregion //일반메신저기능 case "F": //파일받기전 파일 정보 수신 F|파일명|파일크기|파일key|전송자id string name = GetUserName(tempMsg[4]); string[] filenameArray = tempMsg[1].Split('\\'); //파일명 추출 int filesize = int.Parse(tempMsg[2]); //파일크기 캐스팅 IPEndPoint siep = (IPEndPoint)InList[tempMsg[4]]; siep.Port = 8883; string savefilename = "C:\\MiniCTI\\" + this.myid + "\\Files\\" + filenameArray[filenameArray.Length - 1]; //수락여부 확인 플로우로 넘김 //1.수락 // FTP_ShowDialog(Hashtable info); // form.ShowDialog(Hashtable info); // event FTP_DialogResultReceived(CustomEvent); //2-1.거부 //2-2.종료 // event FTP_OnStatusChanged // //2.수락메시지전송 // //3.수신대기 // FileReceiver //4.수신 // FTP_ShowStatus(Receive|Cancel|Done|Error) // form.ShowStatus(Hashtable info); //5.완료 // FTP_StopReceiving() //6.취소 // FTP_CancelReceiving() //7.실패 // if (InList.ContainsKey(tempMsg[4]) && InList[tempMsg[4]] != null) //전송대상자가 로그인 상태인 경우 { //Hashtable info = new Hashtable(); //info["filename"] = savefilename; //info["filesize"] = filesize; //info["name"] = name; //info["senderid"] = tempMsg[4]; //info["myid"] = myid; DownloadInfo info = new DownloadInfo(); info.FileName = savefilename; info.FileSize = filesize; info.SenderName = name; info.SenderId = tempMsg[4]; info.MyId = myid; info.MsgFileKey = tempMsg[3]; info.SenderFileName = tempMsg[1]; if (mDownloadPath != null && mDownloadPath.Trim() != "") info.DownloadPath = mDownloadPath; else info.DownloadPath = string.Format(@"C:\MiniCTI\{0}\Files", myid); //FTP_ShowDialg(info); FTP_ShowDialogDelegate delShow = new FTP_ShowDialogDelegate(FTP_ShowDialg); Invoke(delShow, new object[] { info }); } break; #region 파일로직변경으로 막음 //if (InList.ContainsKey(tempMsg[4]) && InList[tempMsg[4]] != null) //전송대상자가 로그인 상태인 경우 //{ // Hashtable info = new Hashtable(); // info[savefilename] = filesize; // info["name"] = name; // info["senderid"] = tempMsg[4]; // //파일받기 수락 메시지전송 // SendMsg("Y|" + tempMsg[1] + "|" + tempMsg[3] + "|" + this.myid, siep); //구성(Y|파일명|파일Key|수신자id) // //파일수신대기/수신 // FileReceiver((object)info); //} //downloadform.Show(); //break; #endregion case "Y"://파일 받기 수락 메시지(Y|파일명|파일key|수신자id) ShowFileSendDetailDelegate show = new ShowFileSendDetailDelegate(ShowFileSendDetail); Hashtable table = new Hashtable(); table[tempMsg] = (IPEndPoint)InList[tempMsg[3]]; //파일 전송 스레드 시작 Thread sendfile = new Thread(new ParameterizedThreadStart(SendFile)); sendfile.Start((object)table); FileSendThreadList[tempMsg[2] + "|" + tempMsg[3]] = sendfile; FileSendDetailListView view = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(show, new object[] { tempMsg[3], "전송대기중", view }); break; case "FS"://파일 받기 수락 메시지(FS|파일명|파일key|수신자id) ShowFileSendDetailDelegate show_ = new ShowFileSendDetailDelegate(ShowFileSendDetail); Hashtable table_ = new Hashtable(); table_[tempMsg] = server; //파일 전송 스레드 시작 Thread sendfile_ = new Thread(new ParameterizedThreadStart(SendFile)); sendfile_.Start((object)table_); FileSendThreadList[tempMsg[2] + "|" + tempMsg[3]] = sendfile_; FileSendDetailListView view_ = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(show_, new object[] { tempMsg[3], "전송대기중", view_ }); break; case "N": //파일 받기 거부("N|파일명|파일키|id) ShowFileSendDetailDelegate detail = new ShowFileSendDetailDelegate(ShowFileSendDetail); FileSendDetailListView View = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(detail, new object[] { tempMsg[3], "받기 거부", View }); string Name = GetUserName(tempMsg[3]); string[] FilenameArray = tempMsg[1].Split('\\'); MessageBox.Show(Name + " 님이 파일 받기를 거부하셨습니다.\r\n\r\n파일명 : " + FilenameArray[(FilenameArray.Length - 1)], "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); break; #region //일반 메신저기능 case "i": //추가 로그인 상담원일 경우 형태 : i|id|소속팀명|ip|이름 try { //1. 로그인 리스트 테이블에 추가 IPEndPoint addiep = new IPEndPoint(IPAddress.Parse(tempMsg[3]), 8883); InList[tempMsg[1]] = addiep; //2. memTree 뷰에 로그인 사용자 상태 변경 ChangeStat change = new ChangeStat(ChangeMemStat); Invoke(change, new object[] { tempMsg[1], "online" }); TeamInfoList[tempMsg[1]] = tempMsg[2]; //3. 각 채팅창 key변경 및 채팅창 노드/상태변경 ChangeStat logInChatter = new ChangeStat(SetUserStatusInChatForm); Invoke(logInChatter, new object[] { tempMsg[1], MsgrUserStatus.ONLINE }); //4. 로그인 했음 메시지 창 띄움 // 추후 구현 } catch (Exception e) { logWrite(e.ToString()); } break; case "o": //로그아웃 상담원이 발생할 경우 o|id|소속 try { //1. 로그인 리스트 테이블에서 삭제 lock (this) { InList[tempMsg[1]] = null; } //2. memTree 뷰에 로그아웃 사용자 상태 변경 ChangeStat logout = new ChangeStat(ChangeMemStat); Invoke(logout, new object[] { tempMsg[1], tempMsg[2] }); //3. 각 채팅창 key변경 및 채팅창 노드/상태변경 ChangeStat logOutChatter = new ChangeStat(SetUserStatusInChatForm); Invoke(logOutChatter, new object[] {tempMsg[1], MsgrUserStatus.LOGOUT}); } catch (Exception e) { logWrite(e.ToString()); } break; case "n": //공지사항 메시지 (n|메시지|발신자id|mode|noticetime|제목) logWrite("공지사항 수신!"); if (!tempMsg[2].Equals(this.myid)) //자기가 보낸 공지일 경우 보이지 않음 { ArrangeCtrlDelegate notice = new ArrangeCtrlDelegate(ShowNoticeDirect); Invoke(notice, new object[] { tempMsg }); } break; case "A": //부재중 정보 전달(A|mnum|fnum|nnum|tnum) ArrangeCtrlDelegate ShowAbsentInfo = new ArrangeCtrlDelegate(ShowAbsentInfoNumber); Invoke(ShowAbsentInfo, new object[] { tempMsg }); break; case "Q"://안읽은 메모 리스트 (Q|sender;content;time;seqnum|sender;content;time;seqnum|... ArrangeCtrlDelegate ShowNRmemoList = new ArrangeCtrlDelegate(ShowMemoList); Invoke(ShowNRmemoList, new object[] { tempMsg }); break; case "T"://안읽은 공지 리스트 (T|sender;content;time;mode;seqnum|sender;content;time;mode;seqnum|... ArrangeCtrlDelegate ShowNRnoticeList = new ArrangeCtrlDelegate(ShowNotReadNoticeList); Invoke(ShowNRnoticeList, new object[] { tempMsg }); break; case "R"://안읽은 파일 리스트 (R|보낸사람;filenum;filename;time;size;seqnum|보낸사람;filenum;filename;time;size;seqnum|... ArrangeCtrlDelegate ShowNRFileList = new ArrangeCtrlDelegate(ShowFileList); Invoke(ShowNRFileList, new object[] { tempMsg }); break; case "t": //"t|ntime†content†nmode†title†안읽은사람1:안읽은사람2:...|... ArrangeCtrlDelegate ShowNoticeResultFromDB = new ArrangeCtrlDelegate(showNoticeResultFromDB); Invoke(ShowNoticeResultFromDB, new object[] { tempMsg }); break; case "L"://공지사항 리스트 수신한 경우 L|time!content!mode!sender!seqnum if (!(tempMsg.Length < 2)) { ArrangeCtrlDelegate makeNoticeList = new ArrangeCtrlDelegate(MakeNoticeListForm); Invoke(makeNoticeList, new object[] { tempMsg }); } else { MessageBox.Show("등록된 공지가 없습니다.", "공지없음", MessageBoxButtons.OK); } break; #endregion //일반 메신저 기능 case "s"://각 클라이언트 상태값 변경 메시지 s|id|상태|IPAddress { if (!tempMsg[1].Equals(this.myid)) { //1. 트리상태변경 ChangeStat presenceupdate = new ChangeStat(PresenceUpdate); Invoke(presenceupdate, new object[] { tempMsg[1], tempMsg[2] }); //2. 로그인리스트 테이블에 추가 IPEndPoint tempiep = new IPEndPoint(IPAddress.Parse(tempMsg[3]), listenport); lock (InList) { InList[tempMsg[1]] = tempiep; } //3. 채팅창 상태변경 // 각 채팅창 key변경 및 채팅창 노드/상태변경 ChangeStat changeStat = new ChangeStat(SetUserStatusInChatForm); Invoke(changeStat, new object[] { tempMsg[1], tempMsg[2] }); } } break; #region //전화기능 case "Ring": //발신자 표시(Ring|ani|name|server_type) RingingDele ringdele = new RingingDele(Ringing); Invoke(ringdele, new object[] { tempMsg[1], tempMsg[2], tempMsg[3] }); break; case "Dial": //다이얼시 고객정보 팝업(Dial|ani) if (this.nopop_outbound == false) { doublestringDele dialdele = new doublestringDele(Answer); Invoke(dialdele, new object[] { tempMsg[1], "2" }); } break; case "Answer": //offhook시 고객정보 팝업(Answer|ani|type) doublestringDele answerdele = new doublestringDele(Answer); Invoke(answerdele, new object[] { tempMsg[1], tempMsg[2] }); break; case "Abandon": //Abandon 발생시 AbandonDele abandon = new AbandonDele(Abandoned); Invoke(abandon); break; case "Other": //다른사람이 응답시 AbandonDele other = new AbandonDele(OtherAnswer); Invoke(other); break; #endregion //전화기능 case "pass"://고객정보 전달 수신(pass|ani|senderID|receiverID if (tempMsg[2].Equals(this.myid)) { //MessageBox.Show("이관되었습니다."); } else { //notifyTransfer(tempMsg); ArrangeCtrlDelegate passdele = new ArrangeCtrlDelegate(notifyTransfer); Invoke(passdele, new object[]{tempMsg}); } break; case "trans"://부재중 이관 메시시 수신(trans|sender†content†time†seqnum|...) ArrangeCtrlDelegate ShowNRTransList = new ArrangeCtrlDelegate(showNoreadTransfer); Invoke(ShowNRTransList, new object[] { tempMsg }); break; } } catch (Exception exception) { logWrite(exception.StackTrace); } }
/// <summary> /// 파일에서 라이센스정보를 읽어, 유효성검사를 한다. /// </summary> private void registerLicenseInfo() { try { logWrite("라이선스 체크중....."); mLicenseHandler = new LicenseHandler(this.licenseDir, this.MACID); mLicenseHandler.LogWriteHandler += this.OnLogWrite; //파일읽음&라이센스값 decode if (mLicenseHandler.ReadLicense()) { stringDele dele = new stringDele(disposeLicenseResult); Invoke(dele, mLicenseHandler.ResultMessage); } } catch (Exception ex) { logWrite(ex.ToString()); } }
private void rbt_type_CheckedChanged(object sender, EventArgs e) { try { RadioButton rbt = (RadioButton)sender; if (rbt.Checked == true) { stringDele changerbt = new stringDele(chageRBTstatus); Invoke(changerbt, new object[]{rbt.Name}); logWrite("통화장치 타입변경 : " + rbt.Name); server_type = rbt.Tag.ToString(); logWrite("server_type : " + server_type); } } catch (Exception ex) { logWrite(ex.ToString()); } }
/// <summary> /// ���ŵ� ������ �м��Ͽ� �� ��û�� �°� ó�� /// </summary> /// <param name="obj">ArrayList�� ����ȯ�� Object</param> protected void MsgFilter(object obj, IPEndPoint iep) { try { string msg = (string)obj; //���� ���� msg = msg.Trim(); string[] tempMsg = msg.Split('|'); string code = tempMsg[0]; switch (code) { case "f"://�α��� ���н�(f|n or p) try { FormTextCtrlDelegate informationMsg = new FormTextCtrlDelegate(ShowMessageBox); if (tempMsg[1].Equals("n")) { Invoke(informationMsg, "��ϵ��� ���� ����� �Դϴ�."); } else Invoke(informationMsg, "��й�ȣ�� Ʋ�Ƚ��ϴ�."); Loginfail fail = new Loginfail(logInFail); Invoke(fail, null); } catch (Exception e) { }; break; case "g": //�α��� ������ (g|name|team|company|com_cd) connected = true; stringDele changeProgressStyle = new stringDele(chageProgressbar); Invoke(changeProgressStyle, "�ε���"); setCRM_DB_HOST(XmlConfigOrgFullPath, serverIP);//Application.StartupPath + "\\MiniCTI_config_demo.xml", serverIP); setCRM_DB_HOST(XmlConfigFullPath, serverIP);//"c:\\MiniCTI\\config\\MiniCTI_config_demo.xml", serverIP); FileInfo temp = new FileInfo(XmlConfigOrgFullPath);//Application.StartupPath + "\\MiniCTI_config_demo.xml"); FileInfo tempfileinfo = new FileInfo(XmlConfigFullPath);//"C:\\MiniCTI\\config\\MiniCTI_config_demo.xml"); if (!tempfileinfo.Exists) { logWrite("MiniCTI config ���� ����"); FileInfo file_copied = temp.CopyTo(tempfileinfo.FullName); } else { FileInfo file_copied = temp.CopyTo(tempfileinfo.FullName, true); } myname = tempMsg[1];//���������� ���� �̸� ���� myid = this.id.Text; com_cd = tempMsg[4]; logWrite("�α��� ����! (" + DateTime.Now.ToString() + ")"); //���� ������ Client_Form �� ǥ�� FormTextCtrlDelegate FlushName = new FormTextCtrlDelegate(FlushInfo); FormTextCtrlDelegate FlushTeam = new FormTextCtrlDelegate(Flushteam); Invoke(FlushName, tempMsg[1]); if (tempMsg[2].Length > 0) { Invoke(FlushTeam, tempMsg[2]); } else { Invoke(FlushTeam, tempMsg[3]); } this.KeyDown += new KeyEventHandler(Client_Form_KeyDown); int count = this.Controls.Count; for (int i = 0; i < count; i++) { this.Controls[i].KeyDown += new KeyEventHandler(Client_Form_KeyDown); } //���� �� ��ȭ ���� ����, ���� ���� MemoFileCheck(); DialogFileCheck(); FileDirCheck(); if (checkThread == null) { checkThread = new Thread(new ThreadStart(SendCheck)); checkThread.Start(); logWrite("SendCheck ������ ����"); } break; case "M": //�ٸ� Ŭ���̾�Ʈ ��� �� ���ӻ��� ����(M|���̸�|id!����̸�|id!����̸�) if (tempMsg[1].Equals("e")) //��� ��Ʈ�� ���� ���ۿϷ� ������ ��� -> Client_Form�� �α��� ���·� ���� ������Ҹ� Ȱ��ȭ �Ѵ�. { PanelCtrlDelegate loginPanel = new PanelCtrlDelegate(LogInPanelVisible); //�α��� �г� ��Ʈ�� ȣ��� PanelCtrlDelegate TreeViewPanel = new PanelCtrlDelegate(TreeViewVisible); //memTreeView ��Ʈ��ȣ��� PanelCtrlDelegate btnCtrl = new PanelCtrlDelegate(ButtonCtrl);//���� ��ư ��Ʈ��ȣ��� Invoke(TreeViewPanel, true); // ��ư Ȱ��ȭ Invoke(btnCtrl, true); //tooltip ���� tooltip.AutoPopDelay = 0; tooltip.AutomaticDelay = 2000; tooltip.InitialDelay = 100; Invoke(loginPanel, false); //crm ���α� ���� Thread thread = new Thread(new ThreadStart(SetUserInfo)); thread.Start(); //NoParamDele dele = new NoParamDele(SetUserInfo); //Invoke(dele); } else // ��Ʈ�� ������ ������ ��� { ArrayList list = new ArrayList(); if (tempMsg.Length > 2) { int m = 0; for (int i = 2; i < tempMsg.Length; i++) //�迭 ���� 2��° ������ id!name�� ���� { if (tempMsg[i].Length != 0) { list.Add(tempMsg[i]); string[] memInfo = tempMsg[i].Split('!'); //<id>�� <name>�� �и��Ͽ� memInfo�� ���� MemberInfoList[memInfo[0]] = memInfo[1]; logWrite("MemberInfoList[" + memInfo[0] + "] = " + memInfo[1]); TeamInfoList[memInfo[0]] = tempMsg[1]; //�ٸ� ������ <�Ҽ�>�� <id>�� hashtable�� ����(key=id, value=�Ҽ�) logWrite("TeamInfoList[" + memInfo[0] + "] = " + tempMsg[1]); //logWrite("����� ���� ��� : �̸�(" + memInfo[1] + ") ���̵�(" + memInfo[0] + ")"); } } ChildNodeDelegate AddMemNode = new ChildNodeDelegate(MakeMemTree); object[] ar = { tempMsg[1], list }; Invoke(AddMemNode, ar); treesource[tempMsg[1]] = list; memTree.Tag = treesource; logWrite(tempMsg[1] + " �� ����Ʈ ����!"); //��������Ʈ ���� } } break; case "y": //�α��� Client ����Ʈ y|id|���°� string team = (string)TeamInfoList[tempMsg[1]]; int Port = 8883; logWrite("�� : "+team+ " ����� id : " + tempMsg[1] + " port : " + Port.ToString()); //InList[tempMsg[1]] = server; //�α��� ����Ʈ ���̺�� ����(key=id, value=IPEndPoint) ChangeStat changelogin = new ChangeStat(ChangeMemStat); Invoke(changelogin, new object[] { tempMsg[1], tempMsg[2] }); break; case "IP": //�α��� Client ����Ʈ IP|id|ip�ּ� Port = 8883; logWrite(" ����� id : " + tempMsg[1] + "IP �ּ� : " + tempMsg[2] + " port : " + Port.ToString()); InList[tempMsg[1]] = new IPEndPoint(IPAddress.Parse(tempMsg[2]), Port); //�α��� ����Ʈ ���̺�� ����(key=id, value=IPEndPoint) break; case "a": //�ߺ��α��� �õ��� �˷��� Loginfail relogin = new Loginfail(ReLogin); Invoke(relogin, null); break; case "u": //���������� ���� �αƿ� ���� ������ ��� LogOutDelegate logoutDel = new LogOutDelegate(LogOut); Invoke(logoutDel, null); break; case "d": //���� ��ȭ������ ��� (d|Formkey|id/id/...|name|����) string[] ids = tempMsg[2].Split('/'); if (!ids[0].Equals(myid)) { if (ChatFormList.Contains(tempMsg[1]) && ChatFormList[tempMsg[1]] != null) //�̹� �߽��ڿ� ä������ ��� { ChatForm form = (ChatForm)ChatFormList[tempMsg[1]]; AddChatMsg addMsg = new AddChatMsg(Addmsg); string smsg = tempMsg[3] + "|" + tempMsg[4]; Invoke(addMsg, new object[] { smsg, form }); //if() ����� ���¿� ���� //form.Activate(); } else //���ο� ��ȭ��û�� ��� { ArrangeCtrlDelegate OpenChatForm = new ArrangeCtrlDelegate(NewChatForm); Invoke(OpenChatForm, new object[] { tempMsg }); } } break; case "c": //c|formkey|id/id/..|name //��ȭ�� �ʴ밡 �Ͼ ��� if (ChatFormList.ContainsKey(tempMsg[1]) && ChatFormList[tempMsg[1]] != null) { string[] nameArray = tempMsg[2].Split('/'); ChatForm form = (ChatForm)ChatFormList[tempMsg[1]]; AddChatter addChatter = new AddChatter(Addchatter); AddChatMsg addMsg = new AddChatMsg(Addmsg); for (int i = 0; i < (nameArray.Length - 1); i++) { string tempname = getName(nameArray[i]); Invoke(addChatter, new object[] { nameArray[i], tempname, form }); //string tempmsg = tempMsg[3] + "���� " + tempname + "���� ��ȭ�� �ʴ��Ͽ����ϴ�."; //Invoke(addMsg, new object[] { tempmsg, form }); } } break; case "C": //�������� ����Ȯ�� ����(C|Ȯ����id|noticeid) ArrangeCtrlDelegate NoticeDetailResultFormAdd = new ArrangeCtrlDelegate(NoticeReaderAdd); Invoke(NoticeDetailResultFormAdd, new object[] { tempMsg }); break; case "q": //���� ��ȭ�� ������ ��ȭâ ���� (q|Formkey|id) if (ChatFormList.ContainsKey(tempMsg[1]) && ChatFormList[tempMsg[1]] != null) { ChatForm form = (ChatForm)ChatFormList[tempMsg[1]]; DelChatterDelegate delchatter = new DelChatterDelegate(DelChatter); Invoke(delchatter, new object[] { tempMsg[2], form }); } break; case "dc": //���� ��ȭ�� ������ ���� ���� (dc|Formkey|id) if (ChatFormList.ContainsKey(tempMsg[1]) && ChatFormList[tempMsg[1]] != null) { ChatForm form = (ChatForm)ChatFormList[tempMsg[1]]; } break; case "m"://�� ������ ��� m|name|id|message|������id ArrangeCtrlDelegate memo = new ArrangeCtrlDelegate(MakeMemo); Invoke(memo, new object[] { tempMsg }); MemoFileWrite(msg + "|" + DateTime.Now.ToString()); break; case "F": //�������� �� ���� ���� ���� F|���ϸ�|����ũ��|����key|������id string name = getName(tempMsg[4]); string[] filenameArray = tempMsg[1].Split('\\'); //���ϸ� ���� int filesize = int.Parse(tempMsg[2]); //����ũ�� ij���� IPEndPoint siep = (IPEndPoint)InList[tempMsg[4]]; siep.Port = 8883; string savefilename = "C:\\MiniCTI\\" + this.myid + "\\Files\\" + filenameArray[filenameArray.Length - 1]; if (InList.ContainsKey(tempMsg[4]) && InList[tempMsg[4]] != null) { Hashtable info = new Hashtable(); info[savefilename] = filesize; info["name"] = name; info["senderid"] = tempMsg[4]; SendMsg("Y|" + tempMsg[1] + "|" + tempMsg[3] + "|" + this.myid, siep); //����(Y|���ϸ�|����Key|������id) FileReceiver((object)info); } downloadform.Show(); break; case "Y"://���� �ޱ� ���� ����(Y|���ϸ�|����key|������id) ShowFileSendDetailDelegate show = new ShowFileSendDetailDelegate(ShowFileSendDetail); Hashtable table = new Hashtable(); table[tempMsg] = (IPEndPoint)InList[tempMsg[3]]; //���� ���� ������ ���� Thread sendfile = new Thread(new ParameterizedThreadStart(SendFile)); sendfile.Start((object)table); FileSendThreadList[tempMsg[2] + "|" + tempMsg[3]] = sendfile; FileSendDetailListView view = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(show, new object[] { tempMsg[3], "���۴����", view }); break; case "FS"://���� �ޱ� ���� ����(FS|���ϸ�|����key|������id) ShowFileSendDetailDelegate show_ = new ShowFileSendDetailDelegate(ShowFileSendDetail); Hashtable table_ = new Hashtable(); table_[tempMsg] = server; //���� ���� ������ ���� Thread sendfile_ = new Thread(new ParameterizedThreadStart(SendFile)); sendfile_.Start((object)table_); FileSendThreadList[tempMsg[2] + "|" + tempMsg[3]] = sendfile_; FileSendDetailListView view_ = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(show_, new object[] { tempMsg[3], "���۴����", view_ }); break; case "N": //���� �ޱ� �ź�("N|���ϸ�|����Ű|id) ShowFileSendDetailDelegate detail = new ShowFileSendDetailDelegate(ShowFileSendDetail); FileSendDetailListView View = (FileSendDetailListView)FileSendDetailList[tempMsg[2]]; Invoke(detail, new object[] { tempMsg[3], "�ޱ� �ź�", View }); string Name = getName(tempMsg[3]); string[] FilenameArray = tempMsg[1].Split('\\'); MessageBox.Show(Name + " ���� ���� �ޱ⸦ �ź��ϼ̽��ϴ�.\r\n\r\n���ϸ� : " + FilenameArray[(FilenameArray.Length - 1)], "�˸�", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case "i": //�߰� �α��� ������ ��� ���� : i|id|�Ҽ�����|ip|�̸� try { //�α��� ����Ʈ ���̺�� �߰� IPEndPoint addiep = new IPEndPoint(IPAddress.Parse(tempMsg[3]), 8883); InList[tempMsg[1]] = addiep; //memTree �信 �α��� ����� ���� ���� ChangeStat change = new ChangeStat(ChangeMemStat); Invoke(change, new object[] { tempMsg[1], "online" }); TeamInfoList[tempMsg[1]] = tempMsg[2]; } catch (Exception e) { logWrite(e.ToString()); } break; case "o": //�αƿ� ������ ���� ��� o|id|�Ҽ� FormTextCtrlDelegate logoutchatter = new FormTextCtrlDelegate(LogoutChatter); Invoke(logoutchatter, tempMsg[1]); lock (this) { InList[tempMsg[1]] = null; } ChangeStat logout = new ChangeStat(ChangeLogout); Invoke(logout, new object[] { tempMsg[1], tempMsg[2] }); break; case "n": //�������� ���� (n|����|�߽���id|mode|noticetime|����) logWrite("�������� ����!"); if (!tempMsg[2].Equals(this.myid)) //�ڱⰡ ���� ������ ��� ������ ���� { ArrangeCtrlDelegate notice = new ArrangeCtrlDelegate(ShowNoticeDirect); Invoke(notice, new object[] { tempMsg }); } break; case "A": //������ ���� ����(A|mnum|fnum|nnum|tnum) ArrangeCtrlDelegate ShowAbsentInfo = new ArrangeCtrlDelegate(ShowAbsentInfoNumber); Invoke(ShowAbsentInfo, new object[] { tempMsg }); break; case "Q"://������ �� ����Ʈ (Q|sender;content;time;seqnum|sender;content;time;seqnum|... ArrangeCtrlDelegate ShowNRmemoList = new ArrangeCtrlDelegate(ShowMemoList); Invoke(ShowNRmemoList, new object[] { tempMsg }); break; case "T"://������ ���� ����Ʈ (T|sender;content;time;mode;seqnum|sender;content;time;mode;seqnum|... ArrangeCtrlDelegate ShowNRnoticeList = new ArrangeCtrlDelegate(ShowNotReadNoticeList); Invoke(ShowNRnoticeList, new object[] { tempMsg }); break; case "R"://������ ���� ����Ʈ (R|�������;filenum;filename;time;size;seqnum|�������;filenum;filename;time;size;seqnum|... ArrangeCtrlDelegate ShowNRFileList = new ArrangeCtrlDelegate(ShowFileList); Invoke(ShowNRFileList, new object[] { tempMsg }); break; case "t": //"t|ntime��content��nmode��title�Ӿ��������1:���������2:...|... ArrangeCtrlDelegate ShowNoticeResultFromDB = new ArrangeCtrlDelegate(showNoticeResultFromDB); Invoke(ShowNoticeResultFromDB, new object[] { tempMsg }); break; case "L"://�������� ����Ʈ ������ ��� L|time!content!mode!sender!seqnum if (!(tempMsg.Length < 2)) { ArrangeCtrlDelegate makeNoticeList = new ArrangeCtrlDelegate(MakeNoticeListForm); Invoke(makeNoticeList, new object[] { tempMsg }); } else { MessageBox.Show("��ϵ� ������ �����ϴ�.", "��������", MessageBoxButtons.OK); } break; case "s"://�� Ŭ���̾�Ʈ ���°� ���� ���� s|id|����|IPAddress if (!tempMsg[1].Equals(this.myid)) { ChangeStat presenceupdate = new ChangeStat(PresenceUpdate); Invoke(presenceupdate, new object[] { tempMsg[1], tempMsg[2] }); IPEndPoint tempiep = new IPEndPoint(IPAddress.Parse(tempMsg[3]), listenport); lock (InList) { InList[tempMsg[1]] = tempiep; } } break; case "Ring": //�߽��� ǥ��(Ring|ani|name|server_type) RingingDele ringdele = new RingingDele(Ringing); Invoke(ringdele, new object[] { tempMsg[1], tempMsg[2], tempMsg[3] }); break; case "Dial": //���̾�� ������� �˾�(Dial|ani) if (this.nopop_outbound == false) { doublestringDele dialdele = new doublestringDele(Answer); Invoke(dialdele, new object[] { tempMsg[1], "2" }); } break; case "Answer": //offhook�� ������� �˾�(Answer|ani|type) doublestringDele answerdele = new doublestringDele(Answer); Invoke(answerdele, new object[] { tempMsg[1], tempMsg[2] }); break; case "Abandon": //Abandon ���� AbandonDele abandon = new AbandonDele(Abandoned); Invoke(abandon); break; case "Other": //�ٸ������ ����� AbandonDele other = new AbandonDele(OtherAnswer); Invoke(other); break; case "pass"://������� ���� ����(pass|ani|senderID|receiverID if (tempMsg[2].Equals(this.myid)) { //MessageBox.Show("�̰��Ǿ����ϴ�."); } else { //notifyTransfer(tempMsg); ArrangeCtrlDelegate passdele = new ArrangeCtrlDelegate(notifyTransfer); Invoke(passdele, new object[]{tempMsg}); } break; case "trans"://������ �̰� �ý� ����(trans|sender��content��time��seqnum|...) ArrangeCtrlDelegate ShowNRTransList = new ArrangeCtrlDelegate(showNoreadTransfer); Invoke(ShowNRTransList, new object[] { tempMsg }); break; } } catch (Exception exception) { logWrite(exception.StackTrace); } }
private void StripMn_busy_Click(object sender, EventArgs e) { stringDele dele = new stringDele(ChangeMyStatus); Invoke(dele, "통화중"); connection.SendMsgChangeStatus(MsgrUserStatus.BUSY); }
private void StripMn_logout_Click(object sender, EventArgs e) { stringDele dele = new stringDele(ChangeMyStatus); Invoke(dele, "오프라인 표시"); connection.SendMsgChangeStatus(MsgrUserStatus.LOGOUT); }
private void StringMn_away_Click(object sender, EventArgs e) { stringDele dele = new stringDele(ChangeMyStatus); Invoke(dele, "자리비움"); connection.SendMsgChangeStatus(MsgrUserStatus.AWAY); }
private void StripMn_online_Click(object sender, EventArgs e) { stringDele dele = new stringDele(ChangeMyStatus); Invoke(dele, "온라인"); connection.SendMsgChangeStatus(MsgrUserStatus.ONLINE); }