コード例 #1
0
		public static void ReadAll_DataStreams(FixedRecordReaderBenchmarkArguments args)
		{
			using (var reader = new FixedWidthReader(new StreamReader(args.Path, args.Encoding, true, args.BufferSize)))
			{
				reader.Settings.CaptureRawRecord = false;

				for (int i = 0; i < ColumnCount; i++)
					reader.Columns.Add(ColumnWidth);

				string s;

				if (args.FieldIndex < 0)
				{
					while (reader.ReadRecord())
					{
						for (int i = 0; i < reader.Columns.Count - 1; i++)
							s = reader[i];
					}
				}
				else
				{
					while (reader.ReadRecord())
					{
						for (int i = 0; i < args.FieldIndex + 1; i++)
							s = reader[i];
					}
				}
			}
		}
コード例 #2
0
        public static void ReadAll_DataStreams(FixedRecordReaderBenchmarkArguments args)
        {
            using (var reader = new FixedWidthReader(new StreamReader(args.Path, args.Encoding, true, args.BufferSize)))
            {
                reader.Settings.CaptureRawRecord = false;

                for (int i = 0; i < ColumnCount; i++)
                {
                    reader.Columns.Add(ColumnWidth);
                }

                string s;

                if (args.FieldIndex < 0)
                {
                    while (reader.ReadRecord())
                    {
                        for (int i = 0; i < reader.Columns.Count - 1; i++)
                        {
                            s = reader[i];
                        }
                    }
                }
                else
                {
                    while (reader.ReadRecord())
                    {
                        for (int i = 0; i < args.FieldIndex + 1; i++)
                        {
                            s = reader[i];
                        }
                    }
                }
            }
        }
コード例 #3
0
        public List <MaintenanceCommentRecord> ReadCommentRecordsFromMaintenanceFile(string fullPathFile)
        {
            var records  = new List <MaintenanceCommentRecord>();
            var allLines = File.ReadAllLines(fullPathFile);
            var reader   = new FixedWidthReader(typeof(MaintenanceCommentRecord));

            for (var i = 1; i <= allLines.Length - 1; i++)
            {
                var record = (MaintenanceCommentRecord)reader.ReadRecord(allLines[i]);
                records.Add(record);
            }

            return(records);
        }