AcManager.Tools.Data.KunosCareerProgress.TryToLoad C# (CSharp) Method

TryToLoad() private method

private TryToLoad ( ) : bool
return bool
        private bool TryToLoad() {
            _skipSaving = true;

            try {
                IniFile iniFile;
                try {
                    iniFile = new IniFile(_filename);
                } catch (Exception e) {
                    NonfatalError.Notify("Can’t load Kunos career progress", e);
                    return false;
                }

                Completed = iniFile["CAREER"].GetStrings("COMPLETE").Select(x => x.ToLowerInvariant()).ToArray();
                CurrentSeries = iniFile["CAREER"].GetNonEmpty("CURRENTSERIES");
                AiLevel = iniFile["CAREER"].GetDouble("AI_LEVEL", 95d);
                IsNew = iniFile["CAREER"].GetInt("INTRO", 0) != 2;
                Entries = iniFile.Where(x => x.Key.StartsWith(@"SERIES")).ToDictionary(
                        x => x.Key.ToLowerInvariant(),
                        x => new KunosCareerProgressEntry(
                                x.Value.GetInt("EVENT", 0),
                                x.Value.Select(y => new {
                                    Key = y.Key.StartsWith(@"EVENT") ? FlexibleParser.TryParseInt(y.Key.Substring(5)) : null as int?,
                                    y.Value
                                }).Where(y => y.Key.HasValue).ToDictionary(y => y.Key.Value, y => FlexibleParser.ParseInt(y.Value, 0)),
                                x.Value.GetIntNullable("POINTS"),
                                x.Value.Select(y => new {
                                    Key = y.Key.StartsWith(@"AI") ? FlexibleParser.TryParseInt(y.Key.Substring(2)) - 1 : null as int?,
                                    y.Value
                                }).Where(y => y.Key.HasValue).ToDictionary(y => y.Key.Value, y => FlexibleParser.ParseInt(y.Value, 0)),
                                x.Value.GetLong("LASTSELECTED", 0)));

                return true;
            } finally {
                _skipSaving = false;
            }
        }