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 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; } } }