1+ // ReSharper disable ConvertIfStatementToReturnStatement
12namespace Atc . CodingRules . Updater ;
23
34public static class FileHelper
@@ -51,7 +52,7 @@ public static void CreateFile(
5152 logger . LogInformation ( $ "{ EmojisConstants . FileCreated } { descriptionPart } created") ;
5253 }
5354
54- public static bool IsFileDataLengthEqual (
55+ public static bool AreFilesEqual (
5556 string dataA ,
5657 string dataB )
5758 {
@@ -61,7 +62,35 @@ public static bool IsFileDataLengthEqual(
6162 var l1 = dataA . EnsureEnvironmentNewLines ( ) . Length ;
6263 var l2 = dataB . EnsureEnvironmentNewLines ( ) . Length ;
6364
64- return l1 . Equals ( l2 ) ;
65+ var isSameFileLength = l1 . Equals ( l2 ) ;
66+ if ( ! isSameFileLength )
67+ {
68+ return false ;
69+ }
70+
71+ var headerLinesA = dataA . ToLines ( ) . Take ( 10 ) . ToList ( ) ;
72+ var headerLinesB = dataB . ToLines ( ) . Take ( 10 ) . ToList ( ) ;
73+
74+ if ( headerLinesA . Find ( x => x . StartsWith ( "# Version" , StringComparison . CurrentCultureIgnoreCase ) ) !=
75+ headerLinesB . Find ( x => x . StartsWith ( "# Version" , StringComparison . CurrentCultureIgnoreCase ) ) )
76+ {
77+ return false ;
78+ }
79+
80+ if ( headerLinesA . Find ( x => x . StartsWith ( "# Updated" , StringComparison . CurrentCultureIgnoreCase ) ) !=
81+ headerLinesB . Find ( x => x . StartsWith ( "# Updated" , StringComparison . CurrentCultureIgnoreCase ) ) )
82+ {
83+ return false ;
84+ }
85+
86+ if ( headerLinesA . Find ( x => x . StartsWith ( "# Distribution" , StringComparison . CurrentCultureIgnoreCase ) ) !=
87+ headerLinesB . Find ( x => x . StartsWith ( "# Distribution" , StringComparison . CurrentCultureIgnoreCase ) ) )
88+ {
89+ return false ;
90+ }
91+
92+ return true ;
93+
6594 }
6695
6796 public static bool ContainsEditorConfigFile (
0 commit comments