Detection of client version for restriction
This commit is contained in:
parent
fe4c9e4f73
commit
d32e879c49
2 changed files with 24 additions and 1 deletions
|
|
@ -1,15 +1,34 @@
|
||||||
using System;
|
using System;
|
||||||
using Server;
|
using Server;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Server.Misc
|
namespace Server.Misc
|
||||||
{
|
{
|
||||||
public class ClientVerification
|
public class ClientVerification
|
||||||
{
|
{
|
||||||
|
private static bool m_DetectClientRequirement = false;
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
ClientVersion.Required = null;
|
//ClientVersion.Required = null;
|
||||||
//ClientVersion.Required = new ClientVersion( "3.0.8q" );
|
//ClientVersion.Required = new ClientVersion( "3.0.8q" );
|
||||||
|
|
||||||
|
if( m_DetectClientRequirement )
|
||||||
|
{
|
||||||
|
string path = Core.FindDataFile( "client.exe" );
|
||||||
|
|
||||||
|
if( File.Exists( path ) )
|
||||||
|
{
|
||||||
|
FileVersionInfo info = FileVersionInfo.GetVersionInfo( path );
|
||||||
|
|
||||||
|
if( info.FileMajorPart != 0 || info.FileMinorPart != 0 || info.FileMinorPart != 0 || info.FilePrivatePart != 0 )
|
||||||
|
{
|
||||||
|
ClientVersion.Required = new ClientVersion( info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart );
|
||||||
|
Console.WriteLine( "Restricting client version to {0}", ClientVersion.Required );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ClientVersion.AllowGod = true;
|
ClientVersion.AllowGod = true;
|
||||||
ClientVersion.AllowUOTD = true;
|
ClientVersion.AllowUOTD = true;
|
||||||
ClientVersion.AllowRegular = true;
|
ClientVersion.AllowRegular = true;
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,10 @@ namespace Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientVersion( int maj, int min, int rev, int pat ) : this( maj, min, rev, pat, ClientType.Regular )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public ClientVersion( int maj, int min, int rev, int pat, ClientType type )
|
public ClientVersion( int maj, int min, int rev, int pat, ClientType type )
|
||||||
{
|
{
|
||||||
m_Major = maj;
|
m_Major = maj;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue