|
| 1 | +/* |
| 2 | + * COPYRIGHT: See COPYING in the top level directory |
| 3 | + * PROJECT: DataFormatter |
| 4 | + * FILE: FormatterApiFacade.cs |
| 5 | + * PURPOSE: Api Facade for the DataFormatter library |
| 6 | + * PROGRAMER: Peter Geinitz (Wayfarer) |
| 7 | + */ |
| 8 | + |
| 9 | +using System.Collections.Generic; |
| 10 | + |
| 11 | +namespace DataFormatter |
| 12 | +{ |
| 13 | + public static class FormatterApiFacade |
| 14 | + { |
| 15 | + /// <summary> |
| 16 | + /// Reads the CSV. |
| 17 | + /// </summary> |
| 18 | + /// <param name="file">The file.</param> |
| 19 | + /// <param name="sep">The sep.</param> |
| 20 | + /// <returns>Csv file as list.</returns> |
| 21 | + public static List<List<string>> ReadCsv(string file, char sep) => CsvHandler.ReadCsv(file, sep); |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Writes the CSV. |
| 25 | + /// </summary> |
| 26 | + /// <param name="file">The file.</param> |
| 27 | + /// <param name="data">The data.</param> |
| 28 | + /// <param name="sep">The sep.</param> |
| 29 | + public static void WriteCsv(string file, IEnumerable<List<string>> data, string sep) => CsvHandler.WriteCsv(file, data, sep); |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Reads the CSV with layers. |
| 33 | + /// </summary> |
| 34 | + /// <param name="file">The file.</param> |
| 35 | + /// <param name="layerKeyword">The layer keyword.</param> |
| 36 | + /// <returns>Content of our special format file</returns> |
| 37 | + public static List<string> ReadCsvWithLayers(string file, string layerKeyword) |
| 38 | + => SegmentedCsvHandler.ReadCsvWithLayerKeywords(file, layerKeyword); |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Writes the CSV with layers. |
| 42 | + /// </summary> |
| 43 | + /// <param name="file">The file.</param> |
| 44 | + /// <param name="sep">The sep.</param> |
| 45 | + /// <param name="csvLayers">The CSV layers.</param> |
| 46 | + /// <param name="layerKeyword">The layer keyword.</param> |
| 47 | + public static void WriteCsvWithLayers(string file, char sep, List<List<string>> csvLayers, string layerKeyword) |
| 48 | + => SegmentedCsvHandler.WriteCsvWithLayerKeywords(file, sep, csvLayers, layerKeyword); |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// Reads the file. |
| 52 | + /// </summary> |
| 53 | + /// <param name="path">The path.</param> |
| 54 | + /// <returns>the values as String[]. Can return null.</returns> |
| 55 | + public static IEnumerable<string> ReadFile(string path) => ReadText.ReadFile(path); |
| 56 | + |
| 57 | + /// <summary> |
| 58 | + /// Writes the file. |
| 59 | + /// </summary> |
| 60 | + /// <param name="path">The path.</param> |
| 61 | + /// <param name="content">The content.</param> |
| 62 | + public static void WriteFile(string path, IEnumerable<string> content) => ReadText.WriteFile(path, content); |
| 63 | + |
| 64 | + /// <summary> |
| 65 | + /// Reads the object. |
| 66 | + /// </summary> |
| 67 | + /// <param name="path">The path.</param> |
| 68 | + /// <returns>Readable Obj File</returns> |
| 69 | + public static ObjFile ReadObj(string path) => ReaderObj.ReadObj(path); |
| 70 | + } |
| 71 | +} |
0 commit comments