mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 07:58:40 +00:00
Simplify patchwork game version test
This commit is contained in:
parent
c29eb380be
commit
b838d805e2
1 changed files with 12 additions and 16 deletions
|
@ -1,5 +1,4 @@
|
||||||
using LBPUnion.ProjectLighthouse.Configuration;
|
using LBPUnion.ProjectLighthouse.Configuration;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers;
|
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers;
|
||||||
|
|
||||||
|
@ -11,27 +10,24 @@ public static class PatchworkHelper
|
||||||
{
|
{
|
||||||
string userAgentPrefix = "PatchworkLBP";
|
string userAgentPrefix = "PatchworkLBP";
|
||||||
char gameVersion = userAgent[userAgentPrefix.Length];
|
char gameVersion = userAgent[userAgentPrefix.Length];
|
||||||
int numericVersion = 0;
|
|
||||||
|
|
||||||
if (userAgent.StartsWith(userAgentPrefix))
|
if (!userAgent.StartsWith(userAgentPrefix))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (char.IsLetterOrDigit(gameVersion))
|
switch (gameVersion) {
|
||||||
{
|
case '1':
|
||||||
if (gameVersion == 'V')
|
case '2':
|
||||||
numericVersion = 4;
|
case '3':
|
||||||
|
case 'V':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
numericVersion = gameVersion - '0';
|
|
||||||
|
|
||||||
// Don't want it to be 0 still because of Unknown (-1) in GameVersion
|
|
||||||
if (numericVersion - 1 == 0 || !Enum.IsDefined(typeof(GameVersion), numericVersion))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
string[] patchworkVer = userAgent.Split(' ')[1].Split('.');
|
string[] patchworkVer = userAgent.Split(' ')[1].Split('.');
|
||||||
if (int.Parse(patchworkVer[0]) >= patchworkMajorVer && int.Parse(patchworkVer[1]) >= patchworkMinorVer)
|
if (int.Parse(patchworkVer[0]) !>= patchworkMajorVer || int.Parse(patchworkVer[1]) !>= patchworkMinorVer)
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue