示例#1
0
        public bool SendAllIfRead(byte[] data, byte[] messageRead)
        {
            if (data.IsNullOrEmpty() || messageRead.IsNullOrEmpty())
            {
                return(false);
            }

            var keys = this.ConnectionKeys;

            if (keys.IsNullOrEmpty())
            {
                return(false);
            }

            foreach (var k in keys)
            {
                byte[] read = this.Read(k);

                if (Bytes.Compare(read, messageRead))
                {
                    this.Send(k, data);
                }
            }

            return(true);
        }
示例#2
0
        public static bool Compare(Bitmap bmp1, Bitmap bmp2, Rectangle?rect1 = null, Rectangle?rect2 = null)
        {
            if (bmp1 == null || bmp2 == null)
            {
                return(false);
            }

            byte[] data1, data2;


            if (rect1 == null)
            {
                data1 = bmp1.GetRawBytes();
            }
            else
            {
                data1 = bmp1.GetRawBytes((Rectangle)rect1);
            }

            if (rect2 == null)
            {
                data2 = bmp2.GetRawBytes();
            }
            else
            {
                data2 = bmp2.GetRawBytes((Rectangle)rect2);
            }

            return(Bytes.Compare(data1, data2));
        }