Skip to content

Commit

Permalink
dotnet: Make compiled commands/plugins backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Jul 5, 2024
1 parent dd8ff42 commit effa0c2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CLI/MCGalaxyCLI_dotnet6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<AssemblyName>MCGalaxyCLI</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions CLI/MCGalaxyCLI_dotnet7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<AssemblyName>MCGalaxyCLI</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions CLI/MCGalaxyCLI_dotnet8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<AssemblyName>MCGalaxyCLI</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/MCGalaxy_dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);MCG_DOTNET</DefineConstants>
<AssemblyName>MCGalaxy_</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.1.0" />
Expand Down
17 changes: 12 additions & 5 deletions MCGalaxy/Server/Maintenance/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
using System.Net;
using MCGalaxy.Network;
using MCGalaxy.Platform;
Expand Down Expand Up @@ -97,16 +98,16 @@ public static class Updater
Logger.Log(LogType.SystemActivity, "Downloading {0} update files", mode);
WebClient client = HttpUtil.CreateWebClient();

client.DownloadFile(DLL_URL.Replace("{0}", mode), "MCGalaxy_.update");
DownloadFile(client, DLL_URL.Replace("{0}", mode), "MCGalaxy_.update");
#if MCG_STANDALONE
// Self contained executable, no separate CLI or GUI to download
#elif MCG_DOTNET
client.DownloadFile(CLI_URL.Replace("{0}", mode), "MCGalaxyCLI.update");
DownloadFile(client, CLI_URL.Replace("{0}", mode), "MCGalaxyCLI.update");
#else
client.DownloadFile(GUI_URL.Replace("{0}", mode), "MCGalaxy.update");
client.DownloadFile(CLI_URL.Replace("{0}", mode), "MCGalaxyCLI.update");
DownloadFile(client, GUI_URL.Replace("{0}", mode), "MCGalaxy.update");
DownloadFile(client, CLI_URL.Replace("{0}", mode), "MCGalaxyCLI.update");
#endif
client.DownloadFile(CHANGELOG_URL, "Changelog.txt");
DownloadFile(client, CHANGELOG_URL, "Changelog.txt");

Server.SaveAllLevels();
Player[] players = PlayerInfo.Online.Items;
Expand Down Expand Up @@ -137,6 +138,12 @@ public static class Updater
}
}

static void DownloadFile(WebClient client, string url, string dst) {
Logger.Log(LogType.SystemActivity, "Downloading {0} to {1}",
url, Path.GetFileName(dst));
client.DownloadFile(url, dst);
}

static void DeleteFiles(params string[] paths) {
foreach (string path in paths) { AtomicIO.TryDelete(path); }
}
Expand Down

0 comments on commit effa0c2

Please sign in to comment.