private static SplitTypeCount CountChars(string line)
        {
            SplitTypeCount ret = new SplitTypeCount();

            // determine CVS-Dialect
            foreach (char c in line)
            {
                if (c == '\t')
                {
                    ret.tabs += 1;
                }
                else if (c == ',')
                {
                    ret.kommas += 1;
                }
                else if (c == ';')
                {
                    ret.semikolons += 1;
                }
                else if (c == ' ')
                {
                    ret.spaces += 1;
                }
            }
            return(ret);
        }
        private void EvaluteHeader(string line)
        {
            headerLine = line;
            SplitTypeCount c = headerCount = CountChars(line);

            if (QuoteChar != QuoteChar.None)
            {
                c.spaces = 0;
            }

            if (c.tabs >= c.kommas && c.tabs >= c.semikolons && c.tabs >= c.spaces)
            {
                UsedSplitType = SplitType.Tab;
            }
            else if (c.kommas >= c.tabs && c.kommas >= c.semikolons && c.kommas >= c.spaces)
            {
                UsedSplitType = SplitType.Komma;
            }
            else if (c.semikolons >= c.spaces)
            {
                UsedSplitType = SplitType.Semikolon;
            }
            else if (c.spaces > 0)
            {
                UsedSplitType = SplitType.Space;
            }
            else
            {
                throw new IOException("unable to determine CSV-dialect");
            }
        }
        public void Feed(string line, int lineNo)
        {
            if (lineNo == 0)
            {
                EvaluteHeader(line);
                return;
            }

            if (lineNo == 1)
            {
                //int curColCount = splitter.Split(line).Length;

                if (splitType == SplitType.Space)
                {
                    // Resurrect on wrong counted spaces in header
                    SplitTypeCount c = CountChars(line);
                    if (c.spaces == 0)
                    {
                        c = headerCount;
                        if (c.tabs >= c.kommas && c.tabs >= c.semikolons)
                        {
                            UsedSplitType = SplitType.Tab;
                        }
                        else if (c.kommas >= c.tabs && c.kommas >= c.semikolons)
                        {
                            UsedSplitType = SplitType.Komma;
                        }
                        else if (c.semikolons > 0)
                        {
                            UsedSplitType = SplitType.Semikolon;
                        }
                    }
                }
                //// allow wired files with space delimiter on all but first line,
                //// there tab.
                //if (splitter.Split(line).Length <= 1)
                //{
                //    splitType = SplitType.TabAndSpace;
                //    splitter = new Regex("[ \t]+");
                //}
            }
        }
        private void EvaluteHeader(string line)
        {
            headerLine = line;
            SplitTypeCount c = headerCount = CountChars(line);

            if (QuoteChar != QuoteChar.None)
                c.spaces = 0;

            if (c.tabs >= c.kommas && c.tabs >= c.semikolons && c.tabs >= c.spaces)
                UsedSplitType = SplitType.Tab;
            else if (c.kommas >= c.tabs && c.kommas >= c.semikolons && c.kommas >= c.spaces)
                UsedSplitType = SplitType.Komma;
            else if (c.semikolons >= c.spaces)
                UsedSplitType = SplitType.Semikolon;
            else if (c.spaces > 0)
                UsedSplitType = SplitType.Space;
            else
                throw new IOException("unable to determine CSV-dialect");
        }
 private static SplitTypeCount CountChars(string line)
 {
     SplitTypeCount ret = new SplitTypeCount();
     // determine CVS-Dialect
     foreach (char c in line)
     {
         if (c == '\t') ret.tabs += 1;
         else if (c == ',') ret.kommas += 1;
         else if (c == ';') ret.semikolons += 1;
         else if (c == ' ') ret.spaces += 1;
     }
     return ret;
 }