listChildren() публичный Метод

Return a list of the children of the specified variable object.
public listChildren ( string name ) : string
name string Variable name.
Результат string
Пример #1
0
        public void listChildren(EventDispatcher dispatcher, string parentType, ArrayList GDBNames, ArrayList VSNames, bool hasVsNdK_, string GDBName)
        {
            string childListResponse;
            if (GDBName == null)
            {
                if (hasVsNdK_)
                {
                    childListResponse = dispatcher.listChildren(_GDBName);
                }
                else
                {
                    childListResponse = dispatcher.listChildren(_name);
                    if ((childListResponse == "ERROR") && (_GDBName != null))
                    {
                        childListResponse = dispatcher.listChildren(_GDBName);
                    }
                }
            }
            else
                childListResponse = dispatcher.listChildren(GDBName);

            if (childListResponse != "ERROR")
            {
                childListResponse = (childListResponse.Substring(3)).Replace("#;;;", "");

                string[] childList = childListResponse.Split('#');
                foreach (string childString in childList)
                {
                    //                    bool complex = false;
                    string name = null;
                    string type = null;
                    string value = null;
                    string exp = null;
                    int numChildren = 0;
                    bool valid = true;

                    string[] childProperties = childString.Split(';');

                    if (childProperties[0] == "")
                        continue;

                    name = childProperties[0];

                    if (name.Contains("::"))
                    {
                        continue;
                    }

                    GDBName = name;
            //                    string old = name;

                    int end = name.Length;
                    if (name[end - 1] == '"')
                        end--;
                    if (((name.Length > 8) && (name.Substring(end - 8, 8) == ".private")) || ((name.Length > 7) && (name.Substring(end - 7, 7) == ".public")) || ((name.Length > 10) && (name.Substring(end - 10, 10) == ".protected")) || ((name.Length > 9) && (name.Substring(end - 9, 9) == ".private.")) || ((name.Length > 8) && (name.Substring(end - 8, 8) == ".public.")) || ((name.Length > 11) && (name.Substring(end - 11, 11) == ".protected.")))
                    {
                        int index = VSNames.IndexOf(_name);
                        if (index != -1)
                            GDBNames[index] = GDBName;
                        else
                        {
                            GDBNames.Add(GDBName);
                            VSNames.Add(_name);
                        }
                        this.listChildren(dispatcher, parentType, GDBNames, VSNames, hasVsNdK_, GDBName);
                        continue;
                    }
                    else
                    {
                        int dot = name.LastIndexOf(".");
                        if (dot != -1)
                        {
                            int index = GDBNames.IndexOf(name.Substring(0, dot));
                            if (index != -1)
                            {
                                name = VSNames[index].ToString() + name.Substring(dot);
                            }
                        }

                        name = name.Replace(".private", "");
                        name = name.Replace(".public", "");
                        name = name.Replace(".protected", "");
                        name = name.Replace("..", ".");

                        dot = name.LastIndexOf(".*");
                        if (dot != -1)
                        {
                            name = "*(" + name.Remove(dot) + ")";
                        }

                        if (parentType == "*")
                        {
                            dot = name.LastIndexOf('.');
                            if (dot != -1)
                            {
                                name = name.Substring(0, dot) + "->" + name.Substring(dot + 1, name.Length - (dot + 1));
                            }
                        }
                        else if (parentType == "[]")
                        {
                            dot = name.LastIndexOf('.');
                            name = name.Substring(0, dot) + "[" + name.Substring(dot + 1, name.Length - (dot + 1));
                            name = name + "]";
                        }
                        GDBNames.Add(GDBName);
                        VSNames.Add(name);
                    }

                    if (childProperties[1] != "")
                        numChildren = Convert.ToInt32(childProperties[1]);

                    value = childProperties[2];
                    if ((value == "") || (value.Contains("{...}")) || ((value.Length >= 2) && (value[0] == '[') && (value[value.Length - 1] == ']')))
                        valid = evaluateExpression(name, ref value, GDBName);

                    type = childProperties[3];

                    VariableInfo child = new VariableInfo(name, exp, type, value, GDBName);

                    if ((valid) && (numChildren > 0 && value != "0x0"))
                    {
                        child._children = new ArrayList();
                    }
                    if (VSNames.Contains(name))
                    {
                        int index = VSNames.IndexOf(name);
                        VSNames.RemoveAt(index);
                        GDBNames.RemoveAt(index);
                    }
                    _children.Add(child);
                    //                    }
                }
            }
            else
            {
                // ??? What to do in case of error???
            }
        }