コード例 #1
0
 private void SetValuesStore(TypeValueQuery qry, string[] data, ref int ndx, int width)
 {
     if (qry.GetValue)
     {
         qry.SetValuesStore(data, ndx, width);
         ++ndx;
     }
     if (qry.HasChildren)
     {
         foreach (var child in qry.Children)
         {
             SetValuesStore(child, data, ref ndx, width);
         }
     }
 }
コード例 #2
0
        private TypeValueQuery GetQuery()
        {
            int valCount = 1;
            var dct      = new Dictionary <long, List <ClrtDisplayableType> >(_selection.Count * 4);

            dct.Add(_typeInfo.Id, new List <ClrtDisplayableType>());
            var cmp = new ClrtDisplayableIdComparer();

            foreach (var sel in _selection)
            {
                if (sel.GetValue)
                {
                    ++valCount;
                }
                if (!dct.ContainsKey(sel.Id))
                {
                    dct.Add(sel.Id, new List <ClrtDisplayableType>());
                }
                var parent = sel.RealParent;
                var cursel = sel;
                while (parent != null)
                {
                    List <ClrtDisplayableType> lst;
                    if (dct.TryGetValue(parent.Id, out lst))
                    {
                        if (!lst.Contains(cursel, cmp))
                        {
                            lst.Add(cursel);
                        }
                    }
                    else
                    {
                        dct.Add(parent.Id, new List <ClrtDisplayableType>()
                        {
                            cursel
                        });
                    }
                    cursel = parent;
                    parent = parent.RealParent;
                }
            }

            TypeValueQuery root = new TypeValueQuery(_typeInfo.Id, null, _typeInfo.TypeName, _typeInfo.TypeId, "ADDRESS", Constants.InvalidIndex, false, null, true);

            GetQueryHelper(_typeInfo, root, dct);

            string[] values = new string[valCount * _typeInfo.Addresses.Length];
            root.SetValuesStore(values, 0, valCount);
            int dataNdx = 1;

            if (root.HasChildren)
            {
                foreach (var child in root.Children)
                {
                    SetValuesStore(child, values, ref dataNdx, valCount);
                    SetAlternativeSiblings(child);
                }
            }

            return(root);
        }