Merge remote-tracking branch 'origin/general-devel' into general-devel

This commit is contained in:
Cai 2025-05-11 12:01:28 +08:00
commit 167ca4ee01
22 changed files with 114 additions and 99 deletions

View file

@ -11,13 +11,13 @@ jobs:
environment: release environment: release
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: 'recursive' submodules: 'recursive'
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: 6.0.400 dotnet-version: 9.0.x
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build - name: Build

View file

@ -7,13 +7,13 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: 'recursive' submodules: 'recursive'
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '6.0.100' dotnet-version: 9.0.x
- name: Run tests - name: Run tests
run: dotnet test run: dotnet test
@ -25,13 +25,13 @@ jobs:
arch: ["win-x64", "osx-x64", "linux-x64", "linux-arm64", "linux-arm"] arch: ["win-x64", "osx-x64", "linux-x64", "linux-arm64", "linux-arm"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: 'recursive' submodules: 'recursive'
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '6.0.100' dotnet-version: 9.0.x
- name: Install msgfmt - name: Install msgfmt
run: sudo apt-get install -y gettext run: sudo apt-get install -y gettext
@ -39,27 +39,27 @@ jobs:
- name: Produce installer - name: Produce installer
run: | run: |
cd TShockInstaller cd TShockInstaller
dotnet publish -r ${{ matrix.arch }} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained true dotnet publish -r ${{ matrix.arch }} -f net9.0 -c Release -p:PublishSingleFile=true --self-contained true
- name: Produce build - name: Produce build
run: | run: |
cd TShockLauncher cd TShockLauncher
dotnet publish -r ${{ matrix.arch }} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false dotnet publish -r ${{ matrix.arch }} -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false
- name: Chmod scripts - name: Chmod scripts
if: ${{ matrix.arch != 'win-x64' }} if: ${{ matrix.arch != 'win-x64' }}
run: | run: |
chmod +x TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/TShock.Server chmod +x TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/TShock.Server
- name: Copy installer - name: Copy installer
run: | run: |
cp TShockInstaller/bin/Release/net6.0/${{ matrix.arch }}/publish/* TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ cp TShockInstaller/bin/Release/net9.0/${{ matrix.arch }}/publish/* TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/
# preserve file perms: https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files # preserve file perms: https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files
- name: Tarball artifact (non-Windows) - name: Tarball artifact (non-Windows)
if: ${{ matrix.arch != 'win-x64' }} if: ${{ matrix.arch != 'win-x64' }}
run: | run: |
cd TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ cd TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/
tar -cvf ../../../../../../TShock-Beta-${{ matrix.arch }}-Release.tar * tar -cvf ../../../../../../TShock-Beta-${{ matrix.arch }}-Release.tar *
- name: Upload artifact (non-Windows) - name: Upload artifact (non-Windows)
@ -74,4 +74,4 @@ jobs:
if: ${{ matrix.arch == 'win-x64' }} if: ${{ matrix.arch == 'win-x64' }}
with: with:
name: TShock-Beta-${{ matrix.arch }}-Release name: TShock-Beta-${{ matrix.arch }}-Release
path: TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ path: TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/

13
.github/workflows/wiki-notify.yml vendored Normal file
View file

@ -0,0 +1,13 @@
name: Wiki Changed Discord Notification
on:
gollum
jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: 'oznu/gh-wiki-edit-discord-notification@dfc866fd048f04c239ad113eef3c6c73504d333e'
with:
discord-webhook-url: ${{ secrets.DISCORD_WEBHOOK_WIKI_EDIT }}
ignore-collaborators: false

7
.vscode/launch.json vendored
View file

@ -9,12 +9,9 @@
"type": "coreclr", "type": "coreclr",
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "build",
"program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.Run.dll", "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.Server.dll",
"windows": {
"program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.dll",
},
"args": [], "args": [],
"cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/", "cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/",
"console": "integratedTerminal", "console": "integratedTerminal",
"stopAtEntry": false "stopAtEntry": false
}, },

2
.vscode/tasks.json vendored
View file

@ -35,7 +35,7 @@
{ {
"label": "Remote Publish", "label": "Remote Publish",
"options": { "options": {
"cwd": "TShockLauncher/bin/Debug/net6.0/linux-arm64" "cwd": "TShockLauncher/bin/Debug/net9.0/linux-arm64"
}, },
"command": "C:\\Program Files\\PuTTY\\pscp.exe", "command": "C:\\Program Files\\PuTTY\\pscp.exe",
"type": "process", "type": "process",

View file

@ -1,7 +1,7 @@
# TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx. # TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
# They should not be set in the global scope manually. # They should not be set in the global scope manually.
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:9.0 AS builder
# Copy build context # Copy build context
WORKDIR /TShock WORKDIR /TShock
@ -27,10 +27,14 @@ RUN \
*) echo "Error: Unsupported platform ${TARGETPLATFORM}" && exit 1 \ *) echo "Error: Unsupported platform ${TARGETPLATFORM}" && exit 1 \
;; \ ;; \
esac && \ esac && \
dotnet publish -o output/ -r "${ARCH}" -v m -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false dotnet publish -o output/ -r "${ARCH}" -v m -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false
# Runtime image # Runtime image
FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/dotnet/runtime:6.0 AS runner FROM mcr.microsoft.com/dotnet/runtime:9.0 AS linux_base
FROM mcr.microsoft.com/dotnet/runtime:9.0-nanoserver-ltsc2022 AS windows_base
FROM ${TARGETOS}_base AS final
WORKDIR /server WORKDIR /server
COPY --from=builder /TShock/TShockLauncher/output ./ COPY --from=builder /TShock/TShockLauncher/output ./

View file

@ -32,9 +32,9 @@ If you want to run the `TShockLauncher` (which runs a server), run:
To produce a packaged release (suitable for distribution), run: To produce a packaged release (suitable for distribution), run:
1. `cd TShockLauncher` 1. `cd TShockLauncher`
1. `dotnet publish -r win-x64 -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false` 1. `dotnet publish -r win-x64 -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false`
Note that in this example, you'd be building for `win-x64`. You can build for `win-x64`, `osx-x64`, `linux-x64`, `linux-arm64`, `linux-arm`. Your release will be in the `TShockLauncher/bin/Release/net6.0/` folder under the architecture you specified. Note that in this example, you'd be building for `win-x64`. You can build for `win-x64`, `osx-x64`, `linux-x64`, `linux-arm64`, `linux-arm`. Your release will be in the `TShockLauncher/bin/Release/net9.0/` folder under the architecture you specified.
### Working with Terraria ### Working with Terraria

View file

@ -30,9 +30,9 @@ TShock是为泰拉瑞亚服务器和社区开发的一个工具箱。这个工
如果要生成打包后的发行版,运行: 如果要生成打包后的发行版,运行:
1. `cd TShockLauncher` 1. `cd TShockLauncher`
1. `dotnet publish -r win-x64 -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false` 1. `dotnet publish -r win-x64 -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false`
注意在这个例子中你将会生成`win-x64`架构的版本。你也可以生成`win-x64``osx-x64``linux-x64``linux-arm64``linux-arm`的版本。你可以在`TShockLauncher/bin/Release/net6.0/`文件夹下对应架构的文件夹里找到生成后的发行版。 注意在这个例子中你将会生成`win-x64`架构的版本。你也可以生成`win-x64``osx-x64``linux-x64``linux-arm64``linux-arm`的版本。你可以在`TShockLauncher/bin/Release/net9.0/`文件夹下对应架构的文件夹里找到生成后的发行版。
### 跟泰拉瑞亚本体代码交互 ### 跟泰拉瑞亚本体代码交互

View file

@ -74,6 +74,7 @@ namespace TShockAPI.DB
Permissions.canchangepassword, Permissions.canchangepassword,
Permissions.canlogout, Permissions.canlogout,
Permissions.summonboss, Permissions.summonboss,
Permissions.spawnpets,
Permissions.worldupgrades, Permissions.worldupgrades,
Permissions.whisper, Permissions.whisper,
Permissions.wormhole, Permissions.wormhole,

View file

@ -63,7 +63,7 @@ namespace TShockAPI
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary> /// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary> /// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
public static readonly string VersionCodename = "Stargazer"; public static readonly string VersionCodename = "Hopefully SSC works somewhat correctly now edition";
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary> /// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
public static string SavePath = "tshock"; public static string SavePath = "tshock";
@ -428,8 +428,6 @@ namespace TShockAPI
Hooks.AccountHooks.AccountDelete += OnAccountDelete; Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate; Hooks.AccountHooks.AccountCreate += OnAccountCreate;
On.Terraria.RemoteClient.Reset += RemoteClient_Reset;
GetDataHandlers.InitGetDataHandler(); GetDataHandlers.InitGetDataHandler();
Commands.InitCommands(); Commands.InitCommands();
@ -449,7 +447,7 @@ namespace TShockAPI
// Initialize the AchievementManager, which is normally only done on clients. // Initialize the AchievementManager, which is normally only done on clients.
Game._achievements = new AchievementManager(); Game._achievements = new AchievementManager();
IL.Terraria.Initializers.AchievementInitializer.Load += OnAchievementInitializerLoad; OTAPI.Hooks.Initializers.AchievementInitializerLoad += OnAchievementInitializerLoad;
// Actually call AchievementInitializer.Load, which is also normally only done on clients. // Actually call AchievementInitializer.Load, which is also normally only done on clients.
AchievementInitializer.Load(); AchievementInitializer.Load();
@ -498,17 +496,9 @@ namespace TShockAPI
} }
} }
private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client) private static void OnAchievementInitializerLoad(object sender, OTAPI.Hooks.Initializers.AchievementInitializerLoadEventArgs args)
{ {
client.ClientUUID = null; args.ShouldLoad = true;
orig(client);
}
private static void OnAchievementInitializerLoad(ILContext il)
{
// Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions)
for (var i = 0; i < 4; i++)
il.Body.Instructions.RemoveAt(0);
} }
protected void CrashReporter_HeapshotRequesting(object sender, EventArgs e) protected void CrashReporter_HeapshotRequesting(object sender, EventArgs e)
@ -532,7 +522,7 @@ namespace TShockAPI
} }
SaveManager.Instance.Dispose(); SaveManager.Instance.Dispose();
IL.Terraria.Initializers.AchievementInitializer.Load -= OnAchievementInitializerLoad; OTAPI.Hooks.Initializers.AchievementInitializerLoad -= OnAchievementInitializerLoad;
ModuleManager.Dispose(); ModuleManager.Dispose();
@ -1469,8 +1459,8 @@ namespace TShockAPI
Hooks.PlayerHooks.OnPlayerLogout(tsplr); Hooks.PlayerHooks.OnPlayerLogout(tsplr);
} }
// The last player will leave after this hook is executed. // If this is the last player online, update the console title and save the world if needed
if (Utils.GetActivePlayerCount() == 1) if (Utils.GetActivePlayerCount() == 0)
{ {
if (Config.Settings.SaveWorldOnLastPlayerExit) if (Config.Settings.SaveWorldOnLastPlayerExit)
SaveManager.Instance.SaveWorld(); SaveManager.Instance.SaveWorld();

View file

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<!-- <!--
@ -18,11 +18,11 @@
Also, be sure to release on github with the exact assembly version tag as below Also, be sure to release on github with the exact assembly version tag as below
so that the update manager works correctly (via the Github releases api and mimic) so that the update manager works correctly (via the Github releases api and mimic)
--> -->
<Version>5.2.3</Version> <Version>5.2.4</Version>
<AssemblyTitle>TShock for Terraria</AssemblyTitle> <AssemblyTitle>TShock for Terraria</AssemblyTitle>
<Company>Pryaxis &amp; TShock Contributors</Company> <Company>Pryaxis &amp; TShock Contributors</Company>
<Product>TShockAPI</Product> <Product>TShockAPI</Product>
<Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2023</Copyright> <Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2025</Copyright>
<!-- extras for nuget --> <!-- extras for nuget -->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression> <PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
@ -33,9 +33,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" /> <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="GetText.NET" Version="1.7.14" /> <PackageReference Include="GetText.NET" Version="8.0.5" />
<PackageReference Include="MySql.Data" Version="8.4.0" /> <PackageReference Include="MySql.Data" Version="9.1.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.11" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -27,11 +27,11 @@ if (arch is null)
string? url = null; string? url = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-osx-{arch}.tar.gz"; url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-osx-{arch}.tar.gz";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-win-{arch}.zip"; url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-win-{arch}.zip";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-linux-{arch}.tar.gz"; url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-linux-{arch}.tar.gz";
if(url is null) if(url is null)
{ {

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>5.0.0</Version> <Version>5.0.0</Version>

View file

@ -21,17 +21,17 @@ public class GroupTests
groups.AddPermissions("test", new() { "abc" }); groups.AddPermissions("test", new() { "abc" });
var hasperm = groups.GetGroupByName("test").Permissions.Contains("abc"); var hasperm = groups.GetGroupByName("test").Permissions.Contains("abc");
Assert.IsTrue(hasperm); Assert.That(hasperm, Is.True);
groups.DeletePermissions("test", new() { "abc" }); groups.DeletePermissions("test", new() { "abc" });
hasperm = groups.GetGroupByName("test").Permissions.Contains("abc"); hasperm = groups.GetGroupByName("test").Permissions.Contains("abc");
Assert.IsFalse(hasperm); Assert.That(hasperm, Is.False);
groups.DeleteGroup("test"); groups.DeleteGroup("test");
var g = groups.GetGroupByName("test"); var g = groups.GetGroupByName("test");
Assert.IsNull(g); Assert.That(g, Is.Null);
} }
} }

View file

@ -14,20 +14,21 @@ public class ServerInitTests
public void EnsureBoots() public void EnsureBoots()
{ {
var are = new AutoResetEvent(false); var are = new AutoResetEvent(false);
On.Terraria.Main.hook_DedServ cb = (On.Terraria.Main.orig_DedServ orig, Terraria.Main instance) => HookEvents.HookDelegate<Terraria.Main, HookEvents.Terraria.Main.DedServEventArgs> cb = (instance, args) =>
{ {
args.ContinueExecution = false;
are.Set(); are.Set();
Debug.WriteLine("Server init process successful"); Debug.WriteLine("Server init process successful");
}; };
On.Terraria.Main.DedServ += cb; HookEvents.Terraria.Main.DedServ += cb;
new Thread(() => TerrariaApi.Server.Program.Main(new string[] { })).Start(); new Thread(() => TerrariaApi.Server.Program.Main([])).Start();
var hit = are.WaitOne(TimeSpan.FromSeconds(10)); var hit = are.WaitOne(TimeSpan.FromSeconds(10));
On.Terraria.Main.DedServ -= cb; HookEvents.Terraria.Main.DedServ -= cb;
Assert.IsTrue(hit); Assert.That(hit, Is.True);
} }
} }

View file

@ -1,17 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /> <PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.5.0" /> <PackageReference Include="NUnit.Analyzers" Version="4.6.0">
<PackageReference Include="coverlet.collector" Version="3.1.2"> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View file

@ -47,20 +47,11 @@ if (File.Exists("TerrariaServer.exe"))
return 1; return 1;
} }
if (args.Length > 0 && args[0].ToLower() == "plugins")
{
var items = args.ToList();
items.RemoveAt(0);
await NugetCLI.Main(items);
return 0;
}
Dictionary<string, Assembly> _cache = new Dictionary<string, Assembly>(); Dictionary<string, Assembly> _cache = new Dictionary<string, Assembly>();
System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Default_Resolving; System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Default_Resolving;
return Start(); return await StartAsync();
/// <summary> /// <summary>
/// Resolves a module from the ./bin folder, either with a .dll by preference or .exe /// Resolves a module from the ./bin folder, either with a .dll by preference or .exe
@ -71,6 +62,7 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse
if (_cache.TryGetValue(arg2.Name, out Assembly? asm) && asm is not null) return asm; if (_cache.TryGetValue(arg2.Name, out Assembly? asm) && asm is not null) return asm;
var loc = Path.Combine(AppContext.BaseDirectory, "bin", arg2.Name + ".dll"); var loc = Path.Combine(AppContext.BaseDirectory, "bin", arg2.Name + ".dll");
if (File.Exists(loc)) if (File.Exists(loc))
asm = arg1.LoadFromAssemblyPath(loc); asm = arg1.LoadFromAssemblyPath(loc);
@ -88,8 +80,16 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse
/// Initiates the TSAPI server. /// Initiates the TSAPI server.
/// </summary> /// </summary>
/// <remarks>This method exists so that the resolver can attach before TSAPI needs its dependencies.</remarks> /// <remarks>This method exists so that the resolver can attach before TSAPI needs its dependencies.</remarks>
int Start() async Task<int> StartAsync()
{ {
if (args.Length > 0 && args[0].ToLower() == "plugins")
{
var items = args.ToList();
items.RemoveAt(0);
await TShockPluginManager.NugetCLI.Main(items);
return 0;
}
TerrariaApi.Server.Program.Main(args); TerrariaApi.Server.Program.Main(args);
return 0; return 0;
} }

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AssemblyName>TShock.Server</AssemblyName> <!-- TShock was initially decided on by a community poll, however tshock already exists as a folder and will clash --> <AssemblyName>TShock.Server</AssemblyName> <!-- TShock was initially decided on by a community poll, however tshock already exists as a folder and will clash -->
@ -30,22 +30,22 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" /> <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="MySql.Data" Version="8.4.0" /> <PackageReference Include="MySql.Data" Version="9.1.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.11" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageReference Include="ModFramework" Version="1.1.7" GeneratePathProperty="true" /> <!-- only used to extract out to ./bin. --> <PackageReference Include="ModFramework" Version="1.1.13" GeneratePathProperty="true" /> <!-- only used to extract out to ./bin. -->
<PackageReference Include="GetText.NET" Version="1.7.14" /> <!-- only used to extract out to ./bin. --> <PackageReference Include="GetText.NET" Version="8.0.5" /> <!-- only used to extract out to ./bin. -->
<!-- the launcher doesnt need the direct OTAPI reference, but since PackageReference[ExcludeFromSingleFile] doesnt work, exclude the assets and copy manually --> <!-- the launcher doesnt need the direct OTAPI reference, but since PackageReference[ExcludeFromSingleFile] doesnt work, exclude the assets and copy manually -->
<PackageReference Include="OTAPI.Upcoming" Version="3.1.20" ExcludeAssets="all" GeneratePathProperty="true" /> <PackageReference Include="OTAPI.Upcoming" Version="3.2.4" ExcludeAssets="all" GeneratePathProperty="true" />
<None Include="$(PkgOTAPI_Upcoming)\lib\net6.0\OTAPI.dll"> <None Include="$(PkgOTAPI_Upcoming)\lib\net9.0\OTAPI.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None> </None>
<None Include="$(PkgOTAPI_Upcoming)\lib\net6.0\OTAPI.Runtime.dll"> <None Include="$(PkgOTAPI_Upcoming)\lib\net9.0\OTAPI.Runtime.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None> </None>
<None Include="$(PkgModFramework)\lib\net6.0\ModFramework.dll"> <None Include="$(PkgModFramework)\lib\net9.0\ModFramework.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None> </None>
@ -91,7 +91,13 @@
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(MOFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" /> <Copy SourceFiles="@(MOFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" />
</Target> </Target>
<Target Name="MoveBin" AfterTargets="Publish"> <Target Name="MoveDevBin" AfterTargets="PostBuildEvent">
<ItemGroup>
<MoveBinaries Include="$(OutDir)*" Exclude="$(OutDir)\TShock.Server*;$(OutDir)\GeoIP.dat" />
</ItemGroup>
<Move SourceFiles="@(MoveBinaries)" DestinationFolder="$(OutDir)bin" ContinueOnError="true" />
</Target>
<Target Name="MovePublishBin" AfterTargets="Publish">
<ItemGroup> <ItemGroup>
<MoveBinaries Include="$(PublishDir)*" Exclude="$(PublishDir)\TShock.Server*;$(PublishDir)\GeoIP.dat" /> <MoveBinaries Include="$(PublishDir)*" Exclude="$(PublishDir)\TShock.Server*;$(PublishDir)\GeoIP.dat" />
</ItemGroup> </ItemGroup>

View file

@ -52,7 +52,7 @@ namespace TShockPluginManager
public Nugetter() public Nugetter()
{ {
FrameworkReducer = new FrameworkReducer(); FrameworkReducer = new FrameworkReducer();
NuGetFramework = NuGetFramework.ParseFolder("net6.0"); NuGetFramework = NuGetFramework.ParseFolder("net9.0");
Settings = NuGet.Configuration.Settings.LoadDefaultSettings(root: null); Settings = NuGet.Configuration.Settings.LoadDefaultSettings(root: null);
PathContext = NuGetPathContext.Create(Settings); PathContext = NuGetPathContext.Create(Settings);
PackageSourceProvider = new PackageSourceProvider(Settings); PackageSourceProvider = new PackageSourceProvider(Settings);

View file

@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NuGet.Packaging" Version="6.3.4" /> <PackageReference Include="NuGet.Packaging" Version="6.12.1" />
<PackageReference Include="NuGet.Protocol" Version="6.3.3" /> <PackageReference Include="NuGet.Protocol" Version="6.12.1" />
<PackageReference Include="NuGet.Resolver" Version="6.3.1" /> <PackageReference Include="NuGet.Resolver" Version="6.12.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" /> <PackageReference Include="System.Reflection.MetadataLoadContext" Version="9.0.0" />
<PackageReference Include="GetText.NET" Version="1.7.14" /> <PackageReference Include="GetText.NET" Version="8.0.5" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1 +1 @@
Subproject commit d4bb7e3a21e875cfeb23bcf5cf847c85d9470ccf Subproject commit 29dc46f4e1c7b41f9e88e41187dd8d5b208e257a

View file

@ -9,5 +9,5 @@ build_script:
dotnet test dotnet test
artifacts: artifacts:
- path: ./TShockLauncher/bin/Debug/net6.0 - path: ./TShockLauncher/bin/Debug/net9.0
name: TShockAVDebug name: TShockAVDebug