mirror of
https://github.com/islehorse/HISP.git
synced 2025-07-17 04:21:32 +12:00
add !VERSION
This commit is contained in:
parent
1204d586bd
commit
7122d978a6
8 changed files with 99 additions and 26 deletions
|
@ -177,6 +177,9 @@ namespace HISP.Game.Chat
|
|||
|
||||
else if (message.ToUpper().StartsWith("!DANCE"))
|
||||
return Command.Dance(message, args, user);
|
||||
|
||||
else if (message.ToUpper().StartsWith("!VERSION"))
|
||||
return Command.Version(message, args, user);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,17 @@ namespace HISP.Game.Chat
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool Version(string message, string[] args, User user)
|
||||
{
|
||||
// Get current version and send to client
|
||||
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(versionPacket);
|
||||
|
||||
// Send Command complete message to client.
|
||||
byte[] versionCommandCompletePacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(versionCommandCompletePacket);
|
||||
return true;
|
||||
}
|
||||
public static bool Ban(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 0)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>HISP</RootNamespace>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<Platforms>x64;x86;ARM;ARM64;AnyCPU</Platforms>
|
||||
<Platforms>x64;x86;ARM;ARM64</Platforms>
|
||||
<Configurations>Windows;Debug;Linux;MacOS</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
@ -39,6 +39,8 @@
|
|||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
<StartupObject>HISP.Program</StartupObject>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'">
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
|
@ -46,6 +48,7 @@
|
|||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x64'">
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
|
@ -53,34 +56,37 @@
|
|||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|x64'">
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_LINUX;ARCH_X86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|x64'">
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_MACOS;ARCH_x86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|ARM'">
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|ARM64'">
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|Any CPU'">
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm;win-arm64;linux-x64;linux-arm;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="git rev-parse --verify HEAD>"$(ProjectDir)Resources\GitCommit"" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -104,5 +104,15 @@ namespace HISP.Properties {
|
|||
return ResourceManager.GetString("DefaultServerProperties", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UNKNOWN COMMIT HASH
|
||||
/// </summary>
|
||||
internal static string GitCommit {
|
||||
get {
|
||||
return ResourceManager.GetString("GitCommit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,4 +124,7 @@
|
|||
<data name="DefaultServerProperties" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\server.properties;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="GitCommit" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GitCommit;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
1
HorseIsleServer/HorseIsleServer/Resources/GitCommit
Normal file
1
HorseIsleServer/HorseIsleServer/Resources/GitCommit
Normal file
|
@ -0,0 +1 @@
|
|||
1204d586bd47400b2a091e9906481f46da33a22a
|
56
HorseIsleServer/HorseIsleServer/Server/ServerVersion.cs
Normal file
56
HorseIsleServer/HorseIsleServer/Server/ServerVersion.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using HISP.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
public class ServerVersion
|
||||
{
|
||||
public static int MAJOR = 1;
|
||||
public static int MINOR = 3;
|
||||
public static string PRODUCT = "HISP";
|
||||
|
||||
public static string GetArchitecture()
|
||||
{
|
||||
#if ARCH_X86_64
|
||||
return "x86_64";
|
||||
#elif ARCH_X86
|
||||
return "x86";
|
||||
#elif ARCH_ARM
|
||||
return "ARM";
|
||||
#elif ARCH_ARM64
|
||||
return "ARM64"
|
||||
#else
|
||||
return "UNK_ARCH";
|
||||
#endif
|
||||
}
|
||||
public static string GetPlatform()
|
||||
{
|
||||
#if OS_WINDOWS
|
||||
return "WINDOWS";
|
||||
#elif OS_LINUX
|
||||
return "LINUX";
|
||||
#elif OS_MACOS
|
||||
return "MACOS";
|
||||
#else
|
||||
return "UNK_PLATFORM";
|
||||
#endif
|
||||
|
||||
}
|
||||
public static string GetVersionString()
|
||||
{
|
||||
return "v" + MAJOR.ToString() + "." + MINOR.ToString();
|
||||
}
|
||||
public static string GetCommitHash(int TotalBytes)
|
||||
{
|
||||
return Resources.GitCommit.Substring(0, TotalBytes * 2);
|
||||
}
|
||||
public static string GetBuildString()
|
||||
{
|
||||
return PRODUCT + " " + GetVersionString() + " " + GetCommitHash(4) + "; (" + GetArchitecture() + "; " + GetPlatform() + ")";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue