/// <summary>
        /// Check the input data is a local file header.
        /// </summary>
        /// <param name="byteArray">The content of a file.</param>
        /// <param name="index">The index where to start.</param>
        /// <returns>True if the input data is a local file header, otherwise false.</returns>
        public static bool IsFileHeader(byte[] byteArray, int index)
        {
            if (AdapterHelper.ByteArrayEquals(LocalFileHeader, AdapterHelper.GetBytes(byteArray, index, 4)))
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// Override the Equals method.
        /// </summary>
        /// <param name="obj">Specify the object.</param>
        /// <returns>Return true if equals, otherwise return false.</returns>
        public override bool Equals(object obj)
        {
            BinaryItem bi = obj as BinaryItem;

            if (bi == null)
            {
                return(false);
            }

            return(this.Length.DecodedValue == bi.Length.DecodedValue && AdapterHelper.ByteArrayEquals(this.content.ToArray(), bi.content.ToArray()));
        }
Пример #3
0
        /// <summary>
        /// This method is used to test whether it is an editors table header.
        /// </summary>
        /// <param name="content">Specify the header content.</param>
        /// <returns>Return true if the content is editors table header, otherwise return false.</returns>
        public static bool IsEditorsTableHeader(byte[] content)
        {
            byte[] editorsTableHeaderTmp = new byte[8];

            if (content.Length < 8)
            {
                return(false);
            }

            Array.Copy(content, 0, editorsTableHeaderTmp, 0, 8);
            return(AdapterHelper.ByteArrayEquals(EditorsTableHeader, editorsTableHeaderTmp));
        }