Skip to content

Commit ec02af1

Browse files
committed
Initial commit
0 parents  commit ec02af1

File tree

16 files changed

+512
-0
lines changed

16 files changed

+512
-0
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Build the solution
15+
run: dotnet build "TextAssetDumper.sln" -c Release
16+
17+
- name: Find zip
18+
id: find-zip
19+
run: |
20+
echo "zip=$(ls -1 dist/TextAssetDumper-*.zip | head -n 1)" >> $GITHUB_ENV
21+
echo "artifact_name=TextAssetDumperRelease" >> $GITHUB_ENV
22+
23+
- name: Upload zip artifact
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: ${{ env.artifact_name }}
27+
path: ${{ env.zip }}
28+

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Upload release
2+
3+
on:
4+
release:
5+
types: [ "published" ]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions: write-all
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Install jq
16+
uses: dcarbone/[email protected]
17+
18+
- name: Build the solution
19+
run: |
20+
version=$(jq -r '.version' plugin_template/swinfo.json)
21+
echo "Version is $version"
22+
dotnet build "TextAssetDumper.sln" -c Release
23+
echo "release_filename=TextAssetDumper-$version.zip" >> $GITHUB_ENV
24+
echo "zip=$(ls -1 dist/TextAssetDumper-*.zip | head -n 1)" >> $GITHUB_ENV
25+
echo "upload_url=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].upload_url' | tr -d \")" >> $GITHUB_ENV
26+
27+
- name: Upload zip to release
28+
uses: shogo82148/[email protected]
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
upload_url: ${{ env.upload_url }}
33+
asset_path: ${{ env.zip }}
34+
asset_name: ${{ env.release_filename }}
35+
asset_content_type: application/zip
36+

