From 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 12 May 2023 09:24:40 +0800 Subject: *misc --- .../examples/configuration/attributes/index.html | 472 ++++++++++++++++ .../class-maps/auto-mapping/index.html | 462 ++++++++++++++++ .../class-maps/constant-value/index.html | 464 ++++++++++++++++ .../class-maps/ignoring-properties/index.html | 463 ++++++++++++++++ .../examples/configuration/class-maps/index.html | 489 +++++++++++++++++ .../class-maps/inline-type-conversion/index.html | 515 ++++++++++++++++++ .../mapping-by-alternate-names/index.html | 462 ++++++++++++++++ .../class-maps/mapping-by-index/index.html | 465 ++++++++++++++++ .../class-maps/mapping-by-name/index.html | 462 ++++++++++++++++ .../class-maps/mapping-duplicate-names/index.html | 464 ++++++++++++++++ .../class-maps/mapping-properties/index.html | 462 ++++++++++++++++ .../class-maps/optional-maps/index.html | 464 ++++++++++++++++ .../class-maps/type-conversion/index.html | 482 +++++++++++++++++ .../configuration/class-maps/validation/index.html | 463 ++++++++++++++++ .../docs/examples/configuration/index.html | 450 ++++++++++++++++ .../docs/examples/csvdatareader/index.html | 460 ++++++++++++++++ .../CsvHelper-master/docs/examples/index.html | 465 ++++++++++++++++ .../docs/examples/prerequisites/index.html | 454 ++++++++++++++++ .../reading-and-writing-files/index.html | 480 +++++++++++++++++ .../docs/examples/prerequisites/streams/index.html | 453 ++++++++++++++++ .../prerequisites/using-and-dispose/index.html | 444 +++++++++++++++ .../reading/enumerate-class-records/index.html | 457 ++++++++++++++++ .../reading/get-anonymous-type-records/index.html | 451 ++++++++++++++++ .../examples/reading/get-class-records/index.html | 452 ++++++++++++++++ .../reading/get-dynamic-records/index.html | 446 +++++++++++++++ .../docs/examples/reading/index.html | 469 ++++++++++++++++ .../examples/reading/reading-by-hand/index.html | 463 ++++++++++++++++ .../reading/reading-multiple-data-sets/index.html | 514 ++++++++++++++++++ .../reading-multiple-record-types/index.html | 497 +++++++++++++++++ .../custom-type-converter/index.html | 480 +++++++++++++++++ .../docs/examples/type-conversion/index.html | 596 +++++++++++++++++++++ .../type-converter-options/index.html | 450 ++++++++++++++++ .../appending-to-an-existing-file/index.html | 476 ++++++++++++++++ .../docs/examples/writing/index.html | 483 +++++++++++++++++ .../write-anonymous-type-objects/index.html | 450 ++++++++++++++++ .../writing/write-class-objects/index.html | 456 ++++++++++++++++ .../writing/write-dynamic-objects/index.html | 454 ++++++++++++++++ 37 files changed, 17389 insertions(+) create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/constant-value/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/ignoring-properties/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/inline-type-conversion/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-alternate-names/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-index/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-name/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-duplicate-names/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-properties/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/optional-maps/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/type-conversion/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/validation/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/csvdatareader/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/prerequisites/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/prerequisites/reading-and-writing-files/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/prerequisites/streams/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/prerequisites/using-and-dispose/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/enumerate-class-records/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/get-anonymous-type-records/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/get-class-records/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/get-dynamic-records/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/reading-by-hand/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-data-sets/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-record-types/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/type-conversion/custom-type-converter/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/type-conversion/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/type-conversion/type-converter-options/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/writing/appending-to-an-existing-file/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/writing/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/writing/write-anonymous-type-objects/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/writing/write-class-objects/index.html create mode 100644 ThirdParty/CsvHelper-master/docs/examples/writing/write-dynamic-objects/index.html (limited to 'ThirdParty/CsvHelper-master/docs/examples') diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html new file mode 100644 index 0000000..a5e958f --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + Attributes | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Attributes

+

Most of the configuration done via class maps can also be done using attributes.

+
Data
+
Identifier,name,IsBool,Constant
+1,one,yes,a
+2,two,no,b
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		csv.GetRecords<Foo>().ToList().Dump();
+	}
+}
+
+[Delimiter(",")]
+[CultureInfo("")]  // Set CultureInfo to InvariantCulture
+public class Foo
+{
+	[Name("Identifier")]
+	public int Id { get; set; }
+	
+	[Index(1)]
+	public string Name { get; set; }
+	
+	[BooleanTrueValues("yes")]
+	[BooleanFalseValues("no")]
+	public bool IsBool { get; set; }
+	
+	[Constant("bar")]
+	public string Constant { get; set; }
+	
+	[Optional]
+	public string Optional { get; set; }
+	
+	[Ignore]
+	public string Ignored { get; set; }	
+}
+
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html new file mode 100644 index 0000000..e410ab5 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + Auto Mapping | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Auto Mapping

