public AdHocDesktop_TcpObject(AdHocDesktop_TcpCommand command, string src, string dest, params object[] data) { this.command = command; this.data = data; this.src = src; this.dest = dest; }
void ReceivedVideoCallback(object obj) { object[] objs = (object[])obj; AdHocDesktop_TcpCommand command = (AdHocDesktop_TcpCommand)objs[0]; byte[] buffer = (byte[])objs[1]; lock (this) { if (command == AdHocDesktop_TcpCommand.StreamingCamera) { using (Bitmap drawImage = ImageUtil.ByteToBitmap(buffer)) { using (Graphics g = videoPanel.CreateGraphics()) { g.DrawImage(drawImage, new Rectangle(new Point(0, 0), videoPanel.Size)); } } } else { try { byte[] image = null; if (previousBuffer == null) { previousBuffer = GZipUtil.Decompress(buffer); image = previousBuffer; } else { byte[] currentBuffer = GZipUtil.Decompress(buffer); image = ImageUtil.RecompareImage(previousBuffer, currentBuffer); } using (Bitmap drawImage = ImageUtil.ByteToBitmap(image))//, width, height, width * 3, PixelFormat.Format24bppRgb)) { using (Graphics g = videoPanel.CreateGraphics()) { g.DrawImage(drawImage, new Rectangle(new Point(0, 0), videoPanel.Size)); } } previousBuffer = null; previousBuffer = image; image = null; } catch (Exception) { } } } }
void SendEndSession(AdHocDesktop_TcpClient client, AdHocDesktop_TcpCommand command) { List <AdHocDesktop_TcpClient> groups = groupTable[client.Identifier]; for (int i = 0; i < groups.Count; i++) { if (!groups[i].IsConnected) { groups.RemoveAt(i); i--; } } for (int i = 0; i < groups.Count; i++) { AdHocDesktop_TcpClient dest = groups[i]; dest.Send(new AdHocDesktop_TcpObject(command, client.Identifier, dest.Identifier, new byte[1])); } }
public virtual void Deserialize(byte[] data) { ms = new MemoryStream(data); br = new BinaryReader(ms); //int length = AdHocDesktop_BinaryFormatter.Deserialize(br); object[] objs = AdHocDesktop_BinaryFormatter.Deserialize(br); command = (AdHocDesktop_TcpCommand)objs[0]; src = (string)objs[1]; dest = (string)objs[2]; ArrayList al = new ArrayList(); for (int i = 3; i < objs.Length - 1; i++) // objs[objs.Length-1] = AdHocDesktop_SerializeType.AdHocDesktop_TcpObject { al.Add(objs[i]); } this.data = al.ToArray(); br.Close(); ms.Close(); }
void SendStreaming(AdHocDesktop_TcpClient client, byte[] buffer, AdHocDesktop_TcpCommand command) { bandwidthInput += (buffer == null ? 0 : buffer.Length); List <AdHocDesktop_TcpClient> groups = groupTable[client.Identifier]; for (int i = 0; i < groups.Count; i++) { if (!groups[i].IsConnected) { groups.RemoveAt(i); i--; } } for (int i = 0; i < groups.Count; i++) { AdHocDesktop_TcpClient dest = groups[i]; if (winceClients.Contains(dest.Identifier)) { Size size = new Size(240, 180); if (command == AdHocDesktop_TcpCommand.StreamingCamera) { using (Bitmap b = ImageUtil.ByteToBitmap(buffer)) { buffer = ImageUtil.ResizeBitmapToJpegByte(b, size); } } else if (command == AdHocDesktop_TcpCommand.StreamingScreen) { using (Bitmap b = ImageUtil.ByteToBitmap(GZipUtil.Decompress(buffer))) { buffer = GZipUtil.Compress(ImageUtil.ResizeBitmapToByte(b, size)); } } } dest.Send(new AdHocDesktop_TcpObject(command, client.Identifier, dest.Identifier, buffer)); bandwidthOutput += (buffer == null ? 0 : buffer.Length); } }
public AdHocDesktop_TcpObject(AdHocDesktop_TcpCommand command, object data) { this.command = command; this.data = data; }
void ReceivedVideo(AdHocDesktop_TcpCommand command, byte[] buffer) { AdHocDesktop_AsyncCallback ad = new AdHocDesktop_AsyncCallback(ReceivedVideoCallback); this.BeginInvoke(ad, new object[] { new object[] { command, buffer } }); }
private void adHocDesktopCameraToolStripMenuItem_Click(object sender, EventArgs e) { invitationCommand = AdHocDesktop_TcpCommand.StreamingCamera; HideVideoGrabberForm(); Invitation(); }
private void adHocDesktopScreenToolStripMenuItem_Click(object sender, EventArgs e) { invitationCommand = AdHocDesktop_TcpCommand.StreamingScreen; Invitation(); }
public AdHocDesktop_StreamWriter(AdHocDesktop_TcpCommand command, AdHocDesktop_TcpClient user, AdHocDesktop_Profile profile) { this.command = command; this.user = user; this.profile = profile; }