aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CSV/CsvSource.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-08-02 15:05:44 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-08-02 15:05:44 +0300
commit05fca4fe321600c4a9c0698b1e4c161e3ed79c9f (patch)
treefda984b5a9ff3a3980bf9b6b5a560b3edaa4e668 /Software/Visual_Studio/Tango.CSV/CsvSource.cs
parent3499090dce4acc5b5d4bbb02f07f138950790b25 (diff)
downloadTango-05fca4fe321600c4a9c0698b1e4c161e3ed79c9f.tar.gz
Tango-05fca4fe321600c4a9c0698b1e4c161e3ed79c9f.zip
Added Tango.CSV project!
Implemented Single/Multi graph recording to CSV!
Diffstat (limited to 'Software/Visual_Studio/Tango.CSV/CsvSource.cs')
-rw-r--r--Software/Visual_Studio/Tango.CSV/CsvSource.cs95
1 files changed, 95 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.CSV/CsvSource.cs b/Software/Visual_Studio/Tango.CSV/CsvSource.cs
new file mode 100644
index 000000000..ba7e458e6
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CSV/CsvSource.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Collections.Concurrent;
+using System.Threading.Tasks;
+
+namespace Tango.CSV
+{
+ /// <summary>
+ /// Represents a <see cref="CsvFile"/> source.
+ /// </summary>
+ public class CsvSource
+ {
+ public readonly TextReader TextReader;
+
+ /// <summary>
+ /// Performs an implicit conversion from <see cref="CsvFile"/> to <see cref="CsvSource"/>.
+ /// </summary>
+ /// <param name="csvFile">The CSV file.</param>
+ /// <returns>
+ /// The result of the conversion.
+ /// </returns>
+ public static implicit operator CsvSource(CsvFile csvFile)
+ {
+ return new CsvSource(csvFile);
+ }
+
+ /// <summary>
+ /// Performs an implicit conversion from <see cref="System.String"/> to <see cref="CsvSource"/>.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>
+ /// The result of the conversion.
+ /// </returns>
+ public static implicit operator CsvSource(string path)
+ {
+ return new CsvSource(path);
+ }
+
+ /// <summary>
+ /// Performs an implicit conversion from <see cref="TextReader"/> to <see cref="CsvSource"/>.
+ /// </summary>
+ /// <param name="textReader">The text reader.</param>
+ /// <returns>
+ /// The result of the conversion.
+ /// </returns>
+ public static implicit operator CsvSource(TextReader textReader)
+ {
+ return new CsvSource(textReader);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CsvSource"/> class.
+ /// </summary>
+ /// <param name="textReader">The text reader.</param>
+ public CsvSource(TextReader textReader)
+ {
+ this.TextReader = textReader;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CsvSource"/> class.
+ /// </summary>
+ /// <param name="stream">The stream.</param>
+ public CsvSource(Stream stream)
+ {
+ this.TextReader = new StreamReader(stream);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CsvSource"/> class.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ public CsvSource(string path)
+ {
+ this.TextReader = new StreamReader(path);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CsvSource"/> class.
+ /// </summary>
+ /// <param name="csvFile">The CSV file.</param>
+ public CsvSource(CsvFile csvFile)
+ {
+ this.TextReader = new StreamReader(csvFile.BaseStream);
+ }
+ }
+}