Esempio n. 1
0
 /// <summary>
 /// Creates an instance of Parser with a FileStream as a Parameter
 /// </summary>
 /// <param name="fileStream">FileStream</param>
 /// <param name="delimiter">Sets the delimiter, optional, will default to comma</param>
 /// <param name="hasHeader">Indicates if there is a header row, optional, will default to true</param>
 /// <param name="hasSpaces">Indicates if there are spaces between the delimiter and the fields, optional, will default to false</param>
 public Parser(FileStream fileStream, char delimiter = ',', bool hasHeader = true, bool hasSpaces = false)
 {
     Rs          = new ReadStream(fileStream);
     Delimiter   = delimiter;
     HasHeader   = hasHeader;
     HasSpaces   = hasSpaces;
     LineCounter = 0;
 }
Esempio n. 2
0
 /// <summary>
 /// Creates an instance of Parser with a ReadStream as a Parameter, ReadStream is nearly identical to StreamReader but it allows for line breaks in fields
 /// </summary>
 /// <param name="readStream">sets a ReadStream, ReadStream is nearly identical to StreamReader but it allows for line breaks in fields</param>
 /// <param name="delimiter">Sets the delimiter, optional, will default to comma</param>
 /// <param name="hasHeader">Indicates if there is a header row, optional, will default to true</param>
 /// <param name="hasSpaces">Indicates if there are spaces between the delimiter and the fields, optional, will default to false</param>
 public Parser(ReadStream readStream, char delimiter = ',', bool hasHeader = true, bool hasSpaces = false)
 {
     Rs          = readStream;
     Delimiter   = delimiter;
     HasHeader   = hasHeader;
     HasSpaces   = hasSpaces;
     LineCounter = 0;
 }
Esempio n. 3
0
        /// <summary>
        /// Creates an instance of Parser with a string as a Parameter
        /// </summary>
        /// <param name="str">string</param>
        /// <param name="delimiter">Sets the delimiter, optional, will default to comma</param>
        /// <param name="hasHeader">Indicates if there is a header row, optional, will default to true</param>
        /// <param name="hasSpaces">Indicates if there are spaces between the delimiter and the fields, optional, will default to false</param>
        public Parser(string str, char delimiter = ',', bool hasHeader = true, bool hasSpaces = false)
        {
            UnicodeEncoding uniEncoding = new UnicodeEncoding();

            Ms = new MemoryStream();
            Sw = new StreamWriter(Ms, uniEncoding);
            Sw.Write(str);
            Sw.Flush();
            Ms.Seek(0, SeekOrigin.Begin);
            Rs = new ReadStream(Ms);

            Delimiter   = delimiter;
            HasHeader   = hasHeader;
            HasSpaces   = hasSpaces;
            LineCounter = 0;
        }