public Strongs(HaveInstalledEnum installed) { this.InitializeComponent(); this.loadInstalled = installed; this.Loaded += this.Strongs_Loaded; }
private void SelectedDictionary_Changed(object sender, PropertyChangedEventArgs e) { try { HaveInstalledEnum entity = (HaveInstalledEnum)this.dictionaryModel.Dictionary; this.DictionaryItems = BiblesData.Database.GetDictionary(entity).ToArray(); } catch (Exception err) { ErrorLog.ShowError(err); } }
private static void InsertDictionary(HaveInstalledEnum entity, string filePath) { int entityKeyId = (int)entity; string fileText = File.ReadAllText(filePath); string[] lineSplitOptions = new string[] { "||" }; string[] fileLines = fileText.Split(new string[] { "|||" }, System.StringSplitOptions.RemoveEmptyEntries); Dictionary <string, DictionaryModel> result = new Dictionary <string, DictionaryModel>(); foreach (string line in fileLines) { string[] lineSplit = line.Split(lineSplitOptions, System.StringSplitOptions.RemoveEmptyEntries); if (lineSplit.Length != 2 || lineSplit[0].IsNullEmptyOrWhiteSpace() || lineSplit[1].IsNullEmptyOrWhiteSpace() || result.ContainsKey(lineSplit[0])) { // This should not be continue; } DictionaryModel model = new DictionaryModel { EntityModelKey = $"{entityKeyId}||{lineSplit[0]}", EntityValue = lineSplit[1].ZipFile() }; result.Add(lineSplit[0], model); } BiblesData.Database.DeleteDictionary(entity); int skipIndex = 0; int takeValue = 100; while (skipIndex <= result.Count) { BiblesData.Database.InsertDictionaryBulk(result.Values.Skip(skipIndex).Take(takeValue).ToList()); skipIndex += takeValue; } BiblesData.Database.InstallEntity(entity); }