protected override void RunInternal()
        {
            Uri universeUri   = new Uri(_client.BaseUri, "/api/universe.xml");
            Uri alliancesUri  = new Uri(_client.BaseUri, "/api/alliances.xml");
            Uri playersUri    = new Uri(_client.BaseUri, "/api/players.xml");
            Uri serverDataUri = new Uri(_client.BaseUri, "/api/serverData.xml");

            FileInfo universeFile   = new FileInfo(Path.Combine(_baseDir.FullName, _client.BaseUri.Host + "-universe.xml"));
            FileInfo alliancesFile  = new FileInfo(Path.Combine(_baseDir.FullName, _client.BaseUri.Host + "-alliances.xml"));
            FileInfo playersFile    = new FileInfo(Path.Combine(_baseDir.FullName, _client.BaseUri.Host + "-players.xml"));
            FileInfo serverDataFile = new FileInfo(Path.Combine(_baseDir.FullName, _client.BaseUri.Host + "-serverData.xml"));

            if (NeedUpdate(universeUri, universeFile, "universe").Sync())
            {
                Logger.Instance.Log(LogLevel.Info, "ApiImporterJob: Updating universe from API");

                Update(universeUri, universeFile).Sync();

                Universe model = XmlModelSerializer.Deserialize <Universe>(universeFile);
                ProcessData(model);
            }

            if (NeedUpdate(alliancesUri, alliancesFile, "alliances").Sync())
            {
                Logger.Instance.Log(LogLevel.Info, "ApiImporterJob: Updating alliances from API");

                Update(alliancesUri, alliancesFile).Sync();

                AlliancesContainer model = XmlModelSerializer.Deserialize <AlliancesContainer>(alliancesFile);
                ProcessData(model);
            }

            if (NeedUpdate(playersUri, playersFile, "players").Sync())
            {
                Logger.Instance.Log(LogLevel.Info, "ApiImporterJob: Updating players from API");

                Update(playersUri, playersFile).Sync();

                PlayersContainer model = XmlModelSerializer.Deserialize <PlayersContainer>(playersFile);
                ProcessData(model);
            }

            if (NeedUpdate(serverDataUri, serverDataFile, "serverData").Sync())
            {
                Logger.Instance.Log(LogLevel.Info, "ApiImporterJob: Updating serverData from API");

                Update(serverDataUri, serverDataFile).Sync();

                ServerData model = XmlModelSerializer.Deserialize <ServerData>(serverDataFile);
                ProcessData(model);
            }
        }
Esempio n. 2
0
 private void ProcessData(AlliancesContainer model)
 {
 }