예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj.GetType() != typeof(ImageSignature))
            {
                return(false);
            }
            ImageSignature other = (ImageSignature)obj;

            if (length != other.length)
            {
                return(false);
            }
            for (int i = 0; i < signature.Length; i++)
            {
                if (signature[i] != other.signature[i])
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Returns true if the specified id and image has already been sent to this function.
        /// </summary>
        /// <param name="id">The ID string of the camera.</param>
        /// <param name="imgData">The image bytes.</param>
        /// <returns></returns>
        public bool DuplicateImageSendCheck(string id, byte[] imgData)
        {
            if (imgData == null)
            {
                return(false);
            }
            ImageSignature img = new ImageSignature(imgData);
            ImageSignature old;

            lock (lastJpgFrame)
            {
                if (!lastJpgFrame.TryGetValue(id, out old))
                {
                    old = null;
                }
                lastJpgFrame[id] = img;
            }
            if (old == null)
            {
                return(false);
            }
            return(img.Equals(old));
        }