33
44using System ;
55using System . Collections . Generic ;
6+ using System . Collections . Immutable ;
67using System . IO ;
78using System . Linq ;
89using System . Threading ;
@@ -32,13 +33,15 @@ private static int Main(string[] args)
3233 return - 1 ;
3334 }
3435
35- List < string > ruleTypes = new List < string > ( ) ;
36- List < string > filenames = new List < string > ( ) ;
36+ var ruleTypes = new List < string > ( ) ;
37+ var filenames = new List < string > ( ) ;
38+ var disableCopyright = false ;
39+ var comparer = StringComparer . OrdinalIgnoreCase ;
3740
3841 for ( int i = 1 ; i < args . Length ; i ++ )
3942 {
4043 string arg = args [ i ] ;
41- if ( arg . Equals ( "/file" , StringComparison . InvariantCultureIgnoreCase ) )
44+ if ( comparer . Equals ( arg , "/file" ) )
4245 {
4346 if ( i + 1 < args . Length )
4447 {
@@ -47,28 +50,35 @@ private static int Main(string[] args)
4750 i ++ ;
4851 }
4952 }
53+ else if ( comparer . Equals ( arg , "/nocopyright" ) )
54+ {
55+ disableCopyright = true ;
56+ }
5057 else
5158 {
5259 ruleTypes . Add ( arg ) ;
5360 }
5461 }
5562
56-
5763 var cts = new CancellationTokenSource ( ) ;
5864 var ct = cts . Token ;
5965
6066 Console . CancelKeyPress += delegate { cts . Cancel ( ) ; } ;
6167
62- RunAsync ( projectOrSolutionPath , ruleTypes , filenames , ct ) . Wait ( ct ) ;
68+ RunAsync ( projectOrSolutionPath , ruleTypes , filenames , disableCopyright , ct ) . Wait ( ct ) ;
6369 Console . WriteLine ( "Completed formatting." ) ;
6470 return 0 ;
6571 }
6672
67- private static async Task RunAsync ( string projectOrSolutionPath , IEnumerable < string > ruleTypes , IEnumerable < string > filenames , CancellationToken cancellationToken )
73+ private static async Task RunAsync ( string projectOrSolutionPath , IEnumerable < string > ruleTypes , IEnumerable < string > filenames , bool disableCopright , CancellationToken cancellationToken )
6874 {
6975 var workspace = MSBuildWorkspace . Create ( ) ;
7076 var engine = FormattingEngine . Create ( ruleTypes , filenames ) ;
7177 engine . Verbose = true ;
78+ if ( disableCopright )
79+ {
80+ engine . CopyrightHeader = ImmutableArray < string > . Empty ;
81+ }
7282
7383 string extension = Path . GetExtension ( projectOrSolutionPath ) ;
7484 if ( StringComparer . OrdinalIgnoreCase . Equals ( extension , ".sln" ) )
0 commit comments