+

If you don't supply a map to the configuration, one is automatically created for you on the fly. You can call auto mapping directly in your class map also. You may want to do this if you have a large number of properties that will be set up correctly by default, and only need to make a couple changes.

+
Data
+
Id,The Name
+1,one
+
+
Example
+
void Main()
+{	   
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		AutoMap(CultureInfo.InvariantCulture);
+		Map(m => m.Name).Name("The Name");
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/constant-value/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/constant-value/index.html new file mode 100644 index 0000000..8c4b933 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/constant-value/index.html @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + Constant Value | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Constant Value

+

You can set a constant value to a property instead of mapping it to a field.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{       
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+    public bool IsDirty { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+		Map(m => m.Id);
+		Map(m => m.Name);
+        Map(m => m.IsDirty).Constant(true);
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/ignoring-properties/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/ignoring-properties/index.html new file mode 100644 index 0000000..8a8b126 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/ignoring-properties/index.html @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + Ignoring Properties | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Ignoring Properties

+

When you use auto mapping in your class map, every property will get mapped. If there are properties that you don't want mapped, you can ignore them.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{       
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+    public bool IsDirty { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        AutoMap(CultureInfo.InvariantCulture);
+        Map(m => m.IsDirty).Ignore();
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/index.html new file mode 100644 index 0000000..26c946e --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/index.html @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + Class Maps | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Class Maps

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Topics 
Mapping PropertiesMapping to properties.
Mapping by NameMapping properties by header name.
Mapping by Alternate NamesMapping properties that may be one of many names.
Mapping Duplicate NamesMapping properties that have duplicate header names.
Mapping by IndexMapping properties by header index position.
Auto MappingAutomatic mapping.
Ignoring PropertiesIgnoring mapped properites.
Constant ValueSetting a constant value for a property.
Type ConversionUsing a specific type converter.
Inline Type ConversionConvert a field to a type inline.
Optional MapsMap a property only if it exists.
ValidationValidate a field value.
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/inline-type-conversion/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/inline-type-conversion/index.html new file mode 100644 index 0000000..0ec199e --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/inline-type-conversion/index.html @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + Inline Type Conversion | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Inline Type Conversion

+

If you don't want to write a full ITypeConverter implementation, you can specify a function that will do the same thing.

+

Reading

+
Data
+
Id,Name,Json
+1,one,"{ ""Foo"": ""Bar"" }"
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        csv.GetRecords<Foo>().ToList().Dump();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+    public Json Json { get; set; }
+}
+
+public class Json
+{
+    public string Foo { get; set; }
+}
+
+public class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id);
+        Map(m => m.Name);
+        Map(m => m.Json).Convert(row => JsonConvert.DeserializeObject<Json>(row.GetField("Json")));
+    }
+}
+
+

Writing

+
Example
+
void Main()
+{
+	var records = new List<Foo>
+	{
+		new Foo { Id = 1, Name = "one" }
+	};
+	
+	using (var writer = new StreamWriter("path\\to\\file.csv"))
+	using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+	{
+		csv.Context.RegisterClassMap<FooMap>();
+		csv.WriteRecords(records);
+		
+		writer.ToString().Dump();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+	public Json Json { get; set; }
+}
+
+public class Json
+{
+	public string Foo { get; set; }
+}
+
+public class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id);
+		Map(m => m.Name);
+		Map(m => m.Json).Convert(o => JsonConvert.SerializeObject(o));
+	}
+}
+
+
Output
+
Id,Name,Json
+1,one,"{""Id"":1,""Name"":""one"",""Json"":null}"
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-alternate-names/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-alternate-names/index.html new file mode 100644 index 0000000..62e3bd7 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-alternate-names/index.html @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + Mapping By Alternate Names | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Mapping by Alternate Names

+

If you have a header name that could vary, you can specify multiple header names.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id).Name("TheId", "Id");
+        Map(m => m.Name).Name("TheName", "Name");
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-index/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-index/index.html new file mode 100644 index 0000000..9aa7759 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-index/index.html @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + Mapping By Index | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Mapping by Index

+

If your data doesn't have a header you can map by index instead of name. You can't rely on the order of class properties in .NET, so if you're not mapping by name, make sure you specify an index.

+
Data
+
1,one
+
+
Example
+
void Main()
+{
+    var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+    {
+        HasHeaderRecord = false,
+    };
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, config))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id).Index(0);
+        Map(m => m.Name).Index(1);
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-name/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-name/index.html new file mode 100644 index 0000000..cb15885 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-by-name/index.html @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + Mapping By Name | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Mapping by Name

+

If your property names don't match your class names, you can map the property to the column by name.

+
Data
+
ColumnA,ColumnB
+1,one
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		csv.Context.RegisterClassMap<FooMap>();
+		var records = csv.GetRecords<Foo>();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id).Name("ColumnA");
+		Map(m => m.Name).Name("ColumnB");
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-duplicate-names/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-duplicate-names/index.html new file mode 100644 index 0000000..d7dc521 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-duplicate-names/index.html @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + Mapping Duplicate Names | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Mapping Duplicate Names

+

Sometimes you have duplicate header names. This is handled through a header name index. The name index is the index of how many occurrences of that header name there are, not the position of the header.

+
Data
+
Id,Name,Name
+1,first,last
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string FirstName { get set; }
+	public string LastName { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id);
+        Map(m => m.FirstName).Name("Name").NameIndex(0);
+		Map(m => m.LastName).Name("Name").NameIndex(1);
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-properties/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-properties/index.html new file mode 100644 index 0000000..05640ec --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/mapping-properties/index.html @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + Mapping Properties | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Mapping Properties

+

This will map the properties of a class to the header names of the CSV data. The mapping needs to be registered in the context. This example is identical to not using a class mapping at all. The headers match the property names.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{		
+		csv.Context.RegisterClassMap<FooMap>();
+		var records = csv.GetRecords<Foo>();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }	
+	public string Name { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id);
+		Map(m => m.Name);
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/optional-maps/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/optional-maps/index.html new file mode 100644 index 0000000..d57dcad --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/optional-maps/index.html @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + Optional Maps | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Optional Maps

+

If you have data that may or may not have a header, you can make the mapping optional.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		csv.Context.RegisterClassMap<FooMap>();
+		csv.GetRecords<Foo>().ToList().Dump();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+	public DateTimeOffset? Date { get; set; }
+}
+
+public class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id);
+		Map(m => m.Name);
+		Map(m => m.Date).Optional();
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/type-conversion/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/type-conversion/index.html new file mode 100644 index 0000000..56bf740 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/type-conversion/index.html @@ -0,0 +1,482 @@ + + + + + + + + + + + + + + + + + + + + + + + Type Conversion | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Type Conversion

+

If you need to convert to or from a non-standard .NET type, you can supply a type converter to use for a property.

+
Data
+
Id,Name,Json
+1,one,"{ ""Foo"": ""Bar"" }"
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		csv.Context.RegisterClassMap<FooMap>();
+		csv.GetRecords<Foo>().ToList().Dump();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+	public Json Json { get; set; }
+}
+
+public class Json
+{
+	public string Foo { get; set; }
+}
+
+public class JsonConverter<T> : DefaultTypeConverter
+{
+	public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
+	{
+		return JsonConvert.DeserializeObject<T>(text);
+	}
+
+	public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
+	{
+		return JsonConvert.SerializeObject(value);
+	}
+}
+
+public class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id);
+		Map(m => m.Name);
+		Map(m => m.Json).TypeConverter<JsonConverter<Json>>();
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/validation/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/validation/index.html new file mode 100644 index 0000000..b97f314 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/validation/index.html @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + Validation | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Validation

+

If you want to ensure your data conforms to some sort of standard, you can validate it.

+
Data
+
Id,Name
+1,on-e
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        csv.GetRecords<Foo>().ToList().Dump();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+    public DateTimeOffset? Date { get; set; }
+}
+
+public class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id);
+        Map(m => m.Name).Validate(field => !field.Contains("-"));
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/index.html new file mode 100644 index 0000000..061d5b8 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/index.html @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + Configuration | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Configuration

+

Topics

+ + + + + + + + + + + + + + + + + +
  
Class MapsConfigure CSV structure with a class map.
AttributesConfigure CSV structure with attributes.
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/csvdatareader/index.html b/ThirdParty/CsvHelper-master/docs/examples/csvdatareader/index.html new file mode 100644 index 0000000..5a9f0f1 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/csvdatareader/index.html @@ -0,0 +1,460 @@ + + + + + + + + + + + + + + + + + + + + + + + Csvdatareader | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

CsvDataReader

+

The question on how to load a data table using CsvHelper came up so often that I just built the functionality in.

