public static bool TryMergeEntries(LexEntry entry1, LexEntry entry2, string[] traitsWithMultiplicity, IProgress progress) { if (!entry1.LexicalForm.CanBeUnifiedWith(entry2.LexicalForm)) { progress.WriteMessageWithColor("gray","Attempting to merge entries, but could not because their Lexical Forms clash in some writing system."); return false; } if (!SenseMerger.TryMergeProperties(entry1, entry2, traitsWithMultiplicity, "entries for "+entry1.ToString(), progress)) return false; // at this point, we're committed to doing the merge entry1.LexicalForm.MergeIn(entry2.LexicalForm); var senses = entry2.Senses.ToArray(); foreach (var sense in senses) { MergeOrAddSense(entry1, sense, traitsWithMultiplicity, progress); } if (entry2.ModificationTime > entry1.ModificationTime) { entry1.ModificationTime = entry2.ModificationTime; } entry1.IsDirty = true; return true; }
public static bool TryMergeEntries(LexEntry entry1, LexEntry entry2, string[] traitsWithMultiplicity, IProgress progress) { if (!entry1.LexicalForm.CanBeUnifiedWith(entry2.LexicalForm)) { progress.WriteMessageWithColor("gray", "Attempting to merge entries, but could not because their Lexical Forms clash in some writing system."); return(false); } if (!SenseMerger.TryMergeProperties(entry1, entry2, traitsWithMultiplicity, "entries for " + entry1.ToString(), progress)) { return(false); } // at this point, we're committed to doing the merge entry1.LexicalForm.MergeIn(entry2.LexicalForm); var senses = entry2.Senses.ToArray(); foreach (var sense in senses) { MergeOrAddSense(entry1, sense, traitsWithMultiplicity, progress); } if (entry2.ModificationTime > entry1.ModificationTime) { entry1.ModificationTime = entry2.ModificationTime; } entry1.IsDirty = true; return(true); }