NGit.Patch.Patch.Error C# (CSharp) 메소드

Error() 개인적인 메소드

private Error ( byte buf, int ptr, string msg ) : void
buf byte
ptr int
msg string
리턴 void
        internal virtual void Error(byte[] buf, int ptr, string msg)
        {
            AddError(new FormatError(buf, ptr, FormatError.Severity.ERROR, msg));
        }

Usage Example

        internal override int ParseBody(NGit.Patch.Patch script, int end)
        {
            byte[] buf = file.buf;
            int    c   = RawParseUtils.NextLF(buf, startOffset);

            foreach (CombinedHunkHeader.CombinedOldImage o in old)
            {
                o.nDeleted = 0;
                o.nAdded   = 0;
                o.nContext = 0;
            }
            nContext = 0;
            int nAdded = 0;

            for (int eol; c < end; c = eol)
            {
                eol = RawParseUtils.NextLF(buf, c);
                if (eol - c < old.Length + 1)
                {
                    // Line isn't long enough to mention the state of each
                    // ancestor. It must be the end of the hunk.
                    goto SCAN_break;
                }
                switch (buf[c])
                {
                case (byte)(' '):
                case (byte)('-'):
                case (byte)('+'):
                {
                    break;
                }

                default:
                {
                    // Line can't possibly be part of this hunk; the first
                    // ancestor information isn't recognizable.
                    //
                    goto SCAN_break;
                    break;
                }
                }
                int localcontext = 0;
                for (int ancestor = 0; ancestor < old.Length; ancestor++)
                {
                    switch (buf[c + ancestor])
                    {
                    case (byte)(' '):
                    {
                        localcontext++;
                        old[ancestor].nContext++;
                        continue;
                        goto case (byte)('-');
                    }

                    case (byte)('-'):
                    {
                        old[ancestor].nDeleted++;
                        continue;
                        goto case (byte)('+');
                    }

                    case (byte)('+'):
                    {
                        old[ancestor].nAdded++;
                        nAdded++;
                        continue;
                        goto default;
                    }

                    default:
                    {
                        goto SCAN_break;
                        break;
                    }
                    }
                }
                if (localcontext == old.Length)
                {
                    nContext++;
                }
                SCAN_continue :;
            }
            SCAN_break :;
            for (int ancestor_1 = 0; ancestor_1 < old.Length; ancestor_1++)
            {
                CombinedHunkHeader.CombinedOldImage o_1 = old[ancestor_1];
                int cmp = o_1.nContext + o_1.nDeleted;
                if (cmp < o_1.lineCount)
                {
                    int missingCnt = o_1.lineCount - cmp;
                    script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkLinesMissingForAncestor
                                                                        , Sharpen.Extensions.ValueOf(missingCnt), Sharpen.Extensions.ValueOf(ancestor_1
                                                                                                                                             + 1)));
                }
            }
            if (nContext + nAdded < newLineCount)
            {
                int missingCount = newLineCount - (nContext + nAdded);
                script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkNewLinesMissing
                                                                    , Sharpen.Extensions.ValueOf(missingCount)));
            }
            return(c);
        }
All Usage Examples Of NGit.Patch.Patch::Error