<commit_before>#-------------------------------------------------------------------------------
# Description: Sets the AssemblyVersion and AssemblyFileVersion of 
#              AssemblyInfo.cs files.
#			   Sets the <version></version> element of UnitsNet.nuspec file.
#
# Based on original work by <NAME> from: http://www.luisrocha.net/2009/11/setting-assembly-version-with-windows.html
#
# Author: <NAME>
# Version: 1.0
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Displays how to use this script.
#-------------------------------------------------------------------------------
function Help {
	"Sets the AssemblyVersion and AssemblyFileVersion of AssemblyInfo.cs files`n"
	".\SetVersion.ps1 [VersionNumber]`n"
	"   [VersionNumber]     The version number to set, for example: 1.1.9301.0"
	"                       If not provided, a version number will be generated.`n"
}
 
#-------------------------------------------------------------------------------
# Update version numbers of AssemblyInfo.cs
#-------------------------------------------------------------------------------
function Update-AssemblyInfoFiles ([string] $version) {
	$assemblyVersionPattern = 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
	$fileVersionPattern = 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
	$assemblyVersion = 'AssemblyVersion("' + $version + '")';
	$fileVersion = 'AssemblyFileVersion("' + $version + '")';
	
	Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^AssemblyInfo\.cs$"} | ForEach-Object {
		$filename = $_.Directory.ToString() + '\' + $_.Name
		$filename + ' -> ' + $version
		
		# If you are using a source control that requires to check-out files before 
		# modifying them, make sure to check-out the file here.
		# For example, TFS will require the following command:
		# tf checkout $filename
	
		(Get-Content $filename -Encoding UTF8) | ForEach-Object {
			% {$_ -replace $assemblyVersionPattern, $assemblyVersion } |
			% {$_ -replace $fileVersionPattern, $fileVersion }
		} | Set-Content $filename -Encoding UTF8
	}	
}

#-------------------------------------------------------------------------------
# Update version numbers of UnitsNet.nuspec
#-------------------------------------------------------------------------------
function Update-NuspecFiles ([string] $version) {
	$nugetVersionPattern = '<version>.*?</version>';
	$nugetVersion = '<version>'+$version+'</version>';
	
	Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^UnitsNet\.nuspec$"} | ForEach-Object {
		$filename = $_.Directory.ToString() + '\' + $_.Name
		$filename + ' -> ' + $version
		
		# If you are using a source control that requires to check-out files before 
		# modifying them, make sure to check-out the file here.
		# For example, TFS will require the following command:
		# tf checkout $filename
	
		(Get-Content $filename -Encoding UTF8) | ForEach-Object {
			% {$_ -replace $nugetVersionPattern, $nugetVersion }
		} | Set-Content $filename -Encoding UTF8
	}
}

#-------------------------------------------------------------------------------
# Parse arguments.
#-------------------------------------------------------------------------------
$version = $args[0]
while ($version -notmatch "[0-9]+(\.([0-9]+|\*)){1,3}") {
	if ($version -eq '/?') {
		Help
	}
	else {
		"About to update the version of nuget package .nuspec and AssemblyInfo.cs files."
		$version = Read-Host 'Enter new version'
	}
}

Update-AssemblyInfoFiles $version
Update-NuspecFiles $version

<commit_msg>Scripts/SetVersion.ps1 now updates <releaseNotes> of .nuspec file.<commit_after>#-------------------------------------------------------------------------------
# Description: Sets the AssemblyVersion and AssemblyFileVersion of 
#              AssemblyInfo.cs files.
#			   Sets the <version></version> element of UnitsNet.nuspec file.
#
# Based on original work by <NAME> from: http://www.luisrocha.net/2009/11/setting-assembly-version-with-windows.html
#
# Author: <NAME>
# Version: 1.0
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Displays how to use this script.
#-------------------------------------------------------------------------------
function Help {
	"Sets the AssemblyVersion and AssemblyFileVersion of AssemblyInfo.cs files`n"
	".\SetVersion.ps1 [VersionNumber]`n"
	"   [VersionNumber]     The version number to set, for example: 1.1.9301.0"
	"                       If not provided, a version number will be generated.`n"
}
 
#-------------------------------------------------------------------------------
# Update version numbers of AssemblyInfo.cs
#-------------------------------------------------------------------------------
function Update-AssemblyInfoFiles ([string] $version) {
	$assemblyVersionPattern = 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
	$fileVersionPattern = 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
	$assemblyVersion = 'AssemblyVersion("' + $version + '")';
	$fileVersion = 'AssemblyFileVersion("' + $version + '")';
	
	Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^AssemblyInfo\.cs$"} | ForEach-Object {
		$filename = $_.Directory.ToString() + '\' + $_.Name
		$filename + ' -> ' + $version
		
		# If you are using a source control that requires to check-out files before 
		# modifying them, make sure to check-out the file here.
		# For example, TFS will require the following command:
		# tf checkout $filename
	
		(Get-Content $filename -Encoding UTF8) | ForEach-Object {
			% {$_ -replace $assemblyVersionPattern, $assemblyVersion } |
			% {$_ -replace $fileVersionPattern, $fileVersion }
		} | Set-Content $filename -Encoding UTF8
	}	
}

#-------------------------------------------------------------------------------
# Update version numbers of UnitsNet.nuspec
#-------------------------------------------------------------------------------
function Update-NuspecFiles ([string] $version) {
	$nugetVersionPattern = '<version>.*?</version>';
	$nugetVersion = '<version>'+$version+'</version>';
	
	Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^UnitsNet\.nuspec$"} | ForEach-Object {
		$filename = $_.Directory.ToString() + '\' + $_.Name
		$filename + ' -> ' + $version
		
		# If you are using a source control that requires to check-out files before 
		# modifying them, make sure to check-out the file here.
		# For example, TFS will require the following command:
		# tf checkout $filename
	
		(Get-Content $filename -Encoding UTF8) | ForEach-Object {
			% {$_ -replace $nugetVersionPattern, $nugetVersion }
		} | Set-Content $filename -Encoding UTF8
	}
}

#-------------------------------------------------------------------------------
# Update <releaseNotes> element in UnitsNet.nuspec
#-------------------------------------------------------------------------------
function Update-NuspecFileReleaseNotes ([string] $releaseInfo) {
	$nugetReleaseNotesPattern = '<releaseNotes>.*?</releaseNotes>';
	$nugetReleaseNotes = '<releaseNotes>'+$releaseInfo+'</releaseNotes>';
	
	Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^UnitsNet\.nuspec$"} | ForEach-Object {
		$filename = $_.Directory.ToString() + '\' + $_.Name
		$filename + ' -> ' + $releaseInfo
		
		# If you are using a source control that requires to check-out files before 
		# modifying them, make sure to check-out the file here.
		# For example, TFS will require the following command:
		# tf checkout $filename
	
		(Get-Content $filename -Encoding UTF8) | ForEach-Object {
			% {$_ -replace $nugetReleaseNotesPattern, $nugetReleaseNotes }
		} | Set-Content $filename -Encoding UTF8
	}
}

#-------------------------------------------------------------------------------
# Parse arguments.
#-------------------------------------------------------------------------------
$version = $args[0]
while ($version -notmatch "[0-9]+(\.([0-9]+|\*)){1,3}") {
	if ($version -eq '/?') {
		Help
	}
	else {
		"About to update the version of nuget package .nuspec and AssemblyInfo.cs files."
		$version = Read-Host 'Enter new version'
	}
}

$releaseNotes = Read-Host 'Enter release notes for .nuspec file'

Update-AssemblyInfoFiles $version
Update-NuspecFiles $version
Update-NuspecFileReleaseNotes $releaseNotes

{'fraction_non_alphanumeric': 0.32744840749135157, 'fraction_numerical': 0.009662412024334963, 'mean_word_length': 1.6777387416160972, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '475337', 'n_tokens_mistral': 2306, 'n_tokens_neox': 2139, 'n_words': 582}