public SimulatedBattleNetClient(IBattleNetSettings settings)
     : base(settings)
 {
     tmrGo           = new Timer();
     tmrGo.Elapsed  += new ElapsedEventHandler(tmrGo_Elapsed);
     tmrGo.AutoReset = true;
     tmrGo.Interval  = 75.0;
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="settings"></param>
        public BattleNetClient(IBattleNetSettings settings)
        {
            _connection = new AsyncConnectionBase(settings.Gateway.ServerHost, settings.Gateway.ServerPort);
            _storage    = _connection.NetworkBuffers;
            _settings   = settings;

            InitializeParseDictionaries();

            this._channel = new BattleNetClientChannel(this);
        }
Esempio n. 3
0
        private ProfileDocument(BattleNetClient client)
            : this()
        {
            m_client  = client;
            this.Text = this.TabText = (client.Settings as ClientProfile).ProfileName;

            if (client.Settings.Client == Product.StarcraftRetail.ProductCode || client.Settings.Client == Product.StarcraftBroodWar.ProductCode ||
                client.Settings.Client == Product.Warcraft3Retail.ProductCode || client.Settings.Client == Product.Warcraft3Expansion.ProductCode)
            {
                //WardenPacketHandler module = new WardenPacketHandler(client);
                //m_client.WardenHandler = module;
            }

            client.EventExceptionThrown += new EventExceptionEventHandler(client_EventExceptionThrown);

            m_chat      = new ChatDocument(client);
            m_chat.Text = "Main chat window (Disconnected)";
            m_chat.Show(this.dock);

            m_channel = new ChannelList(client);
            m_channel.Show(this.dock);

            IBattleNetSettings settings   = client.Settings;
            string             clientCode = settings.Client;

            if (clientCode.Equals(Product.Warcraft3Retail.ProductCode, StringComparison.Ordinal) ||
                clientCode.Equals(Product.Warcraft3Expansion.ProductCode, StringComparison.Ordinal))
            {
                m_friends = new FriendsList(client);
                m_friends.Show(this.dock);

                m_clan = new ClanList(client);
                m_clan.Show(this.dock);

                m_news = new NewsList(client);
                m_news.Show(this.dock);
                m_news.DockState = DockState.DockLeftAutoHide;
            }
            else if (clientCode.Equals(Product.StarcraftRetail.ProductCode, StringComparison.Ordinal) ||
                     clientCode.Equals(Product.StarcraftBroodWar.ProductCode, StringComparison.Ordinal))
            {
                m_friends = new FriendsList(client);
                m_friends.Show(this.dock);
            }

            m_channel.Show();

            m_ssUri = m_chat.StylesheetUri;

            m_documents.Add(m_chat);

            client.RegisterWarcraftProfileReceivedNotification(Priority.Low, WarcraftProfileReceived);

            m_channel.VoidView = this.VoidView;
        }
Esempio n. 4
0
        public BattleNetClient(IBattleNetSettings settings)
            : base(settings.Gateway.ServerHost, settings.Gateway.ServerPort)
        {
            ValidateSettings(settings);

            m_settings         = settings;
            m_priorityProvider = new CombinedPacketPriorityProvider();

            InitializeListenState();

            InitializeParseDictionaries();

            m_queue = new DefaultCommandQueue();
            m_messageReadyCallback = SendCallbackImpl;
            m_queue.MessageReady  += m_messageReadyCallback;
        }
Esempio n. 5
0
        public BattleNetClient(IBattleNetSettings settings)
            : base(settings.Gateway.ServerHost, settings.Gateway.ServerPort)
        {
            ValidateSettings(settings);

            m_settings = settings;
            m_priorityProvider = new CombinedPacketPriorityProvider();

            InitializeListenState();

            InitializeParseDictionaries();

            m_queue = new DefaultCommandQueue();
            m_messageReadyCallback = SendCallbackImpl;
            m_queue.MessageReady += m_messageReadyCallback;
        }
Esempio n. 6
0
        private static void ValidateSettings(IBattleNetSettings settings)
        {
            BattleNetSettingsErrors errors = BattleNetSettingsErrors.None;

            if (!File.Exists(settings.GameExe))
            {
                errors |= BattleNetSettingsErrors.GameExeMissingOrNotFound;
            }
            if (!File.Exists(settings.GameFile2))
            {
                errors |= BattleNetSettingsErrors.GameFile2MissingOrNotFound;
            }
            if (!File.Exists(settings.GameFile3))
            {
                errors |= BattleNetSettingsErrors.GameFile3MissingOrNotFound;
            }
            if (string.IsNullOrEmpty(settings.Username))
            {
                errors |= BattleNetSettingsErrors.UserNameNull;
            }
            if (!Enum.IsDefined(typeof(PingType), settings.PingMethod))
            {
                errors |= BattleNetSettingsErrors.InvalidPingType;
            }
            if (string.IsNullOrEmpty(settings.Gateway.ServerHost))
            {
                errors |= BattleNetSettingsErrors.InvalidGatewayServer;
            }

            if (settings.CdKeyOwner == null)
            {
                settings.CdKeyOwner = string.Empty;
            }
            if (settings.Password == null)
            {
                settings.Password = string.Empty;
            }

            Product productToUse = Product.GetByProductCode(settings.Client);

            if (productToUse == null)
            {
                errors |= BattleNetSettingsErrors.InvalidEmulationClient;
            }
            else
            {
                if (!productToUse.CanConnect)
                {
                    errors |= BattleNetSettingsErrors.InvalidEmulationClient;
                }
                if (string.IsNullOrEmpty(settings.CdKey1))
                {
                    errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                }
                else
                {
                    try
                    {
                        CdKey test = new CdKey(settings.CdKey1);
                        if (!test.IsValid)
                        {
                            errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                        }
                    }
                    catch
                    {
                        errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                    }
                }
                if (productToUse.NeedsTwoKeys && string.IsNullOrEmpty(settings.CdKey2))
                {
                    errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                }
                else
                {
                    if (productToUse.NeedsTwoKeys)
                    {
                        try
                        {
                            CdKey test2 = new CdKey(settings.CdKey2);
                            if (!test2.IsValid)
                            {
                                errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                            }
                        }
                        catch
                        {
                            errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                        }
                    }
                }
                if (productToUse.NeedsLockdown)
                {
                    if (string.IsNullOrEmpty(settings.ImageFile) || !File.Exists(settings.ImageFile))
                    {
                        errors |= BattleNetSettingsErrors.LockdownFileMissingOrNotFound;
                    }
                }
            }

            if (errors != BattleNetSettingsErrors.None)
            {
                throw new BattleNetSettingsErrorsException(errors);
            }
        }
Esempio n. 7
0
        private static void ValidateSettings(IBattleNetSettings settings)
        {
            BattleNetSettingsErrors errors = BattleNetSettingsErrors.None;

            if (!File.Exists(settings.GameExe))
                errors |= BattleNetSettingsErrors.GameExeMissingOrNotFound;
            if (!File.Exists(settings.GameFile2))
                errors |= BattleNetSettingsErrors.GameFile2MissingOrNotFound;
            if (!File.Exists(settings.GameFile3))
                errors |= BattleNetSettingsErrors.GameFile3MissingOrNotFound;
            if (string.IsNullOrEmpty(settings.Username))
                errors |= BattleNetSettingsErrors.UserNameNull;
            if (!Enum.IsDefined(typeof(PingType), settings.PingMethod))
                errors |= BattleNetSettingsErrors.InvalidPingType;
            if (string.IsNullOrEmpty(settings.Gateway.ServerHost))
                errors |= BattleNetSettingsErrors.InvalidGatewayServer;

            if (settings.CdKeyOwner == null)
                settings.CdKeyOwner = string.Empty;
            if (settings.Password == null)
                settings.Password = string.Empty;

            Product productToUse = Product.GetByProductCode(settings.Client);
            if (productToUse == null)
                errors |= BattleNetSettingsErrors.InvalidEmulationClient;
            else
            {
                if (!productToUse.CanConnect)
                    errors |= BattleNetSettingsErrors.InvalidEmulationClient;
                if (string.IsNullOrEmpty(settings.CdKey1))
                    errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                else
                {
                    try
                    {
                        CdKey test = new CdKey(settings.CdKey1);
                        if (!test.IsValid)
                            errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                    }
                    catch
                    {
                        errors |= BattleNetSettingsErrors.PrimaryCdKeyMissingOrInvalid;
                    }
                }
                if (productToUse.NeedsTwoKeys && string.IsNullOrEmpty(settings.CdKey2))
                    errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                else
                {
                    if (productToUse.NeedsTwoKeys)
                    {
                        try
                        {
                            CdKey test2 = new CdKey(settings.CdKey2);
                            if (!test2.IsValid)
                                errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                        }
                        catch
                        {
                            errors |= BattleNetSettingsErrors.SecondaryCdKeyMissingOrInvalid;
                        }
                    }
                }
                if (productToUse.NeedsLockdown)
                {
                    if (string.IsNullOrEmpty(settings.ImageFile) || !File.Exists(settings.ImageFile))
                        errors |= BattleNetSettingsErrors.LockdownFileMissingOrNotFound;
                }
            }

            if (errors != BattleNetSettingsErrors.None)
                throw new BattleNetSettingsErrorsException(errors);
        }