From c32730122fb124e84bffc5f717ac8398c34bb3b4 Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:01:30 +0800 Subject: [PATCH 1/9] Update ModInfo.cs --- BulldozeIt/ModInfo.cs | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/BulldozeIt/ModInfo.cs b/BulldozeIt/ModInfo.cs index 3ddd409..d2409fe 100644 --- a/BulldozeIt/ModInfo.cs +++ b/BulldozeIt/ModInfo.cs @@ -1,22 +1,25 @@ using ICities; using System; using System.Reflection; - +/* +中文翻译支持 +2024.04.03 by`TacKana +*/ namespace BulldozeIt { public class ModInfo : IUserMod { - public string Name => "Bulldoze It!"; - public string Description => "Allows to automate the bulldozing of buildings."; + public string Name => "自动化推土机!"; + public string Description => "自动化推土机!增高自动推平废弃建筑物功能。"; private static readonly string[] IntervalLabels = { - "End of Day", - "End of Month", - "End of Year", - "Every 5 seconds", - "Every 10 seconds", - "Every 30 seconds" + "一天一次", + "一月一次", + "一年一次", + "5秒一次", + "10秒一次", + "30秒/半分钟一次" }; private static readonly int[] IntervalValues = @@ -43,14 +46,14 @@ public void OnSettingsUI(UIHelperBase helper) int result; selectedIndex = GetSelectedOptionIndex(IntervalValues, ModConfig.Instance.Interval); - group.AddDropdown("Interval", IntervalLabels, selectedIndex, sel => + group.AddDropdown("自动化推土机工作时间", IntervalLabels, selectedIndex, sel => { ModConfig.Instance.Interval = IntervalValues[sel]; ModConfig.Instance.Save(); }); selectedValue = ModConfig.Instance.MaxBuildingsPerInterval; - group.AddTextfield("Max Buildings (per interval)", selectedValue.ToString(), sel => + group.AddTextfield("每次最大铲除多少废弃建筑物?", selectedValue.ToString(), sel => { int.TryParse(sel, out result); ModConfig.Instance.MaxBuildingsPerInterval = result; @@ -58,28 +61,28 @@ public void OnSettingsUI(UIHelperBase helper) }); selected = ModConfig.Instance.PreserveHistoricalBuildings; - group.AddCheckbox("Preserve Historical Buildings", selected, sel => + group.AddCheckbox("是否排除历史建筑物?", selected, sel => { ModConfig.Instance.PreserveHistoricalBuildings = sel; ModConfig.Instance.Save(); }); selected = ModConfig.Instance.IgnoreSearchingForSurvivors; - group.AddCheckbox("Ignore Searching For Survivors", selected, sel => + group.AddCheckbox("忽略搜索幸存者(机翻的不太理解意思)", selected, sel => { ModConfig.Instance.IgnoreSearchingForSurvivors = sel; ModConfig.Instance.Save(); }); selected = ModConfig.Instance.ShowCounters; - group.AddCheckbox("Show Counters in Bulldozer Bar", selected, sel => + group.AddCheckbox("是否显示已经铲除建筑数量?", selected, sel => { ModConfig.Instance.ShowCounters = sel; ModConfig.Instance.Save(); }); selected = ModConfig.Instance.ShowStatistics; - group.AddCheckbox("Show Statistics in Info Panel", selected, sel => + group.AddCheckbox("是否在日志面板中显示统计信息?", selected, sel => { ModConfig.Instance.ShowStatistics = sel; ModConfig.Instance.Save(); @@ -94,4 +97,4 @@ private int GetSelectedOptionIndex(int[] option, int value) return index; } } -} \ No newline at end of file +} From cc0f84141e8d6fb7973b7741ade8a288c9f9e407 Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:02:45 +0800 Subject: [PATCH 2/9] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a71fe79 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +为天际线自动化推土机mod添加中文支持 From 3b2b9463f2bb42ca9f81f00d3d1c419754d07c9f Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:09:27 +0800 Subject: [PATCH 3/9] Create dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 115 +++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml new file mode 100644 index 0000000..e718dd9 --- /dev/null +++ b/.github/workflows/dotnet-desktop.yml @@ -0,0 +1,115 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow will build, test, sign and package a WPF or Windows Forms desktop application +# built on .NET Core. +# To learn how to migrate your existing application to .NET Core, +# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework +# +# To configure this workflow: +# +# 1. Configure environment variables +# GitHub sets default environment variables for every workflow run. +# Replace the variables relative to your project in the "env" section below. +# +# 2. Signing +# Generate a signing certificate in the Windows Application +# Packaging Project or add an existing signing certificate to the project. +# Next, use PowerShell to encode the .pfx file using Base64 encoding +# by running the following Powershell script to generate the output string: +# +# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte +# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' +# +# Open the output file, SigningCertificate_Encoded.txt, and copy the +# string inside. Then, add the string to the repo as a GitHub secret +# and name it "Base64_Encoded_Pfx." +# For more information on how to configure your signing certificate for +# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing +# +# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". +# See "Build the Windows Application Packaging project" below to see how the secret is used. +# +# For more information on GitHub Actions, refer to https://github.com/features/actions +# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, +# refer to https://github.com/microsoft/github-actions-for-desktop-apps + +name: .NET Core Desktop + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Debug, Release] + + runs-on: windows-latest # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v2 + + # Execute all unit tests in the solution + - name: Execute unit tests + run: dotnet test + + # Restore the application to populate the obj folder with RuntimeIdentifiers + - name: Restore the application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + # Decode the base 64 encoded pfx and save the Signing_Certificate + - name: Decode the pfx + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") + $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx + [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) + + # Create the app package by building and packaging the Windows Application Packaging project + - name: Create the app package + run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} + env: + Appx_Bundle: Always + Appx_Bundle_Platforms: x86|x64 + Appx_Package_Build_Mode: StoreUpload + Configuration: ${{ matrix.configuration }} + + # Remove the pfx + - name: Remove the pfx + run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx + + # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: MSIX Package + path: ${{ env.Wap_Project_Directory }}\AppPackages From b6f5717f4508274c6c720ea3a9387179dcf38dbd Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:13:40 +0800 Subject: [PATCH 4/9] Delete .github/workflows directory --- .github/workflows/dotnet-desktop.yml | 115 --------------------------- 1 file changed, 115 deletions(-) delete mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml deleted file mode 100644 index e718dd9..0000000 --- a/.github/workflows/dotnet-desktop.yml +++ /dev/null @@ -1,115 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will build, test, sign and package a WPF or Windows Forms desktop application -# built on .NET Core. -# To learn how to migrate your existing application to .NET Core, -# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework -# -# To configure this workflow: -# -# 1. Configure environment variables -# GitHub sets default environment variables for every workflow run. -# Replace the variables relative to your project in the "env" section below. -# -# 2. Signing -# Generate a signing certificate in the Windows Application -# Packaging Project or add an existing signing certificate to the project. -# Next, use PowerShell to encode the .pfx file using Base64 encoding -# by running the following Powershell script to generate the output string: -# -# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte -# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' -# -# Open the output file, SigningCertificate_Encoded.txt, and copy the -# string inside. Then, add the string to the repo as a GitHub secret -# and name it "Base64_Encoded_Pfx." -# For more information on how to configure your signing certificate for -# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing -# -# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". -# See "Build the Windows Application Packaging project" below to see how the secret is used. -# -# For more information on GitHub Actions, refer to https://github.com/features/actions -# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, -# refer to https://github.com/microsoft/github-actions-for-desktop-apps - -name: .NET Core Desktop - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - - build: - - strategy: - matrix: - configuration: [Debug, Release] - - runs-on: windows-latest # For a list of available runner types, refer to - # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on - - env: - Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. - Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Install the .NET Core workload - - name: Install .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v2 - - # Execute all unit tests in the solution - - name: Execute unit tests - run: dotnet test - - # Restore the application to populate the obj folder with RuntimeIdentifiers - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration - env: - Configuration: ${{ matrix.configuration }} - - # Decode the base 64 encoded pfx and save the Signing_Certificate - - name: Decode the pfx - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx - [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) - - # Create the app package by building and packaging the Windows Application Packaging project - - name: Create the app package - run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} - env: - Appx_Bundle: Always - Appx_Bundle_Platforms: x86|x64 - Appx_Package_Build_Mode: StoreUpload - Configuration: ${{ matrix.configuration }} - - # Remove the pfx - - name: Remove the pfx - run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx - - # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: MSIX Package - path: ${{ env.Wap_Project_Directory }}\AppPackages From 3e794ee4178ca4fab32eefa82e45361aedbbe104 Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:17:14 +0800 Subject: [PATCH 5/9] Create dotnet.yml --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..c62b908 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal From 394972dd37a57056f73e85d1d94b10b629f8916e Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:19:40 +0800 Subject: [PATCH 6/9] Delete .github/workflows directory --- .github/workflows/dotnet.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml deleted file mode 100644 index c62b908..0000000 --- a/.github/workflows/dotnet.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: .NET - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal From d61e0ff54d5237c01d2d315318a39a0f93e6876f Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:38:31 +0800 Subject: [PATCH 7/9] Create dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml new file mode 100644 index 0000000..c09db95 --- /dev/null +++ b/.github/workflows/dotnet-desktop.yml @@ -0,0 +1,57 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow will build, test, sign and package a WPF or Windows Forms desktop application +# built on .NET Core. +# To learn how to migrate your existing application to .NET Core, +# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework +# +# To configure this workflow: +# +# 1. Configure environment variables +# GitHub sets default environment variables for every workflow run. +# Replace the variables relative to your project in the "env" section below. +# +# 2. Signing +# Generate a signing certificate in the Windows Application +# Packaging Project or add an existing signing certificate to the project. +# Next, use PowerShell to encode the .pfx file using Base64 encoding +# by running the following Powershell script to generate the output string: +# +# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte +# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' +# +# Open the output file, SigningCertificate_Encoded.txt, and copy the +# string inside. Then, add the string to the repo as a GitHub secret +# and name it "Base64_Encoded_Pfx." +# For more information on how to configure your signing certificate for +# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing +# +# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". +# See "Build the Windows Application Packaging project" below to see how the secret is used. +# +# For more information on GitHub Actions, refer to https://github.com/features/actions +# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, +# refer to https://github.com/microsoft/github-actions-for-desktop-apps + +name: .NET Build & Test + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + strategy: + matrix: + configuration: [Debug, Release] + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup + uses: actions/setup-dotnet@v1 From ec39454c31c58a6217bbea0a589d90b8054bb505 Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:46:07 +0800 Subject: [PATCH 8/9] Delete .github/workflows directory --- .github/workflows/dotnet-desktop.yml | 57 ---------------------------- 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml deleted file mode 100644 index c09db95..0000000 --- a/.github/workflows/dotnet-desktop.yml +++ /dev/null @@ -1,57 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will build, test, sign and package a WPF or Windows Forms desktop application -# built on .NET Core. -# To learn how to migrate your existing application to .NET Core, -# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework -# -# To configure this workflow: -# -# 1. Configure environment variables -# GitHub sets default environment variables for every workflow run. -# Replace the variables relative to your project in the "env" section below. -# -# 2. Signing -# Generate a signing certificate in the Windows Application -# Packaging Project or add an existing signing certificate to the project. -# Next, use PowerShell to encode the .pfx file using Base64 encoding -# by running the following Powershell script to generate the output string: -# -# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte -# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' -# -# Open the output file, SigningCertificate_Encoded.txt, and copy the -# string inside. Then, add the string to the repo as a GitHub secret -# and name it "Base64_Encoded_Pfx." -# For more information on how to configure your signing certificate for -# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing -# -# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". -# See "Build the Windows Application Packaging project" below to see how the secret is used. -# -# For more information on GitHub Actions, refer to https://github.com/features/actions -# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, -# refer to https://github.com/microsoft/github-actions-for-desktop-apps - -name: .NET Build & Test - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - strategy: - matrix: - configuration: [Debug, Release] - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup - uses: actions/setup-dotnet@v1 From 5f4d5ec4d2086dee5db46bc44e6191ab59e84e0b Mon Sep 17 00:00:00 2001 From: new xuxo <77217928+TacKana@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:41:00 +0800 Subject: [PATCH 9/9] Update ModInfo.cs --- BulldozeIt/ModInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BulldozeIt/ModInfo.cs b/BulldozeIt/ModInfo.cs index d2409fe..2d74b33 100644 --- a/BulldozeIt/ModInfo.cs +++ b/BulldozeIt/ModInfo.cs @@ -10,7 +10,7 @@ namespace BulldozeIt public class ModInfo : IUserMod { public string Name => "自动化推土机!"; - public string Description => "自动化推土机!增高自动推平废弃建筑物功能。"; + public string Description => "自动推平废弃建筑物功能!~by github:TacKana"; private static readonly string[] IntervalLabels = {