22using System ;
33using System . Linq ;
44using System . Text ;
5+ using System . Text . RegularExpressions ;
56
67namespace AutSoft . UnityResourceGenerator . Editor . Generation
78{
89 public static class ResourceFileGenerator
910 {
11+ private static readonly Regex NormalizedLineEndings = new Regex ( @"\r\n|\n\r|\n|\r" , RegexOptions . Compiled , TimeSpan . FromSeconds ( 10 ) ) ;
12+
1013 public static string CreateResourceFile ( ResourceContext context )
1114 {
1215 // ReSharper disable once MissingIndent
@@ -17,6 +20,8 @@ namespace {0}
1720 // ReSharper disable PartialTypeWithSinglePart
1821 // ReSharper disable InconsistentNaming
1922 // ReSharper disable IncorrectBlankLinesNearBraces
23+ #pragma warning disable IDE0079 // Remove unnecessary suppression
24+ #pragma warning disable RCS1036 // Remove redundant empty line.
2025 public static partial class {1}
2126 {" ;
2227
@@ -31,6 +36,8 @@ public static partial class {1}
3136// ReSharper disable PartialTypeWithSinglePart
3237// ReSharper disable InconsistentNaming
3338// ReSharper disable IncorrectBlankLinesNearBraces
39+ #pragma warning disable IDE0079 // Remove unnecessary suppression
40+ #pragma warning disable RCS1036 // Remove redundant empty line.
3441public static partial class {1}
3542{" ;
3643
@@ -63,6 +70,8 @@ public static partial class {1}
6370 . OrderByDescending ( p => p . PostProcessPriority )
6471 . Aggregate ( fileContent , ( current , processor ) => processor . PostProcess ( context , current ) ) ;
6572
73+ fileContent = NormalizedLineEndings . Replace ( fileContent , "\r \n " ) ;
74+
6675 return fileContent ;
6776 }
6877 }
0 commit comments