+

CsvDataReader implements IDataReader. This means it has all the capabilities of a forward only data reader. There is really no reason to use this class directly over using CsvReader. CsvDataReader requires an instance of CsvReader and uses it internally to do it's work.

+

Loading a DataTable in CsvHelper is simple. By default, a table will be loaded with all columns populated as strings. For the reader to be ready after instantiation, the first row needs to be read immediately, so you need to make any configuration changes before creating an instance of CsvDataReader.

+
using (var reader = new StreamReader("path\\to\\file.csv"))
+using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+{
+	// Do any configuration to `CsvReader` before creating CsvDataReader.
+	using (var dr = new CsvDataReader(csv))
+	{		
+		var dt = new DataTable();
+		dt.Load(dr);
+	}
+}
+
+

If you want to specify columns and column types, the data table will be loaded with the types automatically converted.

+
using (var reader = new StreamReader("path\\to\\file.csv"))
+using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+{
+	// Do any configuration to `CsvReader` before creating CsvDataReader.
+	using (var dr = new CsvDataReader(csv))
+	{		
+		var dt = new DataTable();
+		dt.Columns.Add("Id", typeof(int));
+		dt.Columns.Add("Name", typeof(string));
+
+		dt.Load(dr);
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/index.html b/ThirdParty/CsvHelper-master/docs/examples/index.html new file mode 100644 index 0000000..a1d8adc --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/index.html @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + Examples | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Examples

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Sections 
PrerequisitesImplied knowledge when using CsvHelper.
ReadingReading CSV data.
WritingWriting CSV data.
ConfigurationConfiguring the behavior of CsvHelper to work with your CSV data or custom class structures.
Type ConversionUsing type conversion to convert CSV fields to and from .NET types.
DataReaderUsing a DataTable to read CSV data.
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/prerequisites/index.html b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/index.html new file mode 100644 index 0000000..3e6af69 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/index.html @@ -0,0 +1,454 @@ + + + + + + + + + + + + + + + + + + + + + + + Prerequisites | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Prerequisites

+

Here are some prerequisites that are needed for using CsvHelper. These are .NET basics that are implied knowledge when using CsvHelper. Microsoft has excellent documentation that can you can use to learn more.

+ + + + + + + + + + + + + + + + + + + + + +
Topics 
Using and Dispose
Reading and Writing Files
Streams
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/prerequisites/reading-and-writing-files/index.html b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/reading-and-writing-files/index.html new file mode 100644 index 0000000..72fa8a0 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/reading-and-writing-files/index.html @@ -0,0 +1,480 @@ + + + + + + + + + + + + + + + + + + + + + + + Reading And Writing Files | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Reading and Writing Files

+

To open a file for reading or writing, we can use System.IO.File.

+
using (var stream = File.OpenRead("path\\to\\file.csv"))
+{
+}
+
+using (var stream = File.OpenWrite("path\\to\\file.csv"))
+{	
+}
+
+

These both return a FileStream for working with our file. Since our data is text, we will need to use a StreamReader and StreamWriter to read and write the text.

+
using (var stream = File.OpenRead("path\\to\\file.csv"))
+using (var reader = new StreamReader(stream))
+{
+}
+
+using (var stream = File.OpenWrite("path\\to\\file.csv"))
+using (var writer = new StreamWriter(stream))
+{	
+}
+
+

StreamReader and StreamWriter have shortcuts for doing this.

+
using (var reader = new StreamReader("path\\to\\file.csv"))
+{
+}
+
+using (var writer = new StreamWriter("path\\to\\file.csv"))
+{	
+}
+
+

CsvHelper doesn't know anything about your encoding, so if you have a specific encoding, you'll need to specify that in your stream.

+
using (var reader = new StreamReader("path\\to\\file.csv", Encoding.UTF8))
+{
+}
+
+using (var writer = new StreamWriter("path\\to\\file.csv", Encoding.UTF8))
+{	
+}
+
+

CsvReader and CsvWriter take a TextReader and TextWriter in their constructors. TextReader and TextWriter are abstract classes for reading and writing text. StreamReader inherits TextReader and StreamWriter inherits TextWriter, so we can use those with CsvReader and CsvWriter.

+
using (var reader = new StreamReader("path\\to\\file.csv"))
+using (var csv = new CsvReader(reader))
+{
+}
+
+using (var writer = new StreamWriter("path\\to\\file.csv"))
+using (var csv = new CsvWriter(writer))
+{	
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/prerequisites/streams/index.html b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/streams/index.html new file mode 100644 index 0000000..4168219 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/streams/index.html @@ -0,0 +1,453 @@ + + + + + + + + + + + + + + + + + + + + + + + Streams | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Streams

+

When reading from a stream, if you need to go back to the beginning of the stream, you can use the Stream.Position property.

+
using (var stream = new File.OpenRead("path\\to\\file"))
+using (var reader = new StreamReader(stream))
+{	
+	// Read file content.
+	var content = reader.ReadToEnd();
+
+	// Go back to beginning of the stream.
+	stream.Position = 0;
+
+	// Read file content again.
+	content = reader.ReadToEnd();
+}
+
+

When writing to a file, you need to flush the writer for the data to be written to the stream. StreamWriter contains an internal buffer and the data is only written to the stream when the buffer is full, or Flush is called. Flush is automatically called when a using block exits.

+
using (var stream = new File.OpenWrite("path\\to\\file"))
+using (var writer = new StreamWriter(stream))
+{	
+	writer.WriteLine("Foo");
+	writer.Flush(); // Data is written from the writer buffer to the stream.
+} // Flush is also called here.
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/prerequisites/using-and-dispose/index.html b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/using-and-dispose/index.html new file mode 100644 index 0000000..1b06644 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/prerequisites/using-and-dispose/index.html @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + Using And Dispose | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Using and Dispose

+

Whenever you have an object the implements IDisposable, you need to dispose of the resource when you're done with it. Most classes that use unmanaged resources will implement IDisposable. This means a lot of classes in the System.IO namespace will need to be disposed of.

+

The best practice to dispose of an object when you're done with it is to wrap the code in a using block. When the using block exits, the resource will automatically be disposed of as soon as possible.

+
using (var stream = new MemoryStream())
+{
+	// Use the stream.
+}
+// The stream will be disposed of as soon as possible.
+
+

If you need to keep keep it around for a while and dispose of it later, using does some error handling for you, so it's still a good idea to use it instead of calling Dispose directly. There is some debate on whether this is a good idea because it doesn't show intent.

+
var stream = new MemoryStream();
+// Later in a different part of your code.
+using (stream) { }
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/enumerate-class-records/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/enumerate-class-records/index.html new file mode 100644 index 0000000..4102d5d --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/enumerate-class-records/index.html @@ -0,0 +1,457 @@ + + + + + + + + + + + + + + + + + + + + + + + Enumerate Class Records | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Enumerate Class Records

+

Convert CSV rows into a class object that is re-used on every iteration of the enumerable. Each enumeration will hydrate the given record, but only the mapped members. If you supplied a map and didn't map one of the members, that member will not get hydrated with the current row's data. Be careful. Any methods that you call on the projection that force the evaluation of the IEnumerable, such as ToList(), you will get a list where all the records are the same instance you provided that is hydrated with the last record in the CSV file.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+		var record = new Foo();
+        var records = csv.EnumerateRecords(record);
+		foreach (var r in records)
+		{
+			// r is the same instance as record.
+		}
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/get-anonymous-type-records/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/get-anonymous-type-records/index.html new file mode 100644 index 0000000..44e5bac --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/get-anonymous-type-records/index.html @@ -0,0 +1,451 @@ + + + + + + + + + + + + + + + + + + + + + + + Get Anonymous Type Records | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Get Anonymous Type Records

+

Convert CSV rows into anonymous type objects. You just need to supply the anonymous type definition.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+		var anonymousTypeDefinition = new
+		{
+			Id = default(int),
+			Name = string.Empty
+		};
+        var records = csv.GetRecords(anonymousTypeDefinition);
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/get-class-records/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/get-class-records/index.html new file mode 100644 index 0000000..98045ef --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/get-class-records/index.html @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + Get Class Records | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Get Class Records

+

Convert CSV rows into class objects.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		var records = csv.GetRecords<Foo>();
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/get-dynamic-records/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/get-dynamic-records/index.html new file mode 100644 index 0000000..d1b8eb8 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/get-dynamic-records/index.html @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + Get Dynamic Records | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Get Dynamic Records

+

Convert CSV rows into dynamic objects. Since there is no way to tell what type the properties should be, all the properties on the dynamic object are strings.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        var records = csv.GetRecords<dynamic>();
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/index.html new file mode 100644 index 0000000..cb0538a --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/index.html @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + + + + Reading | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ +
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/reading-by-hand/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-by-hand/index.html new file mode 100644 index 0000000..dc8cb29 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-by-hand/index.html @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + Reading By Hand | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Reading by Hand

+

Sometimes it's easier to not try and configure a mapping to match your class definition for various reasons. It's usually only a few more lines of code to just read the rows by hand instead.

+
Data
+
Id,Name
+1,one
+
+
Example
+
void Main()
+{
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        var records = new List<Foo>();
+		csv.Read();
+		csv.ReadHeader();
+		while (csv.Read())
+		{
+			var record = new Foo
+			{
+				Id = csv.GetField<int>("Id"),
+				Name = csv.GetField("Name")
+			};
+			records.Add(record);
+		}
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-data-sets/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-data-sets/index.html new file mode 100644 index 0000000..baba878 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-data-sets/index.html @@ -0,0 +1,514 @@ + + + + + + + + + + + + + + + + + + + + + + + Reading Multiple Data Sets | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Reading Multiple Data Sets

+

For some reason there are CSV files out there that contain multiple sets of CSV data in them. You should be able to read files like this without issue. You will need to detect when to change class types you are retreiving.

+
Data
+
FooId,Name
+1,foo
+
+BarId,Name
+07a0fca2-1b1c-4e44-b1be-c2b05da5afc7,bar
+
+
Example
+
void Main()
+{
+    var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+	{
+		IgnoreBlankLines = false,		
+	};
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, config))
+    {
+		csv.Context.RegisterClassMap<FooMap>();
+		csv.Context.RegisterClassMap<BarMap>();
+		var fooRecords = new List<Foo>();
+		var barRecords = new List<Bar>();
+		var isHeader = true;
+		while (csv.Read())
+		{
+			if (isHeader)
+			{
+				csv.ReadHeader();
+				isHeader = false;
+				continue;
+			}
+			
+			if (string.IsNullOrEmpty(csv.GetField(0)))
+			{
+				isHeader = true;
+				continue;
+			}
+
+			switch (csv.HeaderRecord[0])
+			{
+				case "FooId":
+					fooRecords.Add(csv.GetRecord<Foo>());
+					break;
+				case "BarId":
+					barRecords.Add(csv.GetRecord<Bar>());
+					break;
+				default:
+					throw new InvalidOperationException("Unknown record type.");
+			}
+		}
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+}
+
+public class Bar
+{
+	public Guid Id { get; set; }
+	public string Name { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id).Name("FooId");
+		Map(m => m.Name);
+	}
+}
+
+public sealed class BarMap : ClassMap<Bar>
+{
+	public BarMap()
+	{
+		Map(m => m.Id).Name("BarId");
+		Map(m => m.Name);
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-record-types/index.html b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-record-types/index.html new file mode 100644 index 0000000..c86999e --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/reading/reading-multiple-record-types/index.html @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + Reading Multiple Record Types | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Reading Multiple Record Types

+

If you have CSV data where each row may be a different record type, you should be able to read based on a row type or something similar.

+
Data
+
A,1,foo
+B,07a0fca2-1b1c-4e44-b1be-c2b05da5afc7,bar
+
+
Example
+
void Main()
+{
+	var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+	{
+		HasHeaderRecord = false,
+	};
+    using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, config))
+    {
+		csv.Context.RegisterClassMap<FooMap>();
+		csv.Context.RegisterClassMap<BarMap>();
+		var fooRecords = new List<Foo>();
+		var barRecords = new List<Bar>();
+		while (csv.Read())
+		{
+			switch (csv.GetField(0))
+			{
+				case "A":
+					fooRecords.Add(csv.GetRecord<Foo>());
+					break;
+				case "B":
+					barRecords.Add(csv.GetRecord<Bar>());
+					break;
+				default:
+					throw new InvalidOperationException("Unknown record type.");
+			}
+		}
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+}
+
+public class Bar
+{
+	public Guid Id { get; set; }
+	public string Name { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		Map(m => m.Id).Index(1);
+		Map(m => m.Name).Index(2);
+	}
+}
+
+public sealed class BarMap : ClassMap<Bar>
+{
+	public BarMap()
+	{
+		Map(m => m.Id).Index(1);
+		Map(m => m.Name).Index(2);
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/type-conversion/custom-type-converter/index.html b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/custom-type-converter/index.html new file mode 100644 index 0000000..39ceb3f --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/custom-type-converter/index.html @@ -0,0 +1,480 @@ + + + + + + + + + + + + + + + + + + + + + + + Custom Type Converter | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Custom Type Converters

+

The built in type converters will handle most situations for you, but if you find +a situation where they don't you can create your own type converter.

+

You can register the converter globally or per member via an attribute or class map. +You only need to use one, but all are shown in the example.

+
Data
+
Id,Name,Json
+1,one,"{""foo"": ""bar""}"
+
+
Example
+
void Main()
+{
+    using (var reader = new new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        // Register globally.
+        csv.Context.TypeConverterCache.AddConverter<JsonNode>(new JsonNodeConverter());
+        csv.Context.RegisterClassMap<FooMap>();
+        csv.GetRecords<Foo>().ToList().Dump();
+    }
+}
+
+public class Foo
+{
+    public int Id { get; set; }
+    public string Name { get; set; }
+    // Register via attribute.
+    [TypeConverter(typeof(JsonNodeConverter))]
+    public JsonNode Json { get; set; }
+}
+
+public class FooMap : ClassMap<Foo>
+{
+    public FooMap()
+    {
+        Map(m => m.Id);
+        Map(m => m.Name);
+        // Register via map.
+        Map(m => m.Json).TypeConverter<JsonNodeConverter>();
+    }
+}
+
+public class JsonNodeConverter : DefaultTypeConverter
+{
+    public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
+    {
+        return JsonSerializer.Deserialize<JsonNode>(text);
+    }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/type-conversion/index.html b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/index.html new file mode 100644 index 0000000..9c01ea2 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/index.html @@ -0,0 +1,596 @@ + + + + + + + + + + + + + + + + + + + + + + + Type Conversion | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Type Conversion

+

When reading and writing a custom class will get converted to and from +a CSV row. Each CSV field can be converted to and from a class property.
+This conversion for class properties is done via type converters.

+

There are many built in converters already available to you.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CsvHelper ConverterC# type keyword.NET Type
ArrayConverter[ ]System.Array
BigIntegerConverterSystem.Numerics.BigInteger
BooleanConverterboolSystem.Boolean
ByteArrayConverterbyte[ ]System.Array
ByteConverterbyteSystem.Byte
CharConvertercharSystem.Char
CollectionGenericConverterSystem.Collections.Generic.Collection<T>, System.Collections.Generic.List<T>
DateOnlyConverterSystem.DateOnly
DateTimeConverterSystem.DateTime
DateTimeOffsetConverterSystem.DateTimeOffset
DecimalConverterdecimalSystem.Decimal
DoubleConverterdoubleSystem.Double
EnumConverterenumSystem.Enum
GuidConverterSystem.Guid
IDictionaryConverterSystem.Collections.Generic.Dictionary<string, string>
IDictionaryGenericConverterSystem.Collections.Generic.Dictionary<TKey, TValue>
IEnumerableConverterSystem.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
IEnumerableGenericConverterSystem.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>
Int16ConvertershortSystem.Int16
Int32ConverterintSystem.Int32
Int64ConverterlongSystem.Int64
NullableConverterSystem.Nullable<T>
SByteConvertersbyteSystem.SByte
SingleConverterfloatSystem.Single
StringConverterstringSystem.String
TimeOnlyConverterSystem.TimeOnly
UInt16ConverterushortSystem.UInt16
UInt32ConverteruintSystem.UInt32
UInt64ConverterulongSystem.UInt64
UriConverterSystem.Uri
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/type-conversion/type-converter-options/index.html b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/type-converter-options/index.html new file mode 100644 index 0000000..0fbc43d --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/type-conversion/type-converter-options/index.html @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + Type Converter Options | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Type Converter Options

+

Options can be passed to the type converters. +Most type converters use IFormattable.ToString to write and TryParse to read. +Any option for these methods should be available through configuration.

+
Mapping Example
+
public sealed class FooMap : ClassMap\<Foo\>
+{
+    public FooMap()
+    {
+        Map(m => m.DateTimeProps).TypeConverterOption.DateTimeStyles(DateTimeStyles.AllowInnerWhite | DateTimeStyles.RoundtripKind);
+    }
+}
+
+
Attributes Example
+
public class Foo
+{
+    [DateTimeStyles(DateTimeStyles.AllowInnerWhite | DateTimeStyles.RoundtripKind)]
+    public DateTime DateTimeProp { get; set; }
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/writing/appending-to-an-existing-file/index.html b/ThirdParty/CsvHelper-master/docs/examples/writing/appending-to-an-existing-file/index.html new file mode 100644 index 0000000..38dccda --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/writing/appending-to-an-existing-file/index.html @@ -0,0 +1,476 @@ + + + + + + + + + + + + + + + + + + + + + + + Appending To An Existing File | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Appending to an Existing CSV File

+
Example
+
void Main()
+{
+	var records = new List<Foo>
+	{
+		new Foo { Id = 1, Name = "one" },
+	};
+
+	// Write to a file.
+	using (var writer = new StreamWriter("path\\to\\file.csv"))
+	using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+	{
+		csv.WriteRecords(records);
+	}
+
+	records = new List<Foo>
+	{
+		new Foo { Id = 2, Name = "two" },
+	};
+
+	// Append to the file.
+	var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+	{
+		// Don't write the header again.
+		HasHeaderRecord = false,
+	};
+	using (var stream = File.Open("path\\to\\file.csv", FileMode.Append))
+	using (var writer = new StreamWriter(stream))
+	using (var csv = new CsvWriter(writer, config))
+	{
+		csv.WriteRecords(records);
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+}
+
+
Output
+
Id,Name
+1,one
+2,two
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/writing/index.html b/ThirdParty/CsvHelper-master/docs/examples/writing/index.html new file mode 100644 index 0000000..efe0007 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/writing/index.html @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + Writing | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Writing

+

Injection Warning

+

When opening a CSV in an external program, a formula in a field could be ran that contains a vulnerability. +Read more here: CSV Injection. +Due to this issue, there is a setting InjectionOptions that can be configured.

+

The list of injection characters to detect are configurable in CsvConfiguration.InjectionCharacters +and default to =, @, +, -, \t, \r. An injection character can be the first character of a field +or quoted field. i.e. =foo or "=foo"

+

The InjectionOptions values are None (default), Escape, Strip, and Exception.

+
None
+

No injection protection is taken.

+
Exception
+

If an injection character is detected, a CsvWriterException is thrown.

+
Strip
+

All injection characters at the start of a field will be removed. ===foo will be stripped to foo.

+
Escape
+

If an injection character is detected, the field will be prepended with the InjectionEscapeCharacter +that defaults to '. The field will be quoted if it is not already.

+

=one -> "'=one"

+

"=one" -> "'=one"

+

=one"two -> "'=one""two"

+

This option is disabled by default because the primary goal if this library is to read and write CSV +files. If you are storing user entered data that you haven't sanitized yourself and you're letting +it be accessed by people that may open in Excel/Sheets/etc, you might consider enabling this feature. +The InjectionEscapeCharacter is not removed when reading.

+

When writing, you can throw an enumerable of class objects, dynamic objects, anonymous type objects, or pretty much +anything else, and it will get written.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Topics 
Write Class Objects
Write Dynamic Objects
Write Anonymous Type Objects
Appending to an Existing File
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/writing/write-anonymous-type-objects/index.html b/ThirdParty/CsvHelper-master/docs/examples/writing/write-anonymous-type-objects/index.html new file mode 100644 index 0000000..66741ae --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/writing/write-anonymous-type-objects/index.html @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + Write Anonymous Type Objects | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Write Anonymous Type Objects

+
Example
+
void Main()
+{
+	var records = new List<object>
+	{
+		new { Id = 1, Name = "one" },
+	};
+	
+	using (var writer = new StreamWriter("path\\to\\file.csv"))
+	using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+	{
+		csv.WriteRecords(records);
+	}
+}
+
+
Output
+
Id,Name
+1,one
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/writing/write-class-objects/index.html b/ThirdParty/CsvHelper-master/docs/examples/writing/write-class-objects/index.html new file mode 100644 index 0000000..3306af7 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/writing/write-class-objects/index.html @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + + + + + + + + + Write Class Objects | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Write Class Objects

+
Example
+
void Main()
+{
+	var records = new List<Foo>
+	{
+		new Foo { Id = 1, Name = "one" },
+	};
+	
+	using (var writer = new StreamWriter("path\\to\\file.csv"))
+	using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+	{
+		csv.WriteRecords(records);
+	}
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+}
+
+
Output
+
Id,Name
+1,one
+
+ +
+
+
+
+ +

+ + + + + + + + + + + diff --git a/ThirdParty/CsvHelper-master/docs/examples/writing/write-dynamic-objects/index.html b/ThirdParty/CsvHelper-master/docs/examples/writing/write-dynamic-objects/index.html new file mode 100644 index 0000000..8992dca --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/writing/write-dynamic-objects/index.html @@ -0,0 +1,454 @@ + + + + + + + + + + + + + + + + + + + + + + + Write Dynamic Objects | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Write Dynamic Objects

+
Example
+
void Main()
+{
+	var records = new List<dynamic>();
+	
+	dynamic record = new ExpandoObject();
+	record.Id = 1;
+	record.Name = "one";
+	records.Add(record);
+	
+	using (var writer = new StringWriter())
+	using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+	{
+		csv.WriteRecords(records);
+		
+		writer.ToString().Dump();
+	}
+}
+
+
Output
+
Id,Name
+1,one
+
+ +
+
+
+
+ +

+ + + + + + + + + + + -- cgit v1.1-26-g67d0