public SequenceViewModel(SequenceDescription desc) { Result = desc.Result; Description = desc.Description; Sequence = desc.Sequence; Utf32 = desc.Utf32; }
public SequenceViewModel(CategoryViewModel category, SequenceDescription desc) { Category = category; Category.IsEmpty = false; Result = desc.Result; Description = desc.Description; Sequence = desc.Sequence; Utf32 = desc.Utf32; }
private void InsertSequence(KeySequence path, SequenceDescription item) { if (path.Count == 0) { m_results.Add(item); return; } if (!m_children.TryGetValue(path[0], out var child)) { m_children.Add(path[0], child = new SequenceNode()); } child.InsertSequence(path.GetRange(1, path.Count - 1), item); }
/// <summary> /// Build a list of sequence descriptions by recursively adding our /// children to <see cref="list"/>. The output structure is suitable /// for the GUI. /// </summary> private void BuildSequenceDescriptions(List <SequenceDescription> list, KeySequence path) { if (m_result != null) { var item = new SequenceDescription(); item.Sequence = path; item.Result = m_result; item.Description = m_description; item.Utf32 = m_utf32; list.Add(item); } foreach (var pair in m_children) { var newpath = new KeySequence(path); newpath.Add(pair.Key); pair.Value.BuildSequenceDescriptions(list, newpath); } }
private void InsertSequence(KeySequence path, SequenceDescription item) { if (path.Count == 0) { // If this is a conflict, warn about it if (m_results.Count > 0 && m_results[0].Result != item.Result) { Logger.Warn($"Conflicting sequence for {item.Sequence.FriendlyName}: had {m_results[0].Result}, got {item.Result}"); } // Insert sequence at index 0 to give precedence to user sequences m_results.Insert(0, item); return; } if (!m_children.TryGetValue(path[0], out var child)) { m_children.Add(path[0], child = new SequenceNode()); } child.InsertSequence(path.GetRange(1, path.Count - 1), item); }
public SequenceViewModel(SequenceDescription desc) => m_desc = desc;