.github/workflows/verify.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Verify swinfo.json
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
verify:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
15+
- name: Verify KSP2 Mod
16+
uses: Rexicon226/[email protected]

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# General C# project
2+
*.suo
3+
*.user
4+
.vs/
5+
[Bb]in/
6+
[Oo]bj/
7+
_UpgradeReport_Files/
8+
/[Pp]ackages/
9+
10+
# Mod template folders
11+
/[Bb]uild/
12+
/[Dd]ist/
13+
/[Nn]uget/
14+
15+
# Rider
16+
/.idea/
17+
18+
# User specific
19+
**/.idea/**/workspace.xml
20+
**/.idea/**/tasks.xml
21+
**/.idea/shelf/*
22+
**/.idea/dictionaries
23+
**/.idea/httpRequests/
24+
25+
# Sensitive or high-churn files
26+
**/.idea/**/dataSources/
27+
**/.idea/**/dataSources.ids
28+
**/.idea/**/dataSources.xml
29+
**/.idea/**/dataSources.local.xml
30+
**/.idea/**/sqlDataSources.xml
31+
**/.idea/**/dynamic.xml
32+
33+
# Rider auto-generates .iml files, and contentModel.xml
34+
**/.idea/**/*.iml
35+
**/.idea/**/contentModel.xml
36+
**/.idea/**/modules.xml
37+
38+
# VS Code files
39+
.vscode/*
40+
!.vscode/settings.json
41+
!.vscode/tasks.json
42+
!.vscode/launch.json
43+
!.vscode/extensions.json
44+
*.code-workspace
45+
46+
# Local History for Visual Studio Code
47+
.history/
48+
49+
# OS-specific
50+
Thumbs.db
51+
Desktop.ini
52+
.DS_Store

Directory.Build.props

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<PropertyGroup Label="Framework and language configuration">
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<LangVersion>latest</LangVersion>
7+
<ImplicitUsings>true</ImplicitUsings>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Label="Game folder configuration">
11+
<!-- Set this to the path to your KSP 2 folder if you don't have the KSP2DIR environmental variable set -->
12+
<KSP2DIR Condition="'$(KSP2DIR)' == ''">C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2</KSP2DIR>
13+
</PropertyGroup>
14+
15+
<PropertyGroup Label="Build and namespace configuration">
16+
<SolutionDir Condition="'$(SolutionDir)'==''">$(MSBuildThisFileDirectory)</SolutionDir>
17+
<PluginBinPath>$(SolutionDir)build/bin/plugin/$(Configuration)</PluginBinPath>
18+
<PluginObjPath>$(SolutionDir)build/obj/plugin/$(Configuration)</PluginObjPath>
19+
<BaseOutputPath>$(PluginBinPath)/$(MSBuildProjectName)</BaseOutputPath>
20+
<BaseIntermediateOutputPath>$(PluginObjPath)/$(MSBuildProjectName)</BaseIntermediateOutputPath>
21+
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
22+
<RootNamespace>$(AssemblyName)</RootNamespace>
23+
<Configurations>Debug;Release;Deploy;DeployAndRun</Configurations>
24+
<Platforms>AnyCPU</Platforms>
25+
<NoWarn>$(NoWarn);CS0436</NoWarn>
26+
</PropertyGroup>
27+
28+
<PropertyGroup Label="Package source configuration">
29+
<RestoreAdditionalProjectSources>
30+
https://nuget.spacewarp.org/v3/index.json
31+
</RestoreAdditionalProjectSources>
32+
</PropertyGroup>
33+
34+
<ItemGroup Label="Dependencies for build targets">
35+
<PackageReference Include="JsonPeek" Version="1.2.0" PrivateAssets="all"/>
36+
</ItemGroup>
37+
38+
<!-- Define the main target -->
39+
<Target Label="Reading properties from swinfo.json" Name="ReadPropertiesFromJson" BeforeTargets="PreBuildEvent;AddGeneratedFile">
40+
<JsonPeek ContentPath="$(SolutionDir)/plugin_template/swinfo.json" Query="$">
41+
<Output TaskParameter="Result" ItemName="Swinfo"/>
42+
</JsonPeek>
43+
44+
<!-- Extract properties from the JSON -->
45+
<PropertyGroup>
46+
<ModId>@(Swinfo -> '%(mod_id)')</ModId>
47+
<Version>@(Swinfo -> '%(version)')</Version>
48+
<Version Condition="$(Version.Contains('-'))">$(Version.Substring(0, $(Version.IndexOf('-'))))</Version>
49+
<Product>@(Swinfo -> '%(name)')</Product>
50+
<Authors>@(Swinfo -> '%(author)')</Authors>
51+
<Description>@(Swinfo -> '%(description)')</Description>
52+
<RepositoryType>git</RepositoryType>
53+
<RepositoryUrl>@(Swinfo -> '%(source)')</RepositoryUrl>
54+
<SpaceWarpPluginGuid>$(ModId)</SpaceWarpPluginGuid>
55+
<SpaceWarpPluginName>$(Product)</SpaceWarpPluginName>
56+
<SpaceWarpPluginVersion>$(Version)</SpaceWarpPluginVersion>
57+
</PropertyGroup>
58+
</Target>
59+
</Project>

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Cheese;munix
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Text Asset Dumper
2+
Dumps all text assets from addressables and all localizations.
3+
4+
## Requirements
5+
- [SpaceWarp 1.6.0](https://github.com/SpaceWarpDev/SpaceWarp/releases) or later.
6+
7+
## Installation
8+
1. Download the latest version from the [releases page](https://github.com/KSP2Community/TextAssetDumper/releases).
9+
2. Unzip the archive into your KSP installation folder.
10+
11+
## Usage
12+
13+
This mod adds a **DUMP** button to the main menu. After you click on it and wait for a few seconds, all text assets and
14+
localizations will be dumped into `KSP2/BepInEx/plugins/TextAssetDumper/dump`. Inside it, you will find the folders
15+
`text_assets`, which contains subfolders for individual addressable labels, and `localizations`, which contains files
16+
for each localization source.
17+
18+
The dump folder is deleted and recreated every time you dump, so make sure to move any files you want to keep out of it
19+
before dumping again.
20+
21+
The dumped text assets will contain any changes made to them by Patch Manager, so if you want to get the original
22+
text assets, you will need to either uninstall Patch Manager temporarily, or get rid of all the patches that modify the
23+
original text assets.

TextAssetDumper.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{B4F3FD21-4A18-471A-9DD0-3756B3CBEFA2}") = "TextAssetDumper", "src/TextAssetDumper/TextAssetDumper.csproj", "{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}"
4+
EndProject
5+
Global
6+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7+
Debug|Any CPU = Debug|Any CPU
8+
Release|Any CPU = Release|Any CPU
9+
Deploy|Any CPU = Deploy|Any CPU
10+
DeployAndRun|Any CPU = DeployAndRun|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU
18+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.Deploy|Any CPU.Build.0 = Deploy|Any CPU
19+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU
20+
{7BC53D94-4B06-4265-9EC1-51AB85B49A6A}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU
21+
EndGlobalSection
22+
EndGlobal
23+

plugin_template/swinfo.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"spec": "2.0",
3+
"mod_id": "TextAssetDumper",
4+
"author": "Cheese;munix",
5+
"name": "Text Asset Dumper",
6+
"description": "Dumps all text assets from addressables and all localizations.",
7+
"source": "https://github.com/KSP2Community/TextAssetDumper",
8+
"version": "2.0.0",
9+
"version_check": "https://raw.githubusercontent.com/KSP2Community/TextAssetDumper/main/plugin_template/swinfo.json",
10+
"ksp2_version": {
11+
"min": "0.2.0",
12+
"max": "*"
13+
},
14+
"dependencies": [
15+
{
16+
"id": "com.github.x606.spacewarp",
17+
"version": {
18+
"min": "1.7.0",
19+
"max": "*"
20+
}
21+
}
22+
]
23+
}

scripts/build-debug.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
dotnet build "../TextAssetDumper.sln" -c Debug

0 commit comments

Comments
 (0)