Exemple #1
0
        private void checkEncoding(System.Text.Encoding encoding)
        {
            stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            reader = new StreamReader(stream, encoding);
            string firstLine = reader.ReadLine();

            parser.TestLine(firstLine);
            if (header == null)
            {
                parser.ReadHeader(firstLine);
                currentLine = reader.ReadLine();
            }
            else
            {
                currentLine = firstLine;
            }
        }
 protected override void ProcessRecord()
 {
     base.ProcessRecord();
     if (header == null && first)
     {
         parser.ReadHeader(InputString);
         first = false;
     }
     else
     {
         try {
             Dictionary <string, object> output = parser.ReadLine(InputString);
             WriteObject(TypeConversion.DictToPSObject(output));
         } catch (InvalidDataException err) {
             WriteWarning(err.Message);
         }
     }
 }