private void SetSomeProperties(ServerInformation information) {
PreviousUpdateTime = DateTime.Now;
Name = Regex.Replace(information.Name.Trim(), @"\s+", " ");
{
var country = information.Country.FirstOrDefault() ?? "";
Country = Country != null && country == @"na" ? Country : country;
}
{
var countryId = information.Country.ElementAtOrDefault(1) ?? "";
CountryId = CountryId != null && countryId == @"na" ? CountryId : countryId;
}
CurrentDriversCount = information.Clients;
Capacity = information.Capacity;
PasswordRequired = information.Password;
if (PasswordRequired) {
Password = ValuesStorage.GetEncryptedString(PasswordStorageKey);
}
CarIds = information.CarIds;
CarsOrTheirIds = CarIds.Select(x => new CarOrOnlyCarIdEntry(x, GetCarWrapper(x))).ToList();
TrackId = information.TrackId;
Track = GetTrack(TrackId);
var errorMessage = "";
var error = SetMissingCarErrorIfNeeded(ref errorMessage);
error = SetMissingTrackErrorIfNeeded(ref errorMessage) || error;
if (error) {
Status = ServerStatus.Error;
ErrorMessage = errorMessage;
}
var seconds = (int)Game.ConditionProperties.GetSeconds(information.Time);
Time = $"{seconds / 60 / 60:D2}:{seconds / 60 % 60:D2}";
SessionEnd = DateTime.Now + TimeSpan.FromSeconds(information.TimeLeft - Math.Round(information.Timestamp / 1000d));
Sessions = information.SessionTypes.Select((x, i) => new Session {
IsActive = x == information.Session,
Duration = information.Durations[i],
Type = (Game.SessionType)x
}).ToList();
BookingMode = !information.PickUp;
}