protected override void LoadData(IniFile ini) { Name = ini["SERIES"].GetPossiblyEmpty("NAME"); Code = ini["SERIES"].GetPossiblyEmpty("CODE"); Description = AcStringValues.DecodeDescription(ini["SERIES"].GetPossiblyEmpty("DESCRIPTION")); PointsForPlace = ini["SERIES"].GetPossiblyEmpty("POINTS")?.Split(',').Select(x => FlexibleParser.TryParseInt(x)).OfType <int>().ToArray(); ChampionshipPointsGoal = ini["GOALS"].GetIntNullable("POINTS") ?? 0; ChampionshipRankingGoal = ini["GOALS"].GetIntNullable("RANKING") ?? 0; ThirdPlacesGoal = ini["GOALS"].GetIntNullable("TIER1") ?? 0; SecondPlacesGoal = ini["GOALS"].GetIntNullable("TIER2") ?? 0; FirstPlacesGoal = ini["GOALS"].GetIntNullable("TIER3") ?? 0; Type = ChampionshipPointsGoal == 0 && ChampionshipRankingGoal == 0 || PointsForPlace?.Sum() == 0 ? KunosCareerObjectType.SingleEvents : KunosCareerObjectType.Championship; RequiredSeries = ini["SERIES"].GetStrings("REQUIRES").ToArray(); RequiredAnySeries = ini["SERIES"].GetBool("REQUIRESANY", false); ChampionshipPointsPerPlace = ini["SERIES"].GetStrings("POINTS").Select(x => FlexibleParser.TryParseInt(x)).OfType <int>().ToArray(); if (Type == KunosCareerObjectType.Championship) { LoadOpponents(); } }
public override void SaveData(IniFile ini) { ini["SERIES"].Set("NAME", Name); ini["SERIES"].Set("CODE", Code); ini["SERIES"].Set("DESCRIPTION", AcStringValues.EncodeDescription(Description)); ini["SERIES"].Set("POINTS", PointsForPlace.JoinToString(@",")); ini["GOALS"].Set("POINTS", ChampionshipPointsGoal); ini["GOALS"].Set("RANKING", ChampionshipRankingGoal); ini["GOALS"].Set("TIER1", ThirdPlacesGoal); ini["GOALS"].Set("TIER2", SecondPlacesGoal); ini["GOALS"].Set("TIER3", FirstPlacesGoal); ini["SERIES"].Set("REQUIRES", RequiredSeries); ini["SERIES"].Set("REQUIRESANY", RequiredAnySeries); }