public static void Configure()
 {
     m_DetectClientRequirement = ServerConfiguration.GetOrUpdateSetting("clientVerification.enable", true);
     m_OldClientResponse       =
         ServerConfiguration.GetOrUpdateSetting("clientVerification.oldClientResponse", OldClientResponse.Kick);
     m_AgeLeniency      = ServerConfiguration.GetOrUpdateSetting("clientVerification.ageLeniency", TimeSpan.FromDays(10));
     m_GameTimeLeniency = ServerConfiguration.GetOrUpdateSetting(
         "clientVerification.gameTimeLeniency",
         TimeSpan.FromHours(25)
         );
     KickDelay = ServerConfiguration.GetOrUpdateSetting("clientVerification.kickDelay", TimeSpan.FromSeconds(20.0));
 }
Exemple #2
0
        public static void Initialize()
        {
            m_DetectClientRequirement = ServerConfiguration.GetOrUpdateSetting("clientVerification.enable", true);
            m_OldClientResponse       =
                ServerConfiguration.GetOrUpdateSetting("clientVerification.oldClientResponse", OldClientResponse.Kick);
            m_AgeLeniency      = ServerConfiguration.GetOrUpdateSetting("clientVerification.ageLeniency", TimeSpan.FromDays(10));
            m_GameTimeLeniency = ServerConfiguration.GetOrUpdateSetting(
                "clientVerification.gameTimeLeniency",
                TimeSpan.FromHours(25)
                );
            KickDelay = ServerConfiguration.GetOrUpdateSetting("clientVerification.kickDelay", TimeSpan.FromSeconds(20.0));

            EventSink.ClientVersionReceived += EventSink_ClientVersionReceived;

            if (m_DetectClientRequirement)
            {
                var path = Core.FindDataFile("client.exe", false);

                if (File.Exists(path))
                {
                    var info = FileVersionInfo.GetVersionInfo(path);

                    if (info.FileMajorPart != 0 || info.FileMinorPart != 0 || info.FileBuildPart != 0 ||
                        info.FilePrivatePart != 0)
                    {
                        Required = new ClientVersion(
                            info.FileMajorPart,
                            info.FileMinorPart,
                            info.FileBuildPart,
                            info.FilePrivatePart
                            );
                    }
                }
            }

            if (Required != null)
            {
                Utility.PushColor(ConsoleColor.White);
                Console.WriteLine(
                    "Restricting client version to {0}. Action to be taken: {1}",
                    Required,
                    m_OldClientResponse
                    );
                Utility.PopColor();
            }
        }
Exemple #3
0
 public ClientSettings(bool autoDetectClient = false, string clientPath = null,
     OldClientResponse oldClientResponse = OldClientResponse.LenientKick,
     ClientVersion requiredVersion = null, bool allowRegular = true, bool allowUOTD = true,
     bool allowGod = true, TimeSpan ageLeniency = TimeSpan.FromDays(10.0),
     TimeSpan gameTimeLeniency = TimeSpan.FromHours(25.0), TimeSpan kickDelay = TimeSpan.FromSeconds(30.0))
 {
     this._AutoDetectClient = autoDetectClient;
     this._ClientPath = clientPath;
     this._OldClientResponse = oldClientResponse;
     this._RequiredVersion = requiredVersion;
     this._AllowRegular = allowRegular;
     this._AllowUOTD = allowUOTD;
     this._AllowGod = allowGod;
     this._AgeLeniency = ageLeniency;
     this._GameTimeLeniency = gameTimeLeniency;
     this._KickDelay = kickDelay;
 }
 public ClientSettings(TimeSpan ageLeniency, TimeSpan gameTimeLeniency, TimeSpan kickDelay,
                       bool autoDetectClient = false, string clientPath = null,
                       OldClientResponse oldClientResponse = OldClientResponse.LenientKick,
                       ClientVersion requiredVersion       = null, bool allowRegular = true, bool allowUOTD = true,
                       bool allowGod = true)
 {
     this._AutoDetectClient  = autoDetectClient;
     this._ClientPath        = clientPath;
     this._OldClientResponse = oldClientResponse;
     this._RequiredVersion   = requiredVersion;
     this._AllowRegular      = allowRegular;
     this._AllowUOTD         = allowUOTD;
     this._AllowGod          = allowGod;
     this._AgeLeniency       = ageLeniency;
     this._GameTimeLeniency  = gameTimeLeniency;
     this._KickDelay         = kickDelay;
 }
Exemple #5
0
		public ClientSettings(
			TimeSpan ageLeniency,
			TimeSpan gameTimeLeniency,
			TimeSpan kickDelay,
			bool autoDetectClient = false,
			string clientPath = null,
			OldClientResponse oldClientResponse = OldClientResponse.LenientKick,
			ClientVersion requiredVersion = null,
			bool allowRegular = true,
			bool allowUOTD = true,
			bool allowGod = true)
		{
			AutoDetectClient = autoDetectClient;
			ClientPath = clientPath;
			OldClientResponse = oldClientResponse;
			RequiredClientVersion = requiredVersion;
			AllowRegular = allowRegular;
			AllowUOTD = allowUOTD;
			AllowGod = allowGod;
			AgeLeniency = ageLeniency;
			GameTimeLeniency = gameTimeLeniency;
			KickDelay = kickDelay;
		}
        public sealed override void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                this._AutoDetectClient  = reader.ReadBool();
                this._ClientPath        = reader.ReadString();
                this._OldClientResponse = (OldClientResponse)reader.ReadByte();

                this._RequiredVersion = new ClientVersion(reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt());

                this._AllowRegular     = reader.ReadBool();
                this._AllowUOTD        = reader.ReadBool();
                this._AllowGod         = reader.ReadBool();
                this._AgeLeniency      = reader.ReadTimeSpan();
                this._GameTimeLeniency = reader.ReadTimeSpan();
                this._KickDelay        = reader.ReadTimeSpan();
                break;
            }
            }
        }
Exemple #7
0
        public sealed override void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        this._AutoDetectClient = reader.ReadBool();
                        this._ClientPath = reader.ReadString();
                        this._OldClientResponse = (OldClientResponse)reader.ReadByte();

                        this._RequiredVersion = new ClientVersion(reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt());

                        this._AllowRegular = reader.ReadBool();
                        this._AllowUOTD = reader.ReadBool();
                        this._AllowGod = reader.ReadBool();
                        this._AgeLeniency = reader.ReadTimeSpan();
                        this._GameTimeLeniency = reader.ReadTimeSpan();
                        this._KickDelay = reader.ReadTimeSpan();
                        break;
                    }
            }
        }