Exemplo n.º 1
0
        public void AppendLine(string tag, int ver, string data, string rest)
        {
            var newLine = new CSVLine();

            newLine.tag  = tag;
            newLine.data = data;
            newLine.rest = rest;
            lines.Add(newLine);
        }
Exemplo n.º 2
0
        public virtual void Read(string path)
        {
            // first read as Latin1
            var   raw = File.ReadLines(path, Encoding.GetEncoding(1252));
            Regex re  = new Regex("^(?<tag>[^#;]+);(?<data>[^#;]+);(?<rest>.+)");

            foreach (var rawline in raw)
            {
                CSVLine newline = new CSVLine();
                Match   m       = re.Match(rawline);
                if (m.Success)
                {
                    newline.tag  = m.Groups["tag"].Value;
                    newline.data = ProcessInput(m.Groups["data"].Value);
                    newline.rest = ProcessInput(m.Groups["rest"].Value);
                }
                else
                {
                    newline.data = rawline;
                }
                lines.Add(newline);
            }
        }