public static void DoneSettings() { Plugins.Unload(); NamesTable.SaveToFile(GetAppDataPathStatic() + "GEDKeeper2.nms"); var options = GlobalOptions.Instance; options.SaveToFile(GetAppDataPathStatic() + "GEDKeeper2.ini"); options.Dispose(); }
public static void InitSettings() { Logger.LogInit(GetLogFilename()); Plugins.Load(AppHost.Instance, GKUtils.GetPluginsPath()); var options = GlobalOptions.Instance; options.LoadFromFile(GetAppDataPathStatic() + "GEDKeeper2.ini"); options.FindLanguages(); NamesTable.LoadFromFile(GetAppDataPathStatic() + "GEDKeeper2.nms"); PathReplacer.Load(GKUtils.GetAppPath() + "crossplatform.yaml"); // FIXME: path }
public void Test_NamesTable() { using (NamesTable namesTable = new NamesTable()) { Assert.IsNotNull(namesTable); NameEntry nameEntry = namesTable.AddName("Ivan"); Assert.IsNotNull(nameEntry); Assert.AreEqual("Ivan", nameEntry.Name); nameEntry = namesTable.FindName("Ivan"); Assert.IsNotNull(nameEntry); string pat = namesTable.GetPatronymicByName("Ivan", GDMSex.svMale); Assert.IsNull(pat); string name = namesTable.GetNameByPatronymic("Ivanovich"); Assert.AreEqual("", name); GDMSex sex = namesTable.GetSexByName("Ivan"); Assert.AreEqual(GDMSex.svUnknown, sex); namesTable.SetName("Ivan", "Ivanovich", GDMSex.svMale); namesTable.SetName("Ivan", "Ivanovna", GDMSex.svFemale); pat = namesTable.GetPatronymicByName("Ivan", GDMSex.svMale); Assert.AreEqual("Ivanovich", pat); pat = namesTable.GetPatronymicByName("Ivan", GDMSex.svFemale); Assert.AreEqual("Ivanovna", pat); name = namesTable.GetNameByPatronymic("Ivanovich"); Assert.AreEqual("Ivan", name); name = namesTable.GetNameByPatronymic("Ivanovna"); Assert.AreEqual("Ivan", name); namesTable.SetNameSex("Maria", GDMSex.svFemale); sex = namesTable.GetSexByName("Maria"); Assert.AreEqual(GDMSex.svFemale, sex); namesTable.SetName("", "", GDMSex.svUnknown); namesTable.SetNameSex("", GDMSex.svUnknown); namesTable.SetName("Anna", "Ivanovna", GDMSex.svFemale); sex = namesTable.GetSexByName("Anna"); Assert.AreEqual(GDMSex.svFemale, sex); GDMIndividualRecord iRec = fContext.Tree.XRefIndex_Find("I3") as GDMIndividualRecord; Assert.IsNotNull(iRec); namesTable.ImportNames(iRec); namesTable.ImportNames(null); sex = namesTable.GetSexByName("Anna"); Assert.AreEqual(GDMSex.svFemale, sex); string namesFile = TestUtils.GetTempFilePath("names.txt"); namesTable.SaveToFile(namesFile); namesTable.LoadFromFile(namesFile); } }