-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenericParser.xml
More file actions
1395 lines (1387 loc) · 69.8 KB
/
GenericParser.xml
File metadata and controls
1395 lines (1387 loc) · 69.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<doc>
<assembly>
<name>GenericParsing</name>
</assembly>
<members>
<member name="T:GenericParsing.FieldType">
<summary>
Indicates whether text fields are delimited or fixed width.
</summary>
</member>
<member name="F:GenericParsing.FieldType.Delimited">
<summary>
Indicates that the fields are delimited.
</summary>
</member>
<member name="F:GenericParsing.FieldType.FixedWidth">
<summary>
Indicates that the fields are fixed width.
</summary>
</member>
<member name="T:GenericParsing.GenericParser">
<summary>
The <see cref="T:GenericParsing.GenericParser"/> class is designed to be a flexible and efficient manner
of parsing various flat files formats.
</summary>
<threadsafety static="false" instance="false"/>
</member>
<member name="F:GenericParsing.GenericParser.DefaultMaxBufferSize">
<summary>
Defines the default max buffer size (4096).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultMaxRows">
<summary>
Defines the max rows value (0 = no limit).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultSkipStartingDataRows">
<summary>
Defines the number of skip starting data rows (0).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultExpectedColumnCount">
<summary>
Defines the number of expected columns (0 = no limit).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultFirstRowHasHeader">
<summary>
Defines the default first row has a header (false).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultTrimResults">
<summary>
Defines the default value for trim results (false).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaulStripControlCharacters">
<summary>
Defines the default value for stripping control characters (false).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaulSkipEmptyRows">
<summary>
Defines the default value for skipping empty rows (true).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultTextFieldType">
<summary>
Defines the default value for text field type (Delimited).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultFirstRowSetsExpectedColumnCount">
<summary>
Defines the default for first row sets the expected column count (false).
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultColumnDelimiter">
<summary>
Defines the default column delimiter (',').
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultTextQualifier">
<summary>
Defines the default text qualifier ('\"').
</summary>
</member>
<member name="F:GenericParsing.GenericParser.DefaultCommentCharacter">
<summary>
Defines the default comment row character ('#').
</summary>
</member>
<member name="M:GenericParsing.GenericParser.CloneArray``1(``0[])">
<summary>
Clones the provided array in a type-friendly way.
</summary>
<typeparam name="T">The type of the array to clone.</typeparam>
<param name="array">The array to clone.</param>
<returns>The cloned version of the array.</returns>
</member>
<member name="M:GenericParsing.GenericParser.#ctor">
<summary>
Constructs an instance of a <see cref="T:GenericParsing.GenericParser"/> with the default settings.
</summary>
<remarks>
When using this constructor, the datasource must be set prior to using the parser
(using <see cref="M:GenericParsing.GenericParser.SetDataSource(System.String)"/>), otherwise an exception will be thrown.
</remarks>
</member>
<member name="M:GenericParsing.GenericParser.#ctor(System.String)">
<summary>
Constructs an instance of a <see cref="T:GenericParsing.GenericParser"/> and sets the initial datasource
as the file referenced by the string passed in.
</summary>
<param name="strFileName">The file name to set as the initial datasource.</param>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.ArgumentException">Supplying a filename to a file that does not exist.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.#ctor(System.String,System.Text.Encoding)">
<summary>
Constructs an instance of a <see cref="T:GenericParsing.GenericParser"/> and sets the initial datasource
as the file referenced by the string passed in with the provided encoding.
</summary>
<param name="strFileName">The file name to set as the initial datasource.</param>
<param name="encoding">The <see cref="T:System.Text.Encoding"/> of the file being referenced.</param>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.ArgumentException">Supplying a filename to a file that does not exist.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.#ctor(System.IO.TextReader)">
<summary>
Constructs an instance of a <see cref="T:GenericParsing.GenericParser"/> and sets the initial datasource
as the <see cref="T:System.IO.TextReader"/> passed in.
</summary>
<param name="txtReader">The <see cref="T:System.IO.TextReader"/> containing the data to be parsed.</param>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.SetDataSource(System.String)">
<summary>
Sets the file as the datasource.
</summary>
<remarks>
If the parser is currently parsing a file, all data associated
with the previous file is lost and the parser is reset back to
its initial values.
</remarks>
<param name="strFileName">The <see cref="T:System.String"/> containing the name of the file
to set as the data source.</param>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
p.SetDataSource(@"C:\MyData.txt");
</code>
</example>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.ArgumentException">Supplying a filename to a file that does not exist.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.SetDataSource(System.String,System.Text.Encoding)">
<summary>
Sets the file as the datasource using the provided encoding.
</summary>
<remarks>
If the parser is currently parsing a file, all data associated
with the previous file is lost and the parser is reset back to
its initial values.
</remarks>
<param name="strFileName">The <see cref="T:System.String"/> containing the name of the file
to set as the data source.</param>
<param name="encoding">The <see cref="T:System.Text.Encoding"/> of the file being referenced.</param>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
p.SetDataSource(@"C:\MyData.txt", Encoding.ASCII);
</code>
</example>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.ArgumentException">Supplying a filename to a file that does not exist.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.SetDataSource(System.IO.TextReader)">
<summary>
Sets the <see cref="T:System.IO.TextReader"/> as the datasource.
</summary>
<param name="txtReader">The <see cref="T:System.IO.TextReader"/> that contains the data to be parsed.</param>
<remarks>
If the parser is currently parsing a file, all data associated with the
previous file is lost and the parser is reset back to its initial values.
</remarks>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
using (StreamReader srReader = new StreamReader(@"C:\MyData.txt"))
p.SetDataSource(srReader);
</code>
</example>
<exception cref="T:System.ArgumentNullException">Supplying <see langword="null"/>.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="M:GenericParsing.GenericParser.Read">
<summary>
<para>
Parses the data-source till it arrives at one row of data.
</para>
</summary>
<returns>
<para>
<see langword="true"/> - Successfully parsed a new data row.
</para>
<para>
<see langword="false"/> - No new data rows were found.
</para>
</returns>
<remarks>
<para>
If it finds a header, and its expecting a header row, it will not stop
at the row and continue on till it has found a row of data.
</para>
<para>
Internally, the header row is treated as a data row, but will not cause
the parser to stop after finding it.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">
Attempting to read without properly setting up the <see cref="T:GenericParsing.GenericParser"/>.
</exception>
<exception cref="T:GenericParsing.ParsingException">
Thrown in the situations where the <see cref="T:GenericParsing.GenericParser"/> cannot continue
due to a conflict between the setup and the data being parsed.
</exception>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser(@"C:\MyData.txt"))
{
while(p.Read())
{
// Put code here to retrieve results of the read.
}
}
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Load(System.Xml.XmlReader)">
<summary>
Loads the configuration of the <see cref="T:GenericParsing.GenericParser"/> object from an <see cref="T:System.Xml.XmlReader"/>.
</summary>
<param name="xrConfigXmlFile">The <see cref="T:System.Xml.XmlReader"/> containing the XmlConfig file to load configuration from.</param>
<exception cref="T:System.ArgumentException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentNullException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentNullException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentOutOfRangeException"/> could be thrown.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
<example>
<code lang="C#" escaped="true">
using (FileStream fs = new FileStream(@"C:\MyData.txt", FileMode.Open))
using (XmlTextReader xmlTextReader = new XmlTextReader(fs))
using (GenericParser p = new GenericParser())
p.Load(xmlTextReader);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Load(System.IO.TextReader)">
<summary>
Loads the configuration of the <see cref="T:GenericParsing.GenericParser"/> object from an <see cref="T:System.IO.TextReader"/>.
</summary>
<param name="trConfigXmlFile">The <see cref="T:System.IO.TextReader"/> containing the XmlConfig file to load configuration from.</param>
<exception cref="T:System.ArgumentException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentNullException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentNullException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentOutOfRangeException"/> could be thrown.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
<example>
<code lang="C#" escaped="true">
using (StreamReader sr = new StreamReader(@"C:\MyData.txt"))
using (GenericParser p = new GenericParser())
p.Load(sr);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Load(System.IO.Stream)">
<summary>
Loads the configuration of the <see cref="T:GenericParsing.GenericParser"/> object from an <see cref="T:System.IO.Stream"/>.
</summary>
<param name="sConfigXmlFile">The <see cref="T:System.IO.Stream"/> containing the XmlConfig file to load configuration from.</param>
<exception cref="T:System.ArgumentException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentNullException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentNullException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentOutOfRangeException"/> could be thrown.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
<example>
<code lang="C#" escaped="true">
using (FileStream fs = new FileStream(@"C:\MyData.txt", FileMode.Open))
using (GenericParser p = new GenericParser())
p.Load(fs);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Load(System.String)">
<summary>
Loads the configuration of the <see cref="T:GenericParsing.GenericParser"/> object from a file on the file system.
</summary>
<param name="strConfigXmlFile">The full path to the XmlConfig file on the file system.</param>
<exception cref="T:System.ArgumentException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentNullException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentNullException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentOutOfRangeException"/> could be thrown.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
p.Load(@"C:\MyData.txt");
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Load(System.Xml.XmlDocument)">
<summary>
Loads the configuration of the <see cref="T:GenericParsing.GenericParser"/> object from an <see cref="T:System.Xml.XmlDocument"/>.
</summary>
<param name="xmlConfig">The <see cref="T:System.Xml.XmlDocument"/> object containing the configuration information.</param>
<exception cref="T:System.ArgumentException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentNullException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentNullException"/> could be thrown.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">In the event that the XmlConfig file contains a value that is invalid,
an <see cref="T:System.ArgumentOutOfRangeException"/> could be thrown.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
<example>
<code lang="C#" escaped="true">
XmlDocument xmlConfig = new XmlDocument();
xmlConfig.Load(strConfigXmlFile);
using (GenericParser p = new GenericParser())
p.Load(xmlConfig);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Save(System.Xml.XmlWriter)">
<summary>
Saves the configuration to a <see cref="T:System.Xml.XmlWriter"/>.
</summary>
<param name="xwXmlConfig">The XmlWriter to save the the <see cref="T:System.Xml.XmlDocument"/> to.</param>
<example>
<code lang="C#" escaped="true">
using (XmlTextWriter xwXmlConfig = new XmlTextWriter(@"C:\MyData.txt", Encoding.Default))
using (GenericParser p = new GenericParser())
p.Save(xwXmlConfig);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Save(System.IO.TextWriter)">
<summary>
Saves the configuration to a <see cref="T:System.IO.TextWriter"/>.
</summary>
<param name="twXmlConfig">The TextWriter to save the <see cref="T:System.Xml.XmlDocument"/> to.</param>
<example>
<code lang="C#" escaped="true">
using (StringWriter sw = new StringWriter())
using (GenericParser p = new GenericParser())
p.Save(sw);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Save(System.IO.Stream)">
<summary>
Saves the configuration to a <see cref="T:System.IO.Stream"/>.
</summary>
<param name="sXmlConfig">The stream to save the <see cref="T:System.Xml.XmlDocument"/> to.</param>
<example>
<code lang="C#" escaped="true">
using (FileStream fs = new FileStream(@"C:\MyData.txt", FileMode.Create))
using (GenericParser p = new GenericParser())
p.Save(fs);
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Save(System.String)">
<summary>
Saves the configuration to the file system.
</summary>
<param name="strConfigXmlFile">The file name to save the <see cref="T:System.Xml.XmlDocument"/> to.</param>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
p.Load(@"C:\MyData.txt");
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Save">
<summary>
Saves the configuration to an <see cref="T:System.Xml.XmlDocument"/>.
</summary>
<returns>The <see cref="T:System.Xml.XmlDocument"/> containing the configuration information.</returns>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
XmlDocument xmlConfig = p.Save();
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Close">
<summary>
Releases the underlying resources of the <see cref="T:GenericParsing.GenericParser"/>.
</summary>
<example>
<code lang="C#" escaped="true">
using (GenericParser p = new GenericParser())
{
p.SetDataSource(@"C:\MyData.txt");
while(p.Read())
{
// Put code here to retrieve results of the read.
}
}
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.GetColumnIndex(System.String)">
<summary>
Returns the index of the column based on its name.
</summary>
<remarks>
<para>
<see langword="null"/> column name is not a valid name for a column.
</para>
<para>
If the column is not found, the column index will be -1.
</para>
</remarks>
<param name="strColumnName">The name of the column to get the index for.</param>
<returns>The index of the column with the name strColumnName. If none exists, -1 will be returned.</returns>
<example>
<code lang="C#" escaped="true">
int intID, intPrice;
bool blnGotIndices = false;
using (GenericParser p = new GenericParser())
{
p.SetDataSource(@"C:\MyData.txt");
p.FirstRowHasHeader = true;
while(p.Read())
{
if (!blnGotIndices)
{
blnGotIndices = true;
intID = p.GetColumnIndex("ID");
intPrice = p.GetColumnIndex("Price");
}
// Put code here to retrieve results of the read.
}
}
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.GetColumnName(System.Int32)">
<summary>
Returns the name of the column based on its index.
</summary>
<param name="intColumnIndex">The column index to return the name for.</param>
<remarks>
If the column is not found or the index is outside the range
of possible columns, <see langword="null"/> will be returned.
</remarks>
<returns>The name of the column at the given index, if none exists <see langword="null"/> is returned.</returns>
<example>
<code lang="C#" escaped="true">
string strColumn1, strColumn2;
bool blnGotColumnNames = false;
using (GenericParser p = new GenericParser())
{
p.SetDataSource(@"C:\MyData.txt");
p.FirstRowHasHeader = true;
while(p.Read())
{
if (!blnGotColumnNames)
{
blnGotColumnNames = true;
strColumn1 = p.GetColumnIndex(0);
strColumn2 = p.GetColumnIndex(1);
}
// Put code here to retrieve results of the read.
}
}
</code>
</example>
</member>
<member name="M:GenericParsing.GenericParser.Dispose">
<summary>
Releases all of the underlying resources used by this instance.
</summary>
<remarks>
Calls <see cref="M:GenericParsing.GenericParser.Dispose(System.Boolean)"/> with blnDisposing set to <see langword="true"/>
to free unmanaged and managed resources.
</remarks>
</member>
<member name="F:GenericParsing.GenericParser.m_ParserState">
<summary>
The current <see cref="T:GenericParsing.ParserState"/> of the parser.
</summary>
</member>
<member name="F:GenericParsing.GenericParser.m_lstData">
<summary>
The current values of all the parsed columns within the row.
</summary>
</member>
<member name="F:GenericParsing.GenericParser.m_lstColumnNames">
<summary>
The current values of all the parsed column headers within the row.
</summary>
</member>
<member name="M:GenericParsing.GenericParser.OnDisposed">
<summary>
Raises the <see cref="E:GenericParsing.GenericParser.Disposed"/> Event.
</summary>
</member>
<member name="M:GenericParsing.GenericParser.Dispose(System.Boolean)">
<summary>
Releases the all unmanaged resources used by this instance and optionally releases the managed resources.
</summary>
<param name="blnDisposing">
<see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.
</param>
</member>
<member name="M:GenericParsing.GenericParser._InitializeParse">
<summary>
Initializes internal variables that are maintained for internal tracking
of state during parsing.
</summary>
<exception cref="T:System.InvalidOperationException">
In the event that the <see cref="T:GenericParsing.GenericParser"/> wasn't setup properly, this exception will be thrown.
</exception>
</member>
<member name="M:GenericParsing.GenericParser._GetNextCharacter">
<summary>
Gets the next character from the input buffer (and refills it if necessary and possible).
</summary>
<returns>
<para>
<see langword="true"/> - A new character was read from the data source.
</para>
<para>
<see langword="false"/> - No more characters are available in the data source.
</para>
</returns>
</member>
<member name="M:GenericParsing.GenericParser._SkipCommentRows">
<summary>
Reads till a non-comment row is found.
</summary>
</member>
<member name="M:GenericParsing.GenericParser._SkipToEndOfText">
<summary>
Reads till the end of the text is found.
</summary>
</member>
<member name="M:GenericParsing.GenericParser._CleanUpParser(System.Boolean)">
<summary>
Removes all references to internally allocated resources. Depending on
<paramref name="blnCompletely"/>, it will free up all of the internal resources
to prepare the instance for disposing.
</summary>
<param name="blnCompletely">
<para>
<see langword="true"/> - Clean-up the entire parser (used for disposing the instance).
</para>
<para>
<see langword="false"/> - Clean-up the parser to all it to be reused later.
</para>
</param>
</member>
<member name="M:GenericParsing.GenericParser._ParseRowType">
<summary>
Examines the beginning of the row and the current state information
to determine how the parser will interpret the next line and updates
the internal RowType accordingly.
</summary>
</member>
<member name="M:GenericParsing.GenericParser._SetColumnNames">
<summary>
Takes the data parsed from the row and places it into the ColumnNames collection.
</summary>
</member>
<member name="M:GenericParsing.GenericParser._HandleEndOfRow(System.Int32)">
<summary>
Handles the logic necessary for updating state due to a row ending.
</summary>
<param name="intEndOfDataIndex">The index of the last character in the column.</param>
<exception cref="T:GenericParsing.ParsingException">
If parsing a fixed width format and the number of columns found differs
what was expected, this exception will be thrown.
</exception>
</member>
<member name="M:GenericParsing.GenericParser._ExtractColumn(System.Int32)">
<summary>
Takes a range within the character buffer and extracts the desired
string from within it and places it into the DataArray. If an escape
character has been set, the escape characters are stripped out and the
unescaped string is returned.
</summary>
<param name="intEndOfDataIndex">The index of the last character in the column.</param>
<exception cref="T:GenericParsing.ParsingException">
In the event that the <see cref="P:GenericParsing.GenericParser.ExpectedColumnCount"/> is set to a value of greater
than zero (which is by default for a fixed width format) and the number of columns
found differs from what's expected, this exception will be thrown.
</exception>
</member>
<member name="M:GenericParsing.GenericParser._CopyRemainingDataToFront(System.Int32)">
<summary>
When the buffer has reached the end of its parsing and there are no more
complete columns to be parsed, the remaining data must be moved up to the
front of the buffer so that the next batch of data can be appended to
the end.
</summary>
<param name="intStartIndex">The index that starts the beginning of the data to be moved.</param>
<exception cref="T:GenericParsing.ParsingException">In the event that the entire buffer is full and a single
column cannot be parsed from it, parsing can no longer continue.</exception>
</member>
<member name="M:GenericParsing.GenericParser._GetColumnName(System.Int32)">
<summary>
Returns the name of the Column based on its ColumnIndex.
</summary>
<param name="intColumnIndex">The column index to return the name for.</param>
<remarks>
If the column is not found or the index is outside the range
of possible columns, <see langword="null"/> will be returned.
</remarks>
<returns>The name of the column at the given ColumnIndex, if
none exists <see langword="null"/> is returned.</returns>
</member>
<member name="M:GenericParsing.GenericParser._GetColumnIndex(System.String)">
<summary>
Returns the index of the Column based on its Name.
</summary>
<remarks>
<para>
<see langword="null"/> column name is not a valid name for a column.
</para>
<para>
If the column is not found, the column index will be -1.
</para>
</remarks>
<param name="strColumnName">The name of the column to find the index for.</param>
<returns>The index of the column with the name strColumnName.
If none exists, -1 will be returned.</returns>
</member>
<member name="M:GenericParsing.GenericParser._CreateParsingException(System.String)">
<summary>
Creates a detailed message for a parsing exception and then throws it.
</summary>
<param name="strMessage">The exception specific information to go into the <see cref="T:GenericParsing.ParsingException"/>.</param>
<returns>The <see cref="T:GenericParsing.ParsingException"/> with the provided message.</returns>
</member>
<member name="M:GenericParsing.GenericParser._InitializeConfigurationVariables">
<summary>
Initializes the parsing variables for the GenericParser.
</summary>
</member>
<member name="P:GenericParsing.GenericParser.IsDisposed">
<summary>
Gets whether or not the instance has been disposed of.
</summary>
<value>
<para>
<see langword="true"/> - Indicates the instance has be disposed of.
</para>
<para>
<see langword="false"/> - Indicates the instance has not be disposed of.
</para>
</value>
</member>
<member name="P:GenericParsing.GenericParser.ColumnWidths">
<summary>
Gets or sets an integer array indicating the number of characters needed for each column.
</summary>
<value>An int[] containing the number of spaces for each column.</value>
<remarks>
<para>
If parsing has started, this value cannot be updated.
</para>
<para>
By setting this property, the <see cref="P:GenericParsing.GenericParser.TextFieldType"/> and <see cref="P:GenericParsing.GenericParser.ExpectedColumnCount"/> are automatically updated.
</para>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">Passing in an empty array or an
array of values that have a number less than one.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.MaxBufferSize">
<summary>
Gets or sets the maximum size of the internal buffer used to cache the data.
</summary>
<value>The maximum size of the internal buffer to cache data from the datasource.</value>
<remarks>
<para>
Maintaining the smallest number possible here improves memory usage, but
trades it off for higher CPU usage. The <see cref="P:GenericParsing.GenericParser.MaxBufferSize"/> must
be at least the size of one column of data, plus the Max(column delimiter
width, row delimiter width).
</para>
<para>
Default: 4096
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">Setting the value to something less than one.</exception>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.MaxRows">
<summary>
Gets or sets the maximum number of rows to parse.
</summary>
<value>The maximum number of rows to parse.</value>
<remarks>
<para>
Setting the value to zero will cause all of the rows to be returned.
</para>
<para>
Default: 0
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.SkipStartingDataRows">
<summary>
Gets or sets the number of rows of data to ignore at the start of the file.
</summary>
<value>The number of data rows to initially skip in the datasource.</value>
<remarks>
<para>
The header row (if present) and comment rows will not be taken into account
when determining the number of rows to skip. Setting the value to zero will
cause no rows to be ignored.
</para>
<para>
Default: 0
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.DataRowNumber">
<summary>
Gets or sets the number of rows of data that have currently been parsed.
</summary>
<value>The number of rows of data that have been parsed.</value>
<remarks>The DataRowNumber property is read-only.</remarks>
</member>
<member name="P:GenericParsing.GenericParser.FileRowNumber">
<summary>
Gets or sets how many rows in the file have been parsed.
</summary>
<value>The number of rows in the file that have been parsed.</value>
<remarks>The <see cref="P:GenericParsing.GenericParser.FileRowNumber"/> property is read-only and includes all
rows possible (header, comment, and data).</remarks>
</member>
<member name="P:GenericParsing.GenericParser.ExpectedColumnCount">
<summary>
Gets or sets the expected number of columns to find in the data. If
the number of columns differs, an exception will be thrown.
</summary>
<value>The number of columns expected per row of data.</value>
<remarks>
<para>
Setting the value to zero will cause the <see cref="T:GenericParsing.GenericParser"/> to ignore
the column count in case the number changes per row.
</para>
<para>
Default: 0
</para>
<para>
By setting this property, the <see cref="P:GenericParsing.GenericParser.TextFieldType"/> and <see cref="P:GenericParsing.GenericParser.ColumnWidths"/>
are automatically updated.
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.FirstRowHasHeader">
<summary>
Gets or sets whether or not the first row of data in the file contains
the header information.
</summary>
<value>
<para>
<see langword="true"/> - Header found on first 'data row'.
</para>
<para>
<see langword="false"/> - Header row does not exist.
</para>
</value>
<remarks>
<para>
Default: <see langword="false"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.TrimResults">
<summary>
Gets or sets whether or not to trim the values for each column.
</summary>
<value>
<para>
<see langword="true"/> - Indicates to trim the resulting strings.
</para>
<para>
<see langword="false"/> - Indicates to not trim the resulting strings.
</para>
</value>
<remarks>
<para>
Trimming only occurs on the strings if they are not text qualified.
So by placing values in quotes, it preserves all whitespace within
quotes.
</para>
<para>
Default: <see langword="false"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.StripControlChars">
<summary>
Gets or sets whether or not to strip control characters out of the input.
</summary>
<value>
<para>
<see langword="true"/> - Indicates to remove control characters from the input.
</para>
<para>
<see langword="false"/> - Indicates to leave control characters in the input.
</para>
</value>
<remarks>
<para>
Setting this to <see langword="true"/> can cause a performance boost.
</para>
<para>
Default: <see langword="false"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.SkipEmptyRows">
<summary>
Gets or sets whether or not to skip empty rows in the input.
</summary>
<value>
<para>
<see langword="true"/> - Indicates to skip empty rows in the input.
</para>
<para>
<see langword="false"/> - Indicates to include empty rows in the input.
</para>
</value>
<remarks>
<para>
Default: <see langword="true"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.IsCurrentRowEmpty">
<summary>
Gets whether or not the current row is an empty row.
</summary>
</member>
<member name="P:GenericParsing.GenericParser.TextFieldType">
<summary>
Gets or sets the <see cref="T:GenericParsing.FieldType"/> of the data encoded in the rows.
</summary>
<remarks>
<para>
By setting <see cref="P:GenericParsing.GenericParser.ColumnWidths"/>, this property is automatically set.
</para>
<para>
Default: <see cref="F:GenericParsing.FieldType.Delimited"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.FirstRowSetsExpectedColumnCount">
<summary>
Gets or sets the number of columns in the header/first data row determines
the expected number of columns in the data.
</summary>
<value>
<para>
<see langword="true"/> - Indicates the data's column count should match the header/first data row's column count.
</para>
<para>
<see langword="false"/> - Indicates the data's column count does not necessarily match the header/first data row's column count.
</para>
</value>
<remarks>
<para>
If set to <see langword="true"/>, <see cref="T:GenericParsing.FieldType"/> will automatically be set to <see langword="false"/>.
</para>
<para>
Default: <see langword="false"/>
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.State">
<summary>
Gets the <see cref="T:GenericParsing.ParserState"/> value indicating the current
internal state of the parser.
</summary>
<value>The <see cref="P:GenericParsing.GenericParser.State"/> property is read-only and is used to return
information about the internal state of the parser.</value>
</member>
<member name="P:GenericParsing.GenericParser.ColumnDelimiter">
<summary>
Gets or sets the character used to match the end of a column of data.
</summary>
<value>Contains the character used to delimit a column.</value>
<remarks>
<para>
By setting this property, the <see cref="P:GenericParsing.GenericParser.TextFieldType"/> is automatically
updated. This is only meaningful when performing delimited parsing.
</para>
<para>
Default: ','
</para>
<para>
If parsing has started, this value cannot be updated.
</para>
</remarks>
<exception cref="T:System.InvalidOperationException">Attempting to modify the configuration, while parsing.</exception>
</member>
<member name="P:GenericParsing.GenericParser.TextQualifier">
<summary>
Gets or sets the character that is used to enclose a string that would otherwise
be potentially trimmed (Ex. " this ").
</summary>
<value>
The character used to enclose a string, so that row/column delimiters are ignored
and whitespace is preserved.
</value>
<remarks>
<para>
The Text Qualifiers must be present at the beginning and end of the column to
have them properly removed from the ends of the string. Furthermore, for a
string that has been enclosed with the text qualifier, if the text qualifier is
doubled up inside the string, the characters will be treated as an escape for
the literal character of the text qualifier (ie. "This""Test" will translate
with only one double quote inside the string).
</para>
<para>
Setting this to <see langword="null"/> can cause a performance boost, if none of the values are
expected to require escaping.
</para>
<para>
Default: '\"'
</para>
<para>