Exemplo n.º 1
0
        /// <summary>
        /// Return the result of the comparison between two TextHash.
        /// </summary>
        /// <param name="hash1"></param>
        /// <param name="hash2"></param>
        /// <returns></returns>
        public static NativeStructures.TxtMatch[] CompareTextHashes(TextHash hash1, TextHash hash2)
        {
            int    resultCount;
            IntPtr rawTxtMatches = NativeFunctions.ph_compare_text_hashes(hash1.HashPoints, hash1.PointsCount, hash2.HashPoints, hash2.PointsCount, out resultCount);

            NativeStructures.TxtMatch[] array = new NativeStructures.TxtMatch[resultCount];
            for (int i = 0; i < resultCount; i++)
            {
                array[i]      = (NativeStructures.TxtMatch)Marshal.PtrToStructure(rawTxtMatches, typeof(NativeStructures.TxtMatch));
                rawTxtMatches = IntPtr.Add(rawTxtMatches, Marshal.SizeOf(typeof(NativeStructures.TxtMatch)));
            }
            return(array);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Return the result of the comparison between two TextHash.
 /// </summary>
 /// <param name="hash1"></param>
 /// <param name="hash2"></param>
 /// <returns></returns>
 public static NativeStructures.TxtMatch[] CompareTextHashes(TextHash hash1, TextHash hash2)
 {
     int resultCount;
     IntPtr rawTxtMatches = NativeFunctions.ph_compare_text_hashes(hash1.HashPoints, hash1.PointsCount, hash2.HashPoints, hash2.PointsCount, out resultCount);
     NativeStructures.TxtMatch[] array = new NativeStructures.TxtMatch[resultCount];
     for (int i = 0; i < resultCount; i++)
     {
         array[i] = (NativeStructures.TxtMatch)Marshal.PtrToStructure(rawTxtMatches, typeof(NativeStructures.TxtMatch));
         rawTxtMatches = IntPtr.Add(rawTxtMatches, Marshal.SizeOf(typeof(NativeStructures.TxtMatch)));
     }
     return array;
 }