示例#1
0
        private int LineCallback(IntPtr data, GitDiffDelta delta, GitDiffRange range, GitDiffLineOrigin lineorigin, IntPtr content, uint contentlen)
        {
            string decodedContent = marshaler.NativeToString(content, contentlen);

            string prefix;

            switch (lineorigin)
            {
            case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION:
                LinesAdded++;
                prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin });
                break;

            case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION:
                LinesDeleted++;
                prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin });
                break;

            case GitDiffLineOrigin.GIT_DIFF_LINE_CONTEXT:
                prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin });
                break;

            default:
                prefix = string.Empty;
                break;
            }

            PatchBuilder.AppendFormat("{0}{1}", prefix, decodedContent);
            return(0);
        }
示例#2
0
        private int HunkCallback(IntPtr data, GitDiffDelta delta, GitDiffRange range, IntPtr header, uint headerlen)
        {
            string decodedContent = marshaler.NativeToString(header, headerlen);

            PatchBuilder.AppendFormat("{0}", decodedContent);
            return(0);
        }