Exemple #1
0
        List <byte> GetReadyBytes(out byte[] protocol)
        {
            string answer;
            int    width  = Screen.PrimaryScreen.Bounds.Width;
            int    height = Screen.PrimaryScreen.Bounds.Height;
            //var bytes = ImageControler.GetScreenshotBytes(150,150);
            var         bytes       = ImageControler.GetScreenshotBytes();
            List <byte> newRgbValue = new List <byte>();
            var         tmp         = Utils.Packcage(bytes);

            answer   = String.Format("{3}x{0}x{1}x{2}|", width, height, tmp.Count(), "ScreenShot");
            protocol = Encoding.Unicode.GetBytes(answer);
            //newRgbValue.AddRange(bts);
            //newRgbValue.AddRange(tmp);
            return(tmp);
        }
Exemple #2
0
        List <byte> GetReadyBytes(out byte[] btProtocol)
        {
            string answer;
            int    width  = Screen.PrimaryScreen.Bounds.Width;
            int    height = Screen.PrimaryScreen.Bounds.Height;

            System.Drawing.Size Coords = Utils.GetRectangleSize(width, height);
            int countHorizontalBlocks  = width / Coords.Width;
            int countVerticalBlocks    = height / Coords.Height;
            int totalBlockCount        = countHorizontalBlocks * countVerticalBlocks;
            var bytes = ImageControler.GetScreenshotBytes();

            this.tmpShot = new ClientScreenShotData(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, bytes.ToArray());

            List <byte> newRgbValue = new List <byte>();
            DateTime    start       = DateTime.Now;

            if (this.screenShotData != null)
            {
                List <int> blocks     = ImageControler.ImageCompressor.getChanges(width, height, Coords.Width, Coords.Height, countHorizontalBlocks, countVerticalBlocks, totalBlockCount, bytes, this.screenShotData);
                var        readyBytes = Utils.Compress(ImageControler.ImageCompressor.byteCompressor(blocks, bytes, Coords.Width, Coords.Height, countHorizontalBlocks, countVerticalBlocks, width, height));
                btProtocol = Utils.GetArraysProtocol(blocks, width, height, readyBytes.Length);
                newRgbValue.AddRange(readyBytes);
                Console.WriteLine("{0}ms Length:{1}", (DateTime.Now - start).Milliseconds, newRgbValue.Count);
            }
            else
            {
                var tmp = Utils.Packcage(bytes);
                answer = String.Format("{3}x{0}x{1}x{2}|", width, height, tmp.Count(), "ScreenShot");
                var bts = Encoding.Unicode.GetBytes(answer);
                btProtocol = bts;
                newRgbValue.AddRange(tmp);
            }

            return(newRgbValue);
        }