Skip to content

Commit

Permalink
Add R2R Export Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Jun 23, 2022
1 parent 46e7a92 commit 62fa5da
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Heroes.Fun.AuraColorizer/Heroes.Fun.AuraColorizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ApplicationIcon />
<OutputType>WinExe</OutputType>
<StartupObject />
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
6 changes: 5 additions & 1 deletion Heroes.Fun.AuraColorizer/ModConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"ModId": "sonicheroes.fun.colourizer",
"ModName": "Sonic Heroes: Colourizer",
"ModAuthor": "Sewer56",
"ModVersion": "1.0.1",
"ModVersion": "1.0.3",
"ModDescription": "Sonic Heroes but a bit more like a Corsair Keyboard.",
"ModDll": "Heroes.Fun.AuraColorizer.dll",
"ModR2RManagedDll32": "x86/Heroes.Fun.AuraColorizer.dll",
"ModR2RManagedDll64": "x64/Heroes.Fun.AuraColorizer.dll",
"ModNativeDll32": "",
"ModNativeDll64": "",
"ModIcon": "Preview.png",
"ModDependencies": [],
"SupportedAppId": [ "tsonic_win.exe" ]
Expand Down
2 changes: 2 additions & 0 deletions Heroes.Fun.AuraColorizer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ public class Program : IMod
private ILogger _logger;
private string _modDirectory;

public static void Main() { }
public unsafe void Start(IModLoaderV1 loader)
{
_modLoader = (IModLoader) loader;
_logger = (ILogger) _modLoader.GetLogger();
_modDirectory = _modLoader.GetDirectoryForModId(ThisModId);


/* Your mod code starts here. */
_config = Config.Config.FromJson(_modDirectory);
_config.ToJson(_modDirectory);
Expand Down
31 changes: 19 additions & 12 deletions Publish.ps1
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
# Project Output Paths
$modOutputPath = "Heroes.Fun.AuraColorizer/bin"
$modOutputPath = "Release"
$solutionName = "Heroes.Fun.AuraColorizer.sln"
$publishName = "sonicheroes.fun.colourizer.zip"
$publishDirectory = "Publish"

if ([System.IO.Directory]::Exists($publishDirectory)) {
Get-ChildItem $publishDirectory -Include * -Recurse | Remove-Item -Force -Recurse
}
[Environment]::CurrentDirectory = $PWD

# Clean anything in existing Release directory.
Remove-Item $modOutputPath -Recurse
New-Item $modOutputPath -ItemType Directory
New-Item $publishDirectory -ItemType Directory

# Build
dotnet restore $solutionName
dotnet clean $solutionName
dotnet build -c Release $solutionName
dotnet publish $solutionName -c Release --self-contained false -o "$modOutputPath"
dotnet publish $solutionName -c Release -r win-x86 --self-contained false -o "$modOutputPath/x86" /p:PublishReadyToRun=true
dotnet publish $solutionName -c Release -r win-x64 --self-contained false -o "$modOutputPath/x64" /p:PublishReadyToRun=true

# Remove Redundant Files
Remove-Item "$modOutputPath/x86/Preview.png"
Remove-Item "$modOutputPath/x64/Preview.png"
Remove-Item "$modOutputPath/x86/ModConfig.json"
Remove-Item "$modOutputPath/x64/ModConfig.json"

# Cleanup
# Cleanup Unnecessary Files
Get-ChildItem $modOutputPath -Include *.exe -Recurse | Remove-Item -Force -Recurse
Get-ChildItem $modOutputPath -Include *.pdb -Recurse | Remove-Item -Force -Recurse
Get-ChildItem $modOutputPath -Include *.xml -Recurse | Remove-Item -Force -Recurse

# Make compressed directory
if (![System.IO.Directory]::Exists($publishDirectory)) {
New-Item $publishDirectory -ItemType Directory
}

# Compress
Add-Type -A System.IO.Compression.FileSystem
[IO.Compression.ZipFile]::CreateFromDirectory( $modOutputPath + '/Release', $publishDirectory + '/' + $publishName)
[IO.Compression.ZipFile]::CreateFromDirectory($modOutputPath, "$publishDirectory/$publishName")

0 comments on commit 62fa5da

Please sign in to comment.