Exemplo n.º 1
0
        public override void Refresh()
        {
            if (m_isExpanded)
            {
                Obj = parent.Obj;

                if (variables == null)
                {
                    variables = PopList(Obj is ICollection ? ((ICollection)Obj).Count : 8);
                }

                if (Obj is IList)
                {
                    int count = ((IList)Obj).Count;

                    // Add new entries to variables if there aren't enough entries
                    for (int i = variables.Count; i < count; i++)
                    {
                        variables.Add(new DebugModeEntry(this)
                        {
                            Getter = new VariableGetterHolder(i + ":", new EnumerableValueGetter(this, i).GetValue)
                        });
                    }

                    // Remove excessive entries from variables
                    for (int i = variables.Count - 1; i >= count; i--)
                    {
                        variables[i].PoolLists();
                        variables.RemoveAt(i);
                    }
                }
                else
                {
                    int index = 0;
                    foreach (object element in (IEnumerable)Obj)
                    {
                        DebugModeEntry entry;
                        if (index < variables.Count)
                        {
                            entry = variables[index];
                        }
                        else
                        {
                            entry = new DebugModeEntry(this)
                            {
                                Getter = new VariableGetterHolder(index + ":", new EnumerableValueGetter(this, index).GetValue)
                            };
                            variables.Add(entry);
                        }

                        entry.Obj = element;
                        index++;
                    }

                    for (int i = variables.Count - 1; i >= index; i--)
                    {
                        variables[i].PoolLists();
                        variables.RemoveAt(i);
                    }
                }

                for (int i = 0; i < variables.Count; i++)
                {
                    variables[i].Refresh();
                }
            }
        }
Exemplo n.º 2
0
 public DebugModeEntry(DebugModeEntry parent)
 {
     this.parent = parent;
 }
Exemplo n.º 3
0
 public DebugModeEnumerableEntry(DebugModeEntry parent) : base(parent)
 {
 }