FreakySources.CodeDataGenerator.RemoveIgnoreSection C# (CSharp) Method

RemoveIgnoreSection() private method

private RemoveIgnoreSection ( string code ) : string
code string
return string
        private string RemoveIgnoreSection(string code)
        {
            if (code == null)
                return null;

            int beginInd = code.IndexOf(IgnoreBegin);
            while (beginInd != -1)
            {
                int endInd = code.IndexOf(IgnoreEnd, beginInd);
                if (endInd != -1)
                {
                    endInd += IgnoreEnd.Length;
                    while (endInd < code.Length && char.IsWhiteSpace(code[endInd]))
                        endInd++;
                    endInd--;
                    while (endInd >= 0 && char.IsWhiteSpace(code[endInd]) && code[endInd] != '\r' && code[endInd] != '\n')
                        endInd--;

                    beginInd--;
                    while (beginInd >= 0 && char.IsWhiteSpace(code[beginInd]) && code[beginInd] != '\r' && code[beginInd] != '\n')
                        beginInd--;

                    code = code.Remove(beginInd, endInd - beginInd);
                }

                beginInd = code.IndexOf(IgnoreBegin);
            }
            return code;
        }