Example #1
0
        public OGameClient(string server, OGameStringProvider stringProvider, string username, string password)
        {
            _server   = server;
            _username = username;
            _password = password;

            _savers = new List <SaverBase>();

            RequestBuilder = new OGameRequestBuilder(this);

            StringProvider = stringProvider;
            BaseUri        = new Uri($"https://{server}/");

            Settings = new OGameSettings();

            RegisterParser(new PageInfoParser());
            RegisterParser(new DefencesPageParser());
            RegisterParser(new FacilitiesPageParser());
            RegisterParser(new FleetMovementPageParser());
            RegisterParser(new GalaxyPageParser());
            RegisterParser(new PlanetListParser());
            RegisterParser(new PlanetResourcesParser());
            RegisterParser(new ResearchPageParser());
            RegisterParser(new ResourcesPageParser());
            RegisterParser(new ShipyardPageParser());
            RegisterParser(new MessagesPageParser());
            RegisterParser(new EspionageDetailsParser());
            RegisterParser(new MessageCountParser());

            RegisterIntervention(new OGameAutoLoginner(this));
        }
Example #2
0
        public OGameClient(string server, OGameStringProvider stringProvider, string username, string password, CommandBase.Commander commander)
        {
            _server   = server;
            _username = username;
            _password = password;

            _savers     = new List <SaverBase>();
            _injects    = new List <IInject>();
            _validators = new List <IRequestValidator>();

            RequestBuilder = new OGameRequestBuilder(this);

            StringProvider = stringProvider;
            BaseUri        = new Uri($"https://{server}/");

            Settings = new OGameSettings();

            RegisterParser(new PageInfoParser());
            RegisterParser(new DefencesPageParser());
            RegisterParser(new FacilitiesPageParser());
            RegisterParser(new FleetMovementPageParser());
            RegisterParser(new GalaxyPageParser());
            RegisterParser(new PlanetListParser());
            RegisterParser(new PlanetResourcesParser());
            RegisterParser(new ResearchPageParser());
            RegisterParser(new ResourcesPageParser());
            RegisterParser(new ShipyardPageParser());
            RegisterParser(new FleetPageParser());
            RegisterParser(new MessagesPageParser());
            RegisterParser(new EspionageDetailsParser());
            RegisterParser(new MessageCountParser());
            RegisterParser(new OngoingActivityParser());
            RegisterParser(new EventListParser());
            RegisterParser(new MinifleetParser());
            RegisterParser(new AuctioneerParser());
            RegisterParser(new AuctionBidParser());
            RegisterParser(new FleetCheckParser());
            RegisterParser(new JumpGateShipParser());

            RegisterIntervention(new OGameAutoLoginner(this));
            RegisterValidator(new PlanetExclusiveValidator(this));

            if (Instance != null)
            {
                throw new ApplicationException($"Only one {nameof(OGameClient)} instance can exist.");
            }

            Instance  = this;
            Commander = commander;
        }