Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EE namespace issue #2801

Merged
merged 4 commits into from
Jan 25, 2025

Conversation

dvir001
Copy link
Contributor

@dvir001 dvir001 commented Jan 25, 2025

About the PR

Nothing

Why / Balance

Broken namespace

Technical details

$github = "C:\GitHub\Delta-v"
$githubPaths = @("$github\Content.*", "$github\Resources")

$oldNamespace = "Einstein-Engines"
$newNamespace = "_EE"

# Function to rename folders recursively
function Rename-FoldersRecursively
{
	param (
		[string]$path,
		[string]$oldName,
		[string]$newName
	)
	
	Get-ChildItem -Path $path -Directory -Recurse | ForEach-Object {
		if ($_.Name -eq $oldName)
		{
			$newPath = Join-Path -Path $_.Parent.FullName -ChildPath $newName
			if (-not (Test-Path -Path $newPath))
			{
				Rename-Item -Path $_.FullName -NewName $newName
			}
			else
			{
				# Move contents of the old folder to the new folder
				Get-ChildItem -Path $_.FullName -Recurse | ForEach-Object {
					$destination = Join-Path -Path $newPath -ChildPath $_.Name
					Move-Item -Path $_.FullName -Destination $destination
				}
				# Remove the old folder
				Remove-Item -Path $_.FullName -Recurse -Force
			}
		}
	}
}

# Rename all old namespace folders to new namespace in each specified path
foreach ($path in $githubPaths)
{
	Rename-FoldersRecursively -Path $path -OldName "$oldNamespace" -NewName "$newNamespace"
}

# Rename files content
Get-ChildItem -Path "$github\Content.*\*.cs", "$github\Content.Client\*.xaml" -Recurse | ForEach-Object {
	$content = Get-Content $_.FullName
	if ($content -match "\.$oldNamespace\." -or $content -match "/$oldNamespace/")
	{
		$content -replace "\.$oldNamespace\.", ".$newNamespace." -replace "/$oldNamespace/", "/$newNamespace/" | Set-Content $_.FullName
	}
}

Get-ChildItem -Path "$github\Resources\*.yml" -Recurse | ForEach-Object {
	$content = Get-Content $_.FullName
	if ($content -match "$oldNamespace/")
	{
		$content -replace "$oldNamespace/", "$newNamespace/" | Set-Content $_.FullName
	}
}

Media

image

Requirements

  • I have tested all added content and changes.
  • I have added media to this PR or it does not require an ingame showcase.

Breaking changes

No

Changelog
No

@dvir001 dvir001 requested review from a team as code owners January 25, 2025 21:42
@github-actions github-actions bot added S: Needs Review size/XS Under 16 lines Changes: YML Changes any yml files Changes: Localization Changes any ftl files Changes: Sprite Changes any png or json in an rsi and removed S: Needs Review size/XS Under 16 lines labels Jan 25, 2025
Copy link
Contributor

github-actions bot commented Jan 25, 2025

RSI Diff Bot; head commit b2cc023 merging into f5b33cd
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:
Edit: diff updated after b2cc023

Copy link
Contributor

RSI Diff Bot; head commit 6660b93 merging into f5b33cd
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

@github-actions github-actions bot added size/L 256-1023 lines and removed size/XS Under 16 lines labels Jan 25, 2025
@VMSolidus
Copy link
Contributor

Wait this isn't my repo, I tabbed into the wrong spot.

@deltanedas deltanedas merged commit 38dffdf into DeltaV-Station:master Jan 25, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: Localization Changes any ftl files Changes: Sprite Changes any png or json in an rsi Changes: YML Changes any yml files S: Needs Review size/L 256-1023 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants