public void HandleFile(ParsePack dp) { lock (bc) { string full = dp.getString(); int start = dp.getInt(); int end = dp.getInt(); int len = dp.getInt(); int l2 = dp.getInt(); byte[] msg = dp.getBytes(l2); if (start == 0) { string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); fs = new FileStream(Path.Combine(dir, full), FileMode.OpenOrCreate); } fs.Write(msg, 0, msg.Length); if (end == len) { fs.Dispose(); fs.Close(); fs = null; } } }
public override void UserMsgRead(ParsePack dp) { string time = dp.getString(); int s = dp.getInt(); MsgEnum me = (MsgEnum)s; switch (me) { case MsgEnum.DesktopImg: if (MainWindow.instances.ControlDic.ContainsKey(bc)) { int wid = dp.getInt(); int hig = dp.getInt(); int len = dp.getInt(); MainWindow.instances.ControlDic[bc].RushDesktopImg(dp.getBytes(len)); } break; case MsgEnum.ComputerName: string n = dp.getString(); if (MainWindow.instances.ClientNameDic.ContainsKey(bc) == false) { MainWindow.instances.ClientNameDic.Add(bc, n); MainWindow.instances.RushClientList(); } break; default: break; } }
public override void UserMsgRead(ParsePack dp) { string time = dp.getString(); MsgEnum me = (MsgEnum)dp.getInt(); switch (me) { case MsgEnum.DesktopImg: ClientManger.instaces.HandleDesktopImg(); break; case MsgEnum.MouseClick: ClientManger.instaces.HandleMouseClick(dp); break; case MsgEnum.MouseMove: ClientManger.instaces.HnadleMouseMove(dp); break; case MsgEnum.SendFiles: ClientManger.instaces.HandleFile(dp); break; case MsgEnum.KeyBoard: ClientManger.instaces.HandleKeyBD(dp); break; case MsgEnum.SpeKeyBoard: ClientManger.instaces.HandleSpeBD(dp); break; } }
/// <summary> /// 系统消息处理 /// </summary> /// <param name="red"></param> public void SystemMsgRead(ParsePack dp) { string s = dp.getString(); SystemMessageType smt = (SystemMessageType)dp.getInt(); switch (smt) { case SystemMessageType.HeartBeat: bc.ReceiveHeart(s); break; } }
/// <summary> /// 区分系统消息和用户消息 /// </summary> /// <param name="arr"></param> public void msgRead(byte[] msg) { ParsePack dp = new ParsePack(msg); MessageType mt = (MessageType)dp.getInt(); switch (mt) { case MessageType.System: MainThreadFunctionQueue.Enqueue(() => { SystemMsgRead(dp); }); break; case MessageType.Normal: MainThreadFunctionQueue.Enqueue(() => { UserMsgRead(dp); }); break; } }
internal void HandleSpeBD(ParsePack dp) { KeyBoardMsg k = (KeyBoardMsg)dp.getInt(); InputSimulator sim = new InputSimulator(); Console.WriteLine(k); switch (k) { case KeyBoardMsg.AltF4: sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.F4); break; case KeyBoardMsg.AltTab: sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.TAB); break; case KeyBoardMsg.WinD: sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_D); break; } }
public void HandleMouseClick(ParsePack pp) { MouseEventFlag flag = (MouseEventFlag)pp.getInt(); mouse_event(flag, 0, 0, 0, UIntPtr.Zero); }
public void HandleKeyBD(ParsePack dp) { Key k = (Key)dp.getInt(); Keyboard.Type(k); }