コード例 #1
0
        internal static int Find(this IEditablePdfDocument document, int windowSize, Func <byte[], bool> matches, int start = 0)
        {
            var end = document.Length;

            var pos    = start;
            var window = new byte[windowSize];

            while (pos < end)
            {
                window.Insert(document.Read(pos));
                if (matches(window))
                {
                    return(pos);
                }
                pos++;
            }
            return(-1);
        }
コード例 #2
0
        internal static int FindReverse(this IEditablePdfDocument document, int windowSize, Func <byte[], bool> matches, int start)
        {
            var end = 0;

            var pos    = start;
            var window = new byte[windowSize];

            while (pos != end)
            {
                window.InsertReverse(document.Read(pos));
                if (matches(window))
                {
                    return(pos);
                }
                pos--;
            }
            return(-1);
        }
コード例 #3
0
ファイル: PdfReader.cs プロジェクト: Kwesoft/Pdf
 public PdfReader(IEditablePdfDocument document)
 {
     _document = document;
 }
コード例 #4
0
 internal PdfEditor(IEditablePdfDocument document)
 {
     _document = document;
 }
コード例 #5
0
 internal static bool ByteEquals(this IEditablePdfDocument a, int posA, byte[] b) => a.ByteEquals(posA, b, 0);
コード例 #6
0
 internal static int FindReverse(this IEditablePdfDocument document, byte[] lookFor) => document.FindReverse(lookFor, document.Length - 1);
コード例 #7
0
 internal static int FindReverse(this IEditablePdfDocument document, byte[] lookFor, int start) => document.FindReverse(lookFor.Length, w => w.ByteEquals(lookFor), start);
コード例 #8
0
 internal static int FindReverse(this IEditablePdfDocument document, int windowSize, Func <byte[], bool> matches) => document.FindReverse(windowSize, matches, document.Length - 1);
コード例 #9
0
 internal static int Find(this IEditablePdfDocument document, byte[] lookFor) => document.Find(lookFor, 0);
コード例 #10
0
 internal static bool ByteEquals(this IEditablePdfDocument a, int posA, byte[] b, int posB) => a.Read(posA, b.Length - posB).ByteEquals(0, b, posB);