コード例 #1
0
        public void SaveToFile(IniFile ini)
        {
            if (ini == null)
            {
                throw new ArgumentNullException("ini");
            }

            ini.WriteInteger("Common", "OptsVersion", OPTS_VERSION);

            ini.WriteInteger("Common", "DefNameFormat", (int)fDefNameFormat);
            ini.WriteInteger("Common", "DefDateFormat", (int)fDefDateFormat);
            ini.WriteString("Common", "LastDir", fLastDir);
            ini.WriteBool("Common", "PlacesWithAddress", fPlacesWithAddress);
            ini.WriteBool("Common", "ShowTips", fShowTips);
            ini.WriteInteger("Common", "InterfaceLang", fInterfaceLang);
            ini.WriteInteger("Common", "FileBackup", (int)fFileBackup);
            ini.WriteBool("Common", "ShowDatesCalendar", fShowDatesCalendar);
            ini.WriteBool("Common", "ShowDatesSigns", fShowDatesSign);
            ini.WriteBool("Common", "RemovableMediaWarning", fRemovableMediaWarning);
            ini.WriteBool("Common", "LoadRecentFiles", fLoadRecentFiles);
            ini.WriteBool("Common", "EmbeddedMediaPlayer", fEmbeddedMediaPlayer);
            ini.WriteBool("Common", "AllowMediaStoreReferences", fAllowMediaStoreReferences);

            ini.WriteInteger("Common", "KeyLayout", AppHost.Instance.GetKeyLayout());

            ini.WriteBool("Common", "Autosave", fAutosave);
            ini.WriteInteger("Common", "AutosaveInterval", fAutosaveInterval);

            ini.WriteBool("Common", "ExtendedNames", fExtendedNames);
            ini.WriteInteger("Common", "WomanSurnameFormat", (int)fWomanSurnameFormat);

            ini.WriteString("Common", "Geocoder", fGeocoder);

            fChartOptions.SaveToFile(ini);
            fPedigreeOptions.SaveToFile(ini);
            fProxy.SaveToFile(ini);

            fNameFilters.Sort();

            int cnt = fNameFilters.Count;

            ini.WriteInteger("NameFilters", "Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                ini.WriteString("NameFilters", "Filter_" + i.ToString(), fNameFilters[i]);
            }

            cnt = fResidenceFilters.Count;
            ini.WriteInteger("ResidenceFilters", "Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                ini.WriteString("ResidenceFilters", "Filter_" + i.ToString(), fResidenceFilters[i]);
            }

            cnt = fEventFilters.Count;
            ini.WriteInteger("EventFilters", "Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                ini.WriteString("EventFilters", "EventVal_" + i.ToString(), fEventFilters[i]);
            }

            cnt = fMRUFiles.Count;
            ini.WriteInteger("Common", "MRUFiles_Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                fMRUFiles[i].SaveToFile(ini, "MRUFile_" + i.ToString());
            }

            cnt = fRelations.Count;
            ini.WriteInteger("Relations", "Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                ini.WriteString("Relations", "Relation_" + i.ToString(), fRelations[i]);
            }

            fIndividualListColumns.SaveToFile(ini, "PersonsColumns");

            ini.WriteBool("ListPersons", "HighlightUnmarried", fListHighlightUnmarriedPersons);
            ini.WriteBool("ListPersons", "HighlightUnparented", fListHighlightUnparentedPersons);

            //------------------------------------------------------------------
            // 2016-09-30 Ruslan Garipov <*****@*****.**>
            // FIXME: If `Control::Left`, `Control::Top`, `Control::Width` and
            // `Control::Height` return physical values (device depended), code
            // here must convert members of `fMWinRect` to logical values
            // (device independed) before storing it as the application
            // settings. Had GK been a native Windows application, it had to do
            // that. But since it's a .NET application I don't know is it a
            // true. See also implementation of `GKCore::GKUtils::GetFormRect`
            // member.
            //------------------------------------------------------------------
            ini.WriteInteger("Common", "MWinL", fMWinRect.Left);
            ini.WriteInteger("Common", "MWinT", fMWinRect.Top);
            ini.WriteInteger("Common", "MWinW", fMWinRect.Right);
            ini.WriteInteger("Common", "MWinH", fMWinRect.Bottom);
            ini.WriteInteger("Common", "MWinState", (int)fMWinState);

            cnt = fLastBases.Count;
            ini.WriteInteger("LastBases", "Count", cnt);
            for (int i = 0; i < cnt; i++)
            {
                ini.WriteString("LastBases", "LB" + i.ToString(), GetLastBase(i));
            }

            fAncestorsCircleOptions.SaveToFile(ini);
        }