Files
WireMock.Net-wiremock/hdr.ps1
Stef Heyenrath 54edf0bebc Add link to TIOBE Index on main page + fix issues (#1137)
* Add TIOBE + include SonarAnalyzer.CSharp

* .

* cp

* Copyright © WireMock.Net

* more fixes

* fix

* xpath

* if (Matchers == null || !Matchers.Any())

* if (Matchers != null)

* ?

* .

* .
2024-07-18 18:06:04 +02:00

23 lines
787 B
PowerShell

param($target = "C:\Dev\Github\WireMock.Net")
$header = "// Copyright © WireMock.Net
"
function Write-Header ($file) {
$content = Get-Content $file -Raw # Using -Raw to read the entire file as a single string
$filename = Split-Path -Leaf $file
# Check if the file content starts with the auto-generated line
if ($content.TrimStart().StartsWith("// <auto-generated>")) {
Write-Host "Skipping auto-generated file: $filename"
} else {
# If not an auto-generated file, prepend the header
Set-Content $file $header
Add-Content $file $content -NoNewline # Writing back to the file without an extra newline
}
}
Get-ChildItem $target -Recurse | ? { $_.Extension -like ".cs" } | % `
{
Write-Header $_.PSPath.Split(":", 3)[2]
}