Exemplo n.º 1
0
        public void LoadFromFile(IniFile ini)
        {
            if (ini == null)
            {
                throw new ArgumentNullException("ini");
            }

            int optsVersion = ini.ReadInteger("Common", "OptsVersion", 0);

            fDefNameFormat                     = (NameFormat)ini.ReadInteger("Common", "DefNameFormat", 0);
            fDefDateFormat                     = (DateFormat)ini.ReadInteger("Common", "DefDateFormat", 0);
            fLastDir                           = ini.ReadString("Common", "LastDir", "");
            fPlacesWithAddress                 = ini.ReadBool("Common", "PlacesWithAddress", false);
            fShowTips                          = ini.ReadBool("Common", "ShowTips", true);
            fInterfaceLang                     = (ushort)ini.ReadInteger("Common", "InterfaceLang", 0);
            fFileBackup                        = (FileBackup)ini.ReadInteger("Common", "FileBackup", 0);
            fShowDatesCalendar                 = ini.ReadBool("Common", "ShowDatesCalendar", false);
            fShowDatesSign                     = ini.ReadBool("Common", "ShowDatesSigns", false);
            fRemovableMediaWarning             = ini.ReadBool("Common", "RemovableMediaWarning", true);
            fLoadRecentFiles                   = ini.ReadBool("Common", "LoadRecentFiles", true);
            fEmbeddedMediaPlayer               = ini.ReadBool("Common", "EmbeddedMediaPlayer", true);
            fAllowMediaStoreReferences         = ini.ReadBool("Common", "AllowMediaStoreReferences", false);
            fAllowMediaStoreRelativeReferences = ini.ReadBool("Common", "AllowMediaStoreRelativeReferences", true); // only when AllowMediaStoreReferences is true
            fMediaStoreDefault                 = (ushort)ini.ReadInteger("Common", "MediaStoreDefault", 0);         // (int)MediaStoreType.mstReference
            fAllowDeleteMediaFileFromStgArc    = ini.ReadBool("Common", "AllowDeleteMediaFileFromStgArc", true);
            fAllowDeleteMediaFileFromRefs      = ini.ReadBool("Common", "AllowDeleteMediaFileFromRefs", false);
            fDeleteMediaFileWithoutConfirm     = ini.ReadBool("Common", "DeleteMediaFileWithoutConfirm", false);
            fAutoCheckUpdates                  = ini.ReadBool("Common", "AutoCheckUpdates", true);
            fAutoSortChildren                  = ini.ReadBool("Common", "AutoSortChildren", true);
            fAutoSortSpouses                   = ini.ReadBool("Common", "AutoSortSpouses", false);
            fCharsetDetection                  = ini.ReadBool("Common", "CharsetDetection", false);

            fAutosave         = ini.ReadBool("Common", "Autosave", false);
            fAutosaveInterval = ini.ReadInteger("Common", "AutosaveInterval", 10);

            fExtendedNames      = ini.ReadBool("Common", "ExtendedNames", false);
            fWomanSurnameFormat = (WomanSurnameFormat)ini.ReadInteger("Common", "WomanSurnameFormat", 0);

            fGeocoder = ini.ReadString("Common", "Geocoder", "Google");

            int kl = ini.ReadInteger("Common", "KeyLayout", AppHost.Instance.GetKeyLayout());

            AppHost.Instance.SetKeyLayout(kl);

            fTreeChartOptions.LoadFromFile(ini);
            fPedigreeOptions.LoadFromFile(ini);
            fProxy.LoadFromFile(ini);

            int cnt = ini.ReadInteger("NameFilters", "Count", 0);

            for (int i = 0; i < cnt; i++)
            {
                string st = ini.ReadString("NameFilters", "Filter_" + i.ToString(), "");
                if (st != "")
                {
                    fNameFilters.Add(st);
                }
            }

            cnt = ini.ReadInteger("ResidenceFilters", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fResidenceFilters.Add(ini.ReadString("ResidenceFilters", "Filter_" + i.ToString(), ""));
            }

            cnt = ini.ReadInteger("EventFilters", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fEventFilters.Add(ini.ReadString("EventFilters", "EventVal_" + i.ToString(), ""));
            }

            LoadMRUFromFile(ini, fMRUFiles);

            cnt = ini.ReadInteger("Relations", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fRelations.Add(ini.ReadString("Relations", "Relation_" + i.ToString(), ""));
            }

            fIndividualListColumns.LoadFromFile(ini, "PersonsColumns");

            fListHighlightUnmarriedPersons  = ini.ReadBool("ListPersons", "HighlightUnmarried", false);
            fListHighlightUnparentedPersons = ini.ReadBool("ListPersons", "HighlightUnparented", false);

            fMWinRect.Left   = ini.ReadInteger("Common", "MWinL", -1);
            fMWinRect.Top    = ini.ReadInteger("Common", "MWinT", -1);
            fMWinRect.Right  = ini.ReadInteger("Common", "MWinW", -1);
            fMWinRect.Bottom = ini.ReadInteger("Common", "MWinH", -1);
            fMWinState       = (WindowState)((uint)ini.ReadInteger("Common", "MWinState", 0));

            cnt = ini.ReadInteger("LastBases", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                string st = ini.ReadString("LastBases", "LB" + i.ToString(), "");
                AddLastBase(st);
            }

            fCircleChartOptions.LoadFromFile(ini);

            fListOptions.LoadFromFile(ini);

            LoadPluginsFromFile(ini);
        }
Exemplo n.º 2
0
        public void LoadFromFile(IniFile ini)
        {
            if (ini == null)
            {
                throw new ArgumentNullException("ini");
            }

            int optsVersion = ini.ReadInteger("Common", "OptsVersion", 0);

            fDefNameFormat             = (NameFormat)ini.ReadInteger("Common", "DefNameFormat", 0);
            fDefDateFormat             = (DateFormat)ini.ReadInteger("Common", "DefDateFormat", 0);
            fLastDir                   = ini.ReadString("Common", "LastDir", "");
            fPlacesWithAddress         = ini.ReadBool("Common", "PlacesWithAddress", false);
            fShowTips                  = ini.ReadBool("Common", "ShowTips", true);
            fInterfaceLang             = (ushort)ini.ReadInteger("Common", "InterfaceLang", 0);
            fFileBackup                = (FileBackup)ini.ReadInteger("Common", "FileBackup", 0);
            fShowDatesCalendar         = ini.ReadBool("Common", "ShowDatesCalendar", false);
            fShowDatesSign             = ini.ReadBool("Common", "ShowDatesSigns", false);
            fRemovableMediaWarning     = ini.ReadBool("Common", "RemovableMediaWarning", true);
            fLoadRecentFiles           = ini.ReadBool("Common", "LoadRecentFiles", true);
            fEmbeddedMediaPlayer       = ini.ReadBool("Common", "EmbeddedMediaPlayer", true);
            fAllowMediaStoreReferences = ini.ReadBool("Common", "AllowMediaStoreReferences", false);

            fAutosave         = ini.ReadBool("Common", "Autosave", false);
            fAutosaveInterval = ini.ReadInteger("Common", "AutosaveInterval", 10);

            fExtendedNames      = ini.ReadBool("Common", "ExtendedNames", false);
            fWomanSurnameFormat = (WomanSurnameFormat)ini.ReadInteger("Common", "WomanSurnameFormat", 0);

            fGeocoder = ini.ReadString("Common", "Geocoder", "Google");

            int kl = ini.ReadInteger("Common", "KeyLayout", AppHost.Instance.GetKeyLayout());

            AppHost.Instance.SetKeyLayout(kl);

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

            int cnt = ini.ReadInteger("NameFilters", "Count", 0);

            for (int i = 0; i < cnt; i++)
            {
                string st = ini.ReadString("NameFilters", "Filter_" + i.ToString(), "");
                if (st != "")
                {
                    fNameFilters.Add(st);
                }
            }

            cnt = ini.ReadInteger("ResidenceFilters", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fResidenceFilters.Add(ini.ReadString("ResidenceFilters", "Filter_" + i.ToString(), ""));
            }

            cnt = ini.ReadInteger("EventFilters", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fEventFilters.Add(ini.ReadString("EventFilters", "EventVal_" + i.ToString(), ""));
            }

            cnt = ini.ReadInteger("Common", "MRUFiles_Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                string sect = "MRUFile_" + i.ToString();
                string fn   = ini.ReadString(sect, "FileName", "");
                if (File.Exists(fn))
                {
                    MRUFile mf = new MRUFile();
                    mf.LoadFromFile(ini, sect);
                    fMRUFiles.Add(mf);
                }
                else
                {
                    MRUFile.DeleteKeys(ini, sect);
                }
            }

            cnt = ini.ReadInteger("Relations", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                fRelations.Add(ini.ReadString("Relations", "Relation_" + i.ToString(), ""));
            }

            fIndividualListColumns.LoadFromFile(ini, "PersonsColumns");

            fListHighlightUnmarriedPersons  = ini.ReadBool("ListPersons", "HighlightUnmarried", false);
            fListHighlightUnparentedPersons = ini.ReadBool("ListPersons", "HighlightUnparented", false);

            fMWinRect.Left   = ini.ReadInteger("Common", "MWinL", -1);
            fMWinRect.Top    = ini.ReadInteger("Common", "MWinT", -1);
            fMWinRect.Right  = ini.ReadInteger("Common", "MWinW", -1);
            fMWinRect.Bottom = ini.ReadInteger("Common", "MWinH", -1);
            fMWinState       = (WindowState)((uint)ini.ReadInteger("Common", "MWinState", 0));

            cnt = ini.ReadInteger("LastBases", "Count", 0);
            for (int i = 0; i < cnt; i++)
            {
                string st = ini.ReadString("LastBases", "LB" + i.ToString(), "");
                AddLastBase(st);
            }

            fAncestorsCircleOptions.LoadFromFile(ini);
        }