diff --git a/.github/workflows/ci-launcher.yml b/.github/workflows/ci-launcher.yml index 17d187aad..6745df9c1 100644 --- a/.github/workflows/ci-launcher.yml +++ b/.github/workflows/ci-launcher.yml @@ -56,13 +56,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the 3.1 channel + dotnet-version: '9.0.x' # SDK Version to use; x will use the latest version of the 3.1 channel # - name: MonoMod dev build # run: dotnet nuget add source https://pkgs.dev.azure.com/MonoMod/MonoMod/_packaging/DevBuilds%40Local/nuget/v3/index.json -n DevBuilds@Local @@ -70,12 +70,12 @@ jobs: - name: Build run: | cd OTAPI.Client.Launcher - dotnet publish -r ${{ matrix.profile.runtime_identifier }} --framework net6.0 -p:PublishReadyToRun=true --self-contained false -c Release + dotnet publish -r ${{ matrix.profile.runtime_identifier }} --framework net9.0 -p:PublishReadyToRun=true --self-contained false -c Release if ${{ matrix.profile.runs_on != 'macos-latest' }} ; then - 7z a ../${{ matrix.profile.archive_name }} './bin/Release/net6.0/${{ matrix.profile.runtime_identifier }}/publish/*' + 7z a ../${{ matrix.profile.archive_name }} './bin/Release/net9.0/${{ matrix.profile.runtime_identifier }}/publish/*' else mkdir -p OTAPI.app/Contents/Resources - mv bin/Release/net6.0/osx-x64/publish OTAPI.app/Contents/MacOS + mv bin/Release/net9.0/osx-x64/publish OTAPI.app/Contents/MacOS cp ../docs/MacOS.Info.plist OTAPI.app/Contents/Info.plist cp OTAPI.osx.sh OTAPI.app/Contents/MacOS/OTAPI chmod +x OTAPI.app/Contents/MacOS/OTAPI @@ -85,7 +85,7 @@ jobs: # - uses: actions/upload-artifact@v2 # with: # name: ${{ matrix.profile.name }} Launcher - # path: OTAPI.Client.Launcher/bin/Release/net6.0/${{ matrix.profile.runtime_identifier }}/publish + # path: OTAPI.Client.Launcher/bin/Release/net9.0/${{ matrix.profile.runtime_identifier }}/publish - uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/.github/workflows/ci-nuget.yml b/.github/workflows/ci-nuget.yml index a0dc01118..641cc4303 100644 --- a/.github/workflows/ci-nuget.yml +++ b/.github/workflows/ci-nuget.yml @@ -36,38 +36,38 @@ jobs: name: ${{ matrix.profile.name }} Server steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '9.0.x' - name: Build the project run: | dotnet build OTAPI.Mods.slnf - (cd OTAPI.Patcher/bin/Debug/net6.0 && exec dotnet run --project ../../../OTAPI.Patcher.csproj -patchTarget=${{ matrix.profile.patch_target }} -latest=n --framework net6.0) + (cd OTAPI.Patcher/bin/Debug/net9.0 && exec dotnet run --project ../../../OTAPI.Patcher.csproj -patchTarget=${{ matrix.profile.patch_target }} -latest=n --framework net9.0) dotnet build OTAPI.Server.Launcher.slnf - (cd OTAPI.Server.Launcher/bin/Debug/net6.0 && exec dotnet OTAPI.Server.Launcher.dll -test-init) + (cd OTAPI.Server.Launcher/bin/Debug/net9.0 && exec dotnet OTAPI.Server.Launcher.dll -test-init) - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.profile.name }} NuGet Package - path: OTAPI.Patcher/bin/Debug/net6.0/${{ matrix.profile.package_path }} + path: OTAPI.Patcher/bin/Debug/net9.0/${{ matrix.profile.package_path }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.profile.name }} Binaries path: | - OTAPI.Patcher/bin/Debug/net6.0/artifact-*/* + OTAPI.Patcher/bin/Debug/net9.0/artifact-*/* - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.profile.name }} Wiki MD files - path: OTAPI.Patcher/bin/Debug/net6.0/*.mfw.md + path: OTAPI.Patcher/bin/Debug/net9.0/*.mfw.md - name: "Releasing to NuGet: ${{ matrix.profile.name }}" env: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - run: dotnet nuget push OTAPI.Patcher/bin/Debug/net6.0/${{ matrix.profile.package_path }} --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" + run: dotnet nuget push OTAPI.Patcher/bin/Debug/net9.0/${{ matrix.profile.package_path }} --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5912ab5a8..3016681d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,11 +15,23 @@ on: jobs: Server: - runs-on: ubuntu-latest - strategy: fail-fast: false matrix: + os: [ + { + name: Windows, + runs-on: windows-latest, + }, + { + name: Ubuntu, + runs-on: ubuntu-latest, + }, + { + name: macOS, + runs-on: macos-latest, + } + ] profile: [ { name: PC, @@ -31,43 +43,50 @@ jobs: patch_target: m, package_path: OTAPI.Mobile.nupkg, }, - { - name: tModLoader, - patch_target: t, - package_path: OTAPI.TML.nupkg, - }, + # { this is ultimately not supported yet, consideration in future when time permits + # name: tModLoader, + # patch_target: t, + # package_path: OTAPI.TML.nupkg, + # }, ] + + runs-on: ${{ matrix.os.runs-on }} - name: ${{ matrix.profile.name }} Server + name: ${{ matrix.os.name }} ${{ matrix.profile.name }} Server steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '9.0.x' - - name: Build the project + - name: Server patch run: | dotnet build OTAPI.Mods.slnf - (cd OTAPI.Patcher/bin/Debug/net6.0 && exec dotnet run --project ../../../OTAPI.Patcher.csproj -patchTarget=${{ matrix.profile.patch_target }} -latest=n --framework net6.0) + cd OTAPI.Patcher/bin/Debug/net9.0 + dotnet run --project ../../../OTAPI.Patcher.csproj -patchTarget=${{ matrix.profile.patch_target }} -latest=n --framework net9.0 + + - name: Server boot + run: | dotnet build OTAPI.Server.Launcher.slnf - (cd OTAPI.Server.Launcher/bin/Debug/net6.0 && exec dotnet OTAPI.Server.Launcher.dll -test-init) + cd OTAPI.Server.Launcher/bin/Debug/net9.0 + dotnet OTAPI.Server.Launcher.dll -test-init - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.profile.name }} NuGet Package - path: OTAPI.Patcher/bin/Debug/net6.0/${{ matrix.profile.package_path }} + name: ${{ matrix.os.name }} ${{ matrix.profile.name }} NuGet Package + path: OTAPI.Patcher/bin/Debug/net9.0/${{ matrix.profile.package_path }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.profile.name }} Binaries + name: ${{ matrix.os.name }} ${{ matrix.profile.name }} Binaries path: | - OTAPI.Patcher/bin/Debug/net6.0/artifact-*/* + OTAPI.Patcher/bin/Debug/net9.0/artifact-*/* - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.profile.name }} Wiki MD files - path: OTAPI.Patcher/bin/Debug/net6.0/*.mfw.md + name: ${{ matrix.os.name }} ${{ matrix.profile.name }} Wiki MD files + path: OTAPI.Patcher/bin/Debug/net9.0/*.mfw.md diff --git a/.vscode/launch.json b/.vscode/launch.json index 2875a6c4e..37e80afd0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,52 +1,20 @@ { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { - "name": "Setup (Vanilla)", - "type": "coreclr", + "name": "C#: Patcher Debug", + "type": "dotnet", "request": "launch", - "preLaunchTask": "build-setup", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/OTAPI.Setup/bin/Debug/net6.0/OTAPI.Setup.dll", - "args": ["-patchTarget=v", "-latestVanilla=n"], - "cwd": "${workspaceFolder}/OTAPI.Setup/bin/Debug/net6.0/", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false + "projectPath": "${workspaceFolder}/OTAPI.Patcher/OTAPI.Patcher.csproj" }, { - "name": "Patcher (Vanilla)", - "type": "coreclr", + "name": "C#: Server Launcher Debug", + "type": "dotnet", "request": "launch", - "preLaunchTask": "build-mods", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/OTAPI.Patcher/bin/Debug/net6.0/OTAPI.Patcher.dll", - "args": ["-patchTarget=v", "-latestVanilla=n"], - "cwd": "${workspaceFolder}/OTAPI.Patcher/bin/Debug/net6.0/", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": "Launcher (Vanilla)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build-launcher", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/OTAPI.Launcher/bin/Debug/net6.0/OTAPI.Launcher.dll", - "args": ["-patchTarget=v", "-latestVanilla=n"], - "cwd": "${workspaceFolder}/OTAPI.Launcher/bin/Debug/net6.0/", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "externalTerminal", - "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" + "projectPath": "${workspaceFolder}/OTAPI.Server.Launcher/OTAPI.Server.Launcher.csproj" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 88604a428..000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build-setup", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/OTAPI.Setup.sln", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "build-mods", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/OTAPI.Mods.slnf", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "build-launcher", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/OTAPI.Launcher.sln", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/OTAPI.Patcher/OTAPI.Patcher.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "${workspaceFolder}/OTAPI.Patcher/OTAPI.Patcher.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/FNA b/FNA index 99cf22d42..ebadfa609 160000 --- a/FNA +++ b/FNA @@ -1 +1 @@ -Subproject commit 99cf22d427b54643e8f2719a4bee99a780d04c80 +Subproject commit ebadfa609c510206da7f872c24325fae5bd802a5 diff --git a/OTAPI.Client.Launcher/Actions/OTAPI.cs b/OTAPI.Client.Launcher/Actions/OTAPI.cs index 82c7f7ec5..33c6b4b6d 100644 --- a/OTAPI.Client.Launcher/Actions/OTAPI.cs +++ b/OTAPI.Client.Launcher/Actions/OTAPI.cs @@ -30,7 +30,7 @@ namespace OTAPI.Client.Launcher.Actions; static class OTAPI { - static Assembly Terraria; + static Assembly? Terraria; static void CompileAndInstall() //considering to keep or not. this can recompile OTAPI mods on launch...which will be great for developing it. will look into when i get back to it one day { @@ -114,7 +114,6 @@ public static void Launch(string[] args) GC.Collect(); - CSharpLoader.OnCompilationContext += CSharpLoader_OnCompilationContext; AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; @@ -232,7 +231,7 @@ static string ResolveFile(string path) using var stream = root.GetManifestResourceStream(text); if (stream is null) return null; byte[] array = new byte[stream.Length]; - stream.Read(array, 0, array.Length); + stream.ReadExactly(array); stream.Seek(0, SeekOrigin.Begin); // if (!File.Exists(resourceName)) @@ -267,10 +266,10 @@ static IntPtr ResolveNativeDep(string libraryName, Assembly assembly, DllImportS IEnumerable matches = Enumerable.Empty(); foreach (var basePath in new[] { - Environment.CurrentDirectory, - AppContext.BaseDirectory, - Path.Combine(Environment.CurrentDirectory, "client") - }) + Environment.CurrentDirectory, + AppContext.BaseDirectory, + Path.Combine(Environment.CurrentDirectory, "client") + }) { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { diff --git a/OTAPI.Client.Launcher/App.axaml b/OTAPI.Client.Launcher/App.axaml index 82860bb36..d7a96c19c 100644 --- a/OTAPI.Client.Launcher/App.axaml +++ b/OTAPI.Client.Launcher/App.axaml @@ -8,9 +8,12 @@ - + + + + diff --git a/OTAPI.Client.Launcher/MainWindow.axaml b/OTAPI.Client.Launcher/MainWindow.axaml index 7542ad181..39a3a3505 100644 --- a/OTAPI.Client.Launcher/MainWindow.axaml +++ b/OTAPI.Client.Launcher/MainWindow.axaml @@ -23,7 +23,7 @@