diff --git a/src/Gcode.Utils/Gcode.Utils.csproj b/src/Gcode.Utils/Gcode.Utils.csproj index 12df202..3bab6eb 100644 --- a/src/Gcode.Utils/Gcode.Utils.csproj +++ b/src/Gcode.Utils/Gcode.Utils.csproj @@ -13,10 +13,10 @@ gcode 3d-printing reprap reprap-3d-printer marlin marlin-firmware repitier repitier-firmware json json-parsing gcode-json cura kisslicer slic3r simplify3d git Anton Maisak - 0.2.0.13 + 0.2.0.14 - 0.2.13 - 0.2.0.13 + 0.2.14 + 0.2.0.14 https://raw.githubusercontent.com/avmaisak/Gcode/master/misc/design/logo/logo.png diff --git a/src/Gcode.Utils/SlicerParser/PrusaSlicerParser.cs b/src/Gcode.Utils/SlicerParser/PrusaSlicerParser.cs index 60de451..2615ace 100644 --- a/src/Gcode.Utils/SlicerParser/PrusaSlicerParser.cs +++ b/src/Gcode.Utils/SlicerParser/PrusaSlicerParser.cs @@ -23,14 +23,13 @@ public override Slic3RInfo GetSlicerInfo(string[] fileContent) var filamentUsed = fileContent.Where(x => x.StartsWith("; filament used [mm] = ")).ToArray(); if (filamentUsed.Length == 1 && filamentUsed[0] != null) { - // filament used - res.FilamentUsedExtruder1 = Convert.ToDecimal(filamentUsed[0].Split('=')[1]?.Split(' ')[1]?.Replace("[mm]", "").Replace(".", ",")); + res.FilamentUsedExtruder1 = Convert.ToDecimal(filamentUsed[0].Split('=')[1].Split(',')[0].Trim().Replace(".",",")); } if (filamentUsed.Length == 2 && filamentUsed[1] != null) { // filament used - res.FilamentUsedExtruder2 = Convert.ToDecimal(filamentUsed[1].Split('=')[1]?.Split(' ')[1]?.Replace("[mm]", "").Replace(".", ",")); + res.FilamentUsedExtruder2 = Convert.ToDecimal(filamentUsed[1].Split('=')[1]?.Split('=')[1].Split(',')); } var filamentDiameter = fileContent.FirstOrDefault(x => x.StartsWith("; filament_diameter")); diff --git a/tools/TestSuite/Gcode.Test/Gcode.Test.csproj b/tools/TestSuite/Gcode.Test/Gcode.Test.csproj index 5cafedd..fbe9fcf 100644 --- a/tools/TestSuite/Gcode.Test/Gcode.Test.csproj +++ b/tools/TestSuite/Gcode.Test/Gcode.Test.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/tools/TestSuite/Gcode.Test/Infrastructure/TestSuiteDataSource.cs b/tools/TestSuite/Gcode.Test/Infrastructure/TestSuiteDataSource.cs index 42e2001..c932275 100644 --- a/tools/TestSuite/Gcode.Test/Infrastructure/TestSuiteDataSource.cs +++ b/tools/TestSuite/Gcode.Test/Infrastructure/TestSuiteDataSource.cs @@ -1,6 +1,7 @@ using System.IO; -namespace Gcode.Test.Infrastructure { +namespace Gcode.Test.Infrastructure +{ public static class TestSuiteDataSource { private static readonly string InternalTestFolder = $@"{Directory.GetCurrentDirectory()}\..\..\..\..\..\TestData\"; @@ -15,15 +16,11 @@ public static class TestSuiteDataSource "G1 X553.44 Y251.064 E0.01052 F2196", "M115" }; - - public static string GetDataSource(string fileName) - { - return File.ReadAllText($@"{InternalTestFolder}{fileName}"); - } - - public static string[] GetDataSourceArray(string fileName) + public static string GetDataSource(string fileName) => File.ReadAllText($@"{InternalTestFolder}{fileName}"); + public static string[] GetDataSourceArray(string fileName, bool external = false) { - return File.ReadAllLines($"{InternalTestFolder}{fileName}"); + if (!external) return File.ReadAllLines($"{InternalTestFolder}{fileName}"); + return File.ReadAllLines(fileName); } } } \ No newline at end of file