Skip to content

Commit

Permalink
Changed RePKG.Core and RePKG.Application to NET Standard 2.0
Browse files Browse the repository at this point in the history
Updated references
Updated README
Updated commands help
Updater Publish.bat
  • Loading branch information
notscuffed committed Jan 8, 2020
1 parent ade723b commit 3d39102
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 48 deletions.
7 changes: 4 additions & 3 deletions Publish.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ SET outputDirectory=%~dp0\Publish
del %outputDirectory%\RePKG.zip
msbuild /p:OutputPath="%outputDirectory%" /p:Configuration=Release RePKG

ilrepack /out:"%outputDirectory%\output.exe" /wildcards /parallel "%outputDirectory%\RePKG.exe" "%outputDirectory%\*.dll"
del %outputDirectory%\RePKG.exe
move %outputDirectory%\output.exe %outputDirectory%\RePKG.exe
move %outputDirectory%\RePKG.exe %outputDirectory%\input.exe
ilrepack /out:"%outputDirectory%\RePKG.exe" /wildcards /parallel "%outputDirectory%\input.exe" "%outputDirectory%\*.dll"
del %outputDirectory%\input.exe
del %outputDirectory%\*.dll
del %outputDirectory%\*.pdb
del %outputDirectory%\*.config
del %outputDirectory%\*.json
cd %outputDirectory%
7z a -tzip RePKG.zip *
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# RePKG
Wallpaper engine PKG unpacker/TEX decompiler, written in C#.
Made using information obtained from reverse engineering "resourcecompiler.exe" in wallpaper engine bin's folder.
Wallpaper engine PKG unpacker/TEX converter, written in C#.
PKG and TEX formats reverse engineered by me.

Feel free to report errors or request a pull if you have fixed/added something.
Feel free to report errors.

# Features
- Extract PKG files
- Convert PKG into wallpaper engine project
- Unpack PKG files
- Decompile TEX
- Show info about PKG/TEX files
- Convert TEX to image
- Dump PKG/TEX info

### Commands
- help - shows those commands, use `help "extract"` and `help "info"` to see options for them
Expand All @@ -18,38 +18,38 @@ Feel free to report errors or request a pull if you have fixed/added something.
-i, --ignoreexts Don't extract files with specified extensions (delimited by comma ",")
-e, --onlyexts Only extract files with specified extensions (delimited by comma ",")
-d, --debuginfo Print debug info while extracting/decompiling
-t, --tex Decompile all tex files from specified directory in input
-t, --tex Convert all TEX files into images from specified directory in input
-s, --singledir Should all extracted files be put in one directory instead of their entry path
-r, --recursive Recursive search in all subfolders of specified directory
-c, --copyproject Copy project.json and preview.jpg from beside .pkg into output directory
-c, --copyproject Copy project.json and preview.jpg from beside PKG into output directory
-n, --usename Use name from project.json as project subfolder name instead of id
--no-tex-decompile Don't decompile .tex files while extracting .pkg
--no-tex-convert Don't convert TEX files into images while extracting PKG
--overwrite Overwrite all existing files
```
- info - Shows info and entries in PKG/TEX file
- info - Dumps PKG/TEX info
```
-s, --sort Sort entries
-s, --sort Sort entries a-z
-b, --sortby (Default: name) Sort by ... (available options: name, extension, size)
-t, --tex Get info about all tex files from specified directory in input
-p, --projectinfo Select info from project.json to print (delimit using comma)
-t, --tex Dump info about all TEX files from specified directory
-p, --projectinfo Keys to dump from project.json (delimit using comma) (* for all)
-e, --printentries Print entries in packages
--title-filter Title filter
```

### Examples
Find .pkg files in subfolders of specified directory and make wallpaper engine projects out of them in output directory
Simply extract PKG and convert TEX entries into images to output folder created in current directory
```
repkg extract -c E:\Games\steamapps\workshop\content\431960
repkg extract E:\Games\steamapps\workshop\content\123\scene.pkg
```
Find .pkg files in subfolders of specified directory and only decompile .tex entries to png and put them in ./output omitting their paths from .pkg:
Find PKG files in subfolders of specified directory and make wallpaper engine projects out of them in output directory
```
repkg extract -e tex -s -o ./output E:\Games\steamapps\workshop\content\431960
repkg extract -c E:\Games\steamapps\workshop\content\123
```
Extract all files from specific .pkg to output directory while keeping their paths from .pkg
Find PKG files in subfolders of specified directory and only convert TEX entries to png then put them in ./output omitting their paths from PKG:
```
repkg extract -o ./output E:\Games\steamapps\workshop\content\431960\scene.pkg
repkg extract -e tex -s -o ./output E:\Games\steamapps\workshop\content\123
```
Convert all .tex files from specific folder to png
Convert all TEX files to images from specific folder
```
repkg extract -t -s E:\path\to\dir\with\tex\files
```
5 changes: 3 additions & 2 deletions RePKG.Application/RePKG.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>0.2.0</Version>
<Copyright>Copyright © NotScuffed 2020</Copyright>
Expand All @@ -12,6 +12,7 @@

<ItemGroup>
<PackageReference Include="K4os.Compression.LZ4" Version="1.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion RePKG.Core/RePKG.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.2.0</Version>
<Copyright>Copyright © NotScuffed 2020</Copyright>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions RePKG.Tests/RePKG.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\RePKG\RePKG.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<ProjectReference Include="..\RePKG.Application\RePKG.Application.csproj" />
</ItemGroup>
</Project>
15 changes: 7 additions & 8 deletions RePKG/Command/Extract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,10 @@ private static void ExtractEntry(PackageEntry entry, ref string outputDirectory)
File.WriteAllBytes(filePath, entry.Bytes);
}

// decompile and save
if (_options.NoTexDecompile || entry.Type != EntryType.Tex)
// convert and save
if (_options.NoTexConvert || entry.Type != EntryType.Tex)
return;


var tex = LoadTex(entry.Bytes, entry.FullPath);

if (tex == null)
Expand Down Expand Up @@ -363,7 +362,7 @@ private static Tex LoadTex(byte[] bytes, string name)
}


[Verb("extract", HelpText = "Extract .pkg/Decompile .tex")]
[Verb("extract", HelpText = "Extract PKG/Convert TEX into image.")]
public class ExtractOptions
{
[Option('o', "output", Required = false, HelpText = "Output directory", Default = "./output")]
Expand All @@ -376,7 +375,7 @@ public class ExtractOptions
[Option('e', "onlyexts", HelpText = "Only extract files with specified extensions (delimited by comma \",\")")]
public string OnlyExts { get; set; }

[Option('t', "tex", HelpText = "Decompile all tex files from specified directory in input")]
[Option('t', "tex", HelpText = "Convert all tex files into images from specified directory in input")]
public bool TexDirectory { get; set; }

[Option('s', "singledir", HelpText =
Expand All @@ -387,14 +386,14 @@ public class ExtractOptions
public bool Recursive { get; set; }

[Option('c', "copyproject", HelpText =
"Copy project.json and preview.jpg from beside .pkg into output directory")]
"Copy project.json and preview.jpg from beside PKG into output directory")]
public bool CopyProject { get; set; }

[Option('n', "usename", HelpText = "Use name from project.json as project subfolder name instead of id")]
public bool UseName { get; set; }

[Option("no-tex-decompile", HelpText = "Don't decompile .tex files while extracting .pkg")]
public bool NoTexDecompile { get; set; }
[Option("no-tex-convert", HelpText = "Don't convert TEX files into images while extracting PKG")]
public bool NoTexConvert { get; set; }

[Option("overwrite", HelpText = "Overwrite all existing files")]
public bool Overwrite { get; set; }
Expand Down
10 changes: 4 additions & 6 deletions RePKG/Command/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ private static void InfoPkg(FileInfo file, string name)

Console.WriteLine($"\r\n### Package info: {name}");

if (projectInfo != null &&
_projectInfoToPrint != null &&
_projectInfoToPrint.Length > 0)
if (projectInfo != null && _projectInfoToPrint?.Length > 0)
{
IEnumerable<string> projectInfoEnumerator;

Expand Down Expand Up @@ -177,7 +175,7 @@ private static bool MatchesFilter(dynamic project)
}
}

[Verb("info", HelpText = "Show info about PKG/TEX")]
[Verb("info", HelpText = "Dumps PKG/TEX info.")]
public class InfoOptions
{
[Value(0, Required = true, HelpText = "Path to file which you want to get info about", MetaName = "Input file")]
Expand All @@ -189,10 +187,10 @@ public class InfoOptions
[Option('b', "sortby", HelpText = "Sort by ... (available options: name, extension, size)", Default = "name")]
public string SortBy { get; set; }

[Option('t', "tex", HelpText = "Get info about all tex files from specified directory in input")]
[Option('t', "tex", HelpText = "Dump info about all tex files from specified directory")]
public bool TexDirectory { get; set; }

[Option('p', "projectinfo", HelpText = "Select info from project.json to print (delimit using comma)")]
[Option('p', "projectinfo", HelpText = "Keys to dump from project.json (delimit using comma) (* for all)")]
public string ProjectInfo { get; set; }

[Option('e', "printentries", HelpText = "Print entries in packages")]
Expand Down
6 changes: 2 additions & 4 deletions RePKG/RePKG.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.6.0" />
<PackageReference Include="CommandLineParser" Version="2.7.82" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<None Include="$(ProjectDir)/../Licenses.txt"
CopyToOutputDirectory="PreserveNewest"
CopyToPublishDirectory="PreserveNewest"/>
<None Include="$(ProjectDir)/../Licenses.txt" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
</Project>

0 comments on commit 3d39102

Please sign in to comment.