Ejemplo n.º 1
0
        void SendFrame(ClientCommand command, Bitmap screenImg)
        {
            if (encoder == null)
            {
                encoder = new MyEncoder(command.needWidth, command.needHeight);
            }

            Bitmap       small_map = new Bitmap(screenImg, command.needWidth, command.needHeight);
            MemoryStream str       = new MemoryStream();

            encoder.WriteToStr(small_map, str);


            MemoryStream compressed = new MemoryStream();

            str.Position = 0;
            ShortEncoder.Encode(str, compressed);
            compressed.Position = 0;

            lock (tcpLock)
            {
                formatter.Serialize(networkStream, (int)compressed.Length);
                compressed.CopyTo(networkStream);
            }
        }
Ejemplo n.º 2
0
        public RMDClient(string address, int hash, int width, int height)
        {
            this.width  = width;
            this.height = height;
            encoder     = new MyEncoder(width, height);
            screenImg   = new Bitmap(1, 1);

            if (SetupConnect(address, hash))
            {
                timer.Interval = 20;
                timer.Tick    += Timer_Elapsed;
                timer.Start();
            }
        }