Browse Source

Simplified the text creation (using hardcoded "\n" new line character, instead of "Environment.NewLine" approach)

Marcin Ziąbek 1 year ago
parent
commit
20a65b27c3

+ 1 - 1
Source/QuestPDF.Examples/TextBenchmark.cs

@@ -92,7 +92,7 @@ namespace QuestPDF.Examples
                 var lineTo = chapterPointers[index + 1] - 1;
 
                 var lines = book.Skip(lineFrom + 1).Take(lineTo - lineFrom).Where(x => !string.IsNullOrWhiteSpace(x));
-                var content = string.Join(Environment.NewLine, lines);
+                var content = string.Join("\n", lines);
 
                 yield return new BookChapter
                 {

+ 2 - 2
Source/QuestPDF/Drawing/DocumentGenerator.cs

@@ -57,7 +57,7 @@ namespace QuestPDF.Drawing
             if (Settings.License.HasValue)
                 return;
             
-            var newParagraph = Environment.NewLine + Environment.NewLine;
+            const string newParagraph = "\n\n";
 
             var exceptionMessage = 
                 $"QuestPDF is a modern open-source library. " +
@@ -233,7 +233,7 @@ namespace QuestPDF.Drawing
             
             void ThrowLayoutException()
             {
-                var newLine = Environment.NewLine;
+                var newLine = "\n";
                 var newParagraph = newLine + newLine;
                     
                 var message =

+ 2 - 2
Source/QuestPDF/Previewer/PreviewerService.cs

@@ -103,8 +103,8 @@ namespace QuestPDF.Previewer
             if (version.Major == RequiredPreviewerVersionMajor && version.Minor == RequiredPreviewerVersionMinor)
                 return;
 
-            var newLine = Environment.NewLine;
-            var newParagraph = newLine + newLine;
+            const string newLine = "\n";
+            const string newParagraph = newLine + newLine;
             
             throw new Exception($"The QuestPDF Previewer application is not compatible. Possible solutions: {newParagraph}" +
                                 $"1) Change the QuestPDF library to the {version.Major}.{version.Minor}.X version to match the Previewer application version. {newParagraph}" +

+ 1 - 2
Source/QuestPDF/Skia/SkNativeDependencyCompatibilityChecker.cs

@@ -11,8 +11,7 @@ internal static class SkNativeDependencyCompatibilityChecker
     public static void Test()
     {
         const string exceptionBaseMessage = "The QuestPDF library has encountered an issue while loading one of its dependencies.";
-        var newLine = Environment.NewLine;
-        var paragraph = newLine + newLine;
+        const string paragraph = "\n\n";
         
         if (IsCompatibilityChecked)
             return;