Skip to content

Commit dfbedfa

Browse files
cleanup and add some new stuff
1 parent 4457732 commit dfbedfa

21 files changed

Lines changed: 230 additions & 94 deletions

‎Core.MemoryLog/DebugLogger.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ namespace Core.MemoryLog
3434
/// </summary>
3535
public static class DebugLogger
3636
{
37-
3837
/// <summary>
3938
/// The logged keys
4039
/// </summary>

‎Core.MemoryLog/ILogger.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace Core.MemoryLog
1717
/// </summary>
1818
public interface ILogger
1919
{
20-
2120
// Configuration
2221

2322

‎DataFormatter/CsvColumnAttribute.cs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* PROGRAMMER: Peter Geinitz (Wayfarer)
77
*/
88

9-
// ReSharper disable UnusedType.Global
10-
119
using System;
1210

1311
namespace DataFormatter

‎DataFormatter/CsvHandler.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static class CsvHandler
2424
/// <param name="filepath">Path of the CSV file.</param>
2525
/// <param name="separator">The separator in use.</param>
2626
/// <returns>List of lines split into parts if successful; otherwise, null.</returns>
27-
public static List<List<string?>>? ReadCsv(string filepath, char separator)
27+
public static List<List<string>> ReadCsv(string filepath, char separator)
2828
{
2929
var lst = CsvHelper.ReadFileContent(filepath);
3030
return lst?.ConvertAll(item => CsvHelper.SplitLine(item, separator));
@@ -84,7 +84,7 @@ public static List<T> ReadCsvRange<T>(string filepath, char separator, Func<List
8484
/// <param name="filepath">The file path.</param>
8585
/// <param name="csv">The CSV data.</param>
8686
/// <param name="separator">The separator character. Defaults to comma.</param>
87-
public static void WriteCsv(string filepath, IEnumerable<List<string>>? csv, string separator = ",")
87+
public static void WriteCsv(string filepath, IEnumerable<List<string>> csv, string separator = ",")
8888
{
8989
var file = new StringBuilder();
9090

‎DataFormatter/CsvHelper.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal static class CsvHelper
2525
/// <returns>Content of File</returns>
2626
/// <exception cref="ArgumentException">File path is empty - filepath</exception>
2727
[MethodImpl(MethodImplOptions.AggressiveInlining)]
28-
internal static List<string>? ReadFileContent(string filepath)
28+
internal static List<string> ReadFileContent(string filepath)
2929
{
3030
if (string.IsNullOrEmpty(filepath))
3131
{

‎DataFormatter/DataFormatter.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<ItemGroup>
1212
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
13-
<_Parameter1>CommonLibrary.Tests</_Parameter1>
13+
<_Parameter1>CommonLibraryTests</_Parameter1>
1414
</AssemblyAttribute>
1515
</ItemGroup>
1616

‎DataFormatter/SegmentedCsvHandler.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
* PROGRAMMER: Peter Geinitz (Wayfarer)
77
*/
88

9-
using System;
109
using System.Collections.Generic;
1110
using System.Text;
1211

1312
namespace DataFormatter
1413
{
1514
/// <summary>
16-
/// Separate multiple csv files via keywords.
15+
/// Separate multible csv files via keywords.
1716
/// </summary>
1817
public static class SegmentedCsvHandler
1918
{
@@ -48,9 +47,10 @@ public static void WriteCsvWithLayerKeywords(string filepath, char separator, Li
4847
/// Reads the CSV with layer keywords.
4948
/// </summary>
5049
/// <param name="filepath">The filepath.</param>
50+
/// <param name="separator">The separator.</param>
5151
/// <param name="layerKeyword">The layer keyword.</param>
5252
/// <returns>Content of our special format file</returns>
53-
public static List<string>? ReadCsvWithLayerKeywords(string filepath, string layerKeyword)
53+
public static List<string> ReadCsvWithLayerKeywords(string filepath, char separator, string layerKeyword)
5454
{
5555
var lst = CsvHelper.ReadFileContent(filepath);
5656
if (lst == null)
@@ -64,7 +64,7 @@ public static void WriteCsvWithLayerKeywords(string filepath, char separator, Li
6464
foreach (var line in lst)
6565
// When the layer keyword is encountered, store the current layer
6666
{
67-
if (line.StartsWith(layerKeyword, StringComparison.Ordinal))
67+
if (line.StartsWith(layerKeyword))
6868
{
6969
if (currentLayer.Length > 0)
7070
{

‎DataFormatter/WriterObj.cs‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* PROJECT: DataFormatter
3+
* FILE: DataFormatter/WriterObj.cs
4+
* PURPOSE: A basic obj File writer to match ReaderObj.
5+
* PROGRAMMER: Peter Geinitz (Wayfarer)
6+
*/
7+
8+
// ReSharper disable UnusedType.Global
9+
// ReSharper disable UnusedMember.Global
10+
11+
using System.IO;
12+
using System.Text;
13+
14+
namespace DataFormatter
15+
{
16+
/// <summary>
17+
/// Basic implementation to write ObjFile objects to disk.
18+
/// </summary>
19+
public static class WriterObj
20+
{
21+
/// <summary>
22+
/// Writes an ObjFile to the specified path.
23+
/// </summary>
24+
/// <param name="objData">The object data.</param>
25+
/// <param name="filePath">The file path.</param>
26+
public static void WriteObj(ObjFile? objData, string filePath)
27+
{
28+
if (objData == null) return;
29+
30+
var sb = new StringBuilder();
31+
sb.AppendLine("# Exported via DataFormatter");
32+
33+
if (objData.Vectors != null)
34+
{
35+
foreach (var v in objData.Vectors)
36+
{
37+
// Invert culture formatting if necessary based on your DataHelper
38+
sb.AppendLine($"v {v.X} {v.Y} {v.Z}");
39+
}
40+
}
41+
42+
if (objData.Face != null)
43+
{
44+
foreach (var f in objData.Face)
45+
{
46+
sb.AppendLine($"f {f.X} {f.Y} {f.Z}");
47+
}
48+
}
49+
50+
if (objData.Other != null)
51+
{
52+
foreach (var other in objData.Other)
53+
{
54+
sb.AppendLine(other);
55+
}
56+
}
57+
58+
File.WriteAllText(filePath, sb.ToString());
59+
}
60+
}
61+
}

‎Imaging.Texture.Tests/TextureMathEngineTests.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ public void GenerateLeafCloud_Solid_VisualTest()
346346
[TestMethod]
347347
public void GenerateVolumetricLeafCloud_VisualTest()
348348
{
349-
var buffer = TextureFactory.GenerateVolumetricLeafCloud(TestWidth, TestHeight, _noiseGenerator, fillArea: false);
349+
var buffer =
350+
TextureFactory.GenerateVolumetricLeafCloud(TestWidth, TestHeight, _noiseGenerator, fillArea: false);
350351
SaveBufferToImage(buffer, "24_VolumetricLeafCloud_Transparent.png");
351352
}
352353

@@ -356,7 +357,8 @@ public void GenerateVolumetricLeafCloud_VisualTest()
356357
[TestMethod]
357358
public void GenerateVolumetricLeafCloud_Solid_VisualTest()
358359
{
359-
var buffer = TextureFactory.GenerateVolumetricLeafCloud(TestWidth, TestHeight, _noiseGenerator, fillArea: true);
360+
var buffer =
361+
TextureFactory.GenerateVolumetricLeafCloud(TestWidth, TestHeight, _noiseGenerator, fillArea: true);
360362
SaveBufferToImage(buffer, "24_VolumetricLeafCloud_Solid.png");
361363
}
362364

0 commit comments

Comments
 (0)