public int CompareTo(VariableNode otherNode)
        {
            string thisName  = Text;
            string otherName = otherNode.Text;

            if (thisName == otherName)
            {
                return(0);
            }
            if (thisName.Length > 0 && thisName[0] == '_')
            {
                thisName = thisName.Substring(1);
            }
            if (otherName.Length > 0 && otherName[0] == '_')
            {
                otherName = otherName.Substring(1);
            }
            int result = LogicalComparer.Compare(thisName, otherName);

            if (result != 0)
            {
                return(result);
            }
            return(m_Variable.getName().length() > 0 && m_Variable.getName().startsWith("_") ? 1 : -1);
        }
        public int CompareTo(DataNode otherNode)
        {
            String thisName  = m_Value.getName();
            String otherName = otherNode.m_Value.getName();

            if (thisName == otherName)
            {
                return(0);
            }

            if (thisName[0] == '_')
            {
                thisName = thisName.Substring(1);
            }

            if (otherName[0] == '_')
            {
                otherName = otherName.Substring(1);
            }

            int result = thisName.CompareTo(otherName);

            if (result != 0)
            {
                return(result);
            }

            return(m_Value.getName()[0] == '_' ? 1 : -1);
        }
        private static void GetIndices(Variable obVariable, ref int rowIdx, ref int colIdx)
        {
            var objMatch = _NameRegex.Match(obVariable.getName());

            rowIdx = int.Parse(objMatch.Groups["row"].Value, CultureInfo.InvariantCulture);
            colIdx = int.Parse(objMatch.Groups["col"].Value, CultureInfo.InvariantCulture);
        }
        /// <summary> Comparator interface for sorting Variables</summary>
        public virtual int CompareTo(Object o2)
        {
            Variable v2 = (Variable)o2;

            String n1 = getName();
            String n2 = v2.getName();

            return(String.Compare(n1, n2, true));
        }
        //
        // Statics for formatting stuff
        //

        /// <summary> Formatting function for variable</summary>
        public static void  appendVariable(System.Text.StringBuilder sb, Variable v)
        {
            //sb.append('\'');
            String name = v.getName();

            sb.Append(name);
            //sb.append('\'');
            sb.Append(" = ");             //$NON-NLS-1$
            appendVariableValue(sb, v.getValue(), name);
            //appendVariableAttributes(sb, v);
        }
        public Object lookupMembers(Object par0)
        {
            String name = "?";
            Value  val  = null;

            if (par0 is Value)
            {
                val = (Value)par0;
            }

            if (par0 is Variable)
            {
                Variable var0 = (Variable)par0;
                name = var0.getName();
                val  = var0.getValue();
            }

            if (val != null)
            {
                int type = val.getType();
                if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
                {
                    String ret = name + " = " + FormatValue(val) + "\r\n";
                    foreach (Variable v in val.getMembers(session))
                    {
                        ret += " " + v.getName() + " = " + FormatValue(v.getValue()) + "\r\n";
                    }
                    return(ret);
                }
                return(new String(name + " = " + val.getValueAsString()));
            }

            //NoSuchVariableException

            throw new NotImplementedException();
        }
Example #7
0
        public void ListChildItems(ValueNode node)
        {
            if (node != null && node.Nodes.Count == 0 && node.PlayerValue != null)
            {
                FlashInterface      flashInterface = PluginMain.debugManager.FlashInterface;
                List <VariableNode> nodes          = new List <VariableNode>();
                List <VariableNode> inherited      = new List <VariableNode>();
                List <VariableNode> statics        = new List <VariableNode>();
                int tmpLimit = node.ChildrenShowLimit;
                foreach (Variable member in node.PlayerValue.getMembers(flashInterface.Session))
                {
                    VariableNode memberNode = new VariableNode(member)
                    {
                        HideClassId       = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                    if (member.isAttributeSet(VariableAttribute_.IS_STATIC))
                    {
                        statics.Add(memberNode);
                    }
                    else if (member.getLevel() > 0)
                    {
                        inherited.Add(memberNode);
                    }
                    else
                    {
                        nodes.Add(memberNode);
                    }
                }
                // inherited vars
                if (inherited.Count > 0)
                {
                    if (PluginMain.settingObject.CombineInherited)
                    {
                        // list inherited alongside main class members
                        foreach (DataNode item in inherited)
                        {
                            node.Nodes.Add(item);
                        }
                    }
                    else
                    {
                        // list inherited in a [inherited] group
                        ValueNode inheritedNode = new ValueNode("[inherited]");
                        inherited.Sort();
                        foreach (DataNode item in inherited)
                        {
                            inheritedNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(inheritedNode);
                    }
                }
                // static vars
                if (!PluginMain.settingObject.HideStaticMembers && statics.Count > 0)
                {
                    DataNode staticNode = new ValueNode("[static]");
                    statics.Sort();
                    foreach (DataNode item in statics)
                    {
                        staticNode.Nodes.Add(item);
                    }
                    node.Nodes.Add(staticNode);
                }
                // test children
                foreach (String ch in node.PlayerValue.getClassHierarchy(false))
                {
                    if (ch.Equals("flash.display::DisplayObjectContainer"))
                    {
                        double   numChildren  = ((java.lang.Double)node.PlayerValue.getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                        DataNode childrenNode = new ValueNode("[children]");
                        for (int i = 0; i < numChildren; i++)
                        {
                            try
                            {
                                IASTBuilder b   = new ASTBuilder(false);
                                string      cmd = node.GetVariablePath() + ".getChildAt(" + i + ")";
                                ValueExp    exp = b.parse(new java.io.StringReader(cmd));
                                var         ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
                                var         obj = exp.evaluate(ctx);
                                if (obj is flash.tools.debugger.concrete.DValue)
                                {
                                    obj = new flash.tools.debugger.concrete.DVariable("getChildAt(" + i + ")", (flash.tools.debugger.concrete.DValue)obj, ((flash.tools.debugger.concrete.DValue)obj).getIsolateId());
                                }
                                DataNode childNode = new VariableNode((Variable)obj)
                                {
                                    HideClassId       = PluginMain.settingObject.HideClassIds,
                                    HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                                };
                                childNode.Text = "child_" + i;
                                childrenNode.Nodes.Add(childNode);
                            }
                            catch (Exception) { }
                        }
                        node.Nodes.Add(childrenNode);
                    }
                    else if (ch.Equals("flash.events::EventDispatcher"))
                    {
                        Variable list = node.PlayerValue.getMemberNamed(flashInterface.Session, "listeners");
                        var      omg  = list.getName();

                        /*
                         * double numChildren = ((java.lang.Double)node.Variable.getValue().getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                         * DataNode childrenNode = new DataNode("[children]");
                         * for (int i = 0; i < numChildren; i++)
                         * {
                         *  try
                         *  {
                         *
                         *      IASTBuilder b = new ASTBuilder(false);
                         *      string cmd = GetVariablePath(node) + ".getChildAt(" + i + ")";
                         *      ValueExp exp = b.parse(new java.io.StringReader(cmd));
                         *      var ctx = new ExpressionContext(flashInterface.Session, flashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
                         *      var obj = exp.evaluate(ctx);
                         *      if (obj is flash.tools.debugger.concrete.DValue) obj = new flash.tools.debugger.concrete.DVariable("child_" + i, (flash.tools.debugger.concrete.DValue)obj);
                         *      DataNode childNode = new DataNode((Variable)obj);
                         *      childrenNode.Nodes.Add(childNode);
                         *  }
                         *  catch (Exception) { }
                         * }
                         * node.Nodes.Add(childrenNode);
                         */
                    }
                }
                //test children
                nodes.Sort();
                // add child items
                _tree.BeginUpdate();
                foreach (DataNode item in nodes)
                {
                    if (0 == tmpLimit--)
                    {
                        break;
                    }
                    node.Nodes.Add(item);
                }
                if (tmpLimit == -1)
                {
                    DataNode moreNode = new ContinuedDataNode();
                    node.Nodes.Add(moreNode);
                }
                _tree.EndUpdate();
            }
        }
 public DataNode(Variable value)
     : base(value.getName())
 {
     m_Value = value;
 }
Example #9
0
 public static void addVariable(Variable v)
 {
     v.setName(v.getName().Replace("%", ""));
     vars.Add(v);
 }
 public VariableNode(Variable variable)
     : base(variable.getName())
 {
     m_Variable = variable;
     m_Value    = variable.getValue();
 }
        void TreeExpanding(Object sender, TreeViewAdvEventArgs e)
        {
            if (e.Node.Index >= 0)
            {
                DataNode node = e.Node.Tag as DataNode;
                if (node.Nodes.Count == 0 && node.Variable != null)
                {
                    FlashInterface  flashInterface = PluginMain.debugManager.FlashInterface;
                    List <DataNode> nodes          = new List <DataNode>();
                    List <DataNode> inherited      = new List <DataNode>();
                    List <DataNode> statics        = new List <DataNode>();
                    int             tmpLimit       = node.ChildrenShowLimit;
                    foreach (Variable member in node.Variable.getValue().getMembers(flashInterface.Session))
                    {
                        DataNode memberNode = new DataNode(member);

                        if (member.isAttributeSet(VariableAttribute_.IS_STATIC))
                        {
                            statics.Add(memberNode);
                        }
                        else if (member.getLevel() > 0)
                        {
                            inherited.Add(memberNode);
                        }
                        else
                        {
                            nodes.Add(memberNode);
                        }
                    }
                    if (inherited.Count > 0)
                    {
                        DataNode inheritedNode = new DataNode("[inherited]");
                        inherited.Sort();
                        foreach (DataNode item in inherited)
                        {
                            inheritedNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(inheritedNode);
                    }
                    if (statics.Count > 0)
                    {
                        DataNode staticNode = new DataNode("[static]");
                        statics.Sort();
                        foreach (DataNode item in statics)
                        {
                            staticNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(staticNode);
                    }
                    //test children
                    foreach (String ch in node.Variable.getValue().getClassHierarchy(false))
                    {
                        if (ch.Equals("flash.display::DisplayObjectContainer"))
                        {
                            double   numChildren  = ((java.lang.Double)node.Variable.getValue().getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                            DataNode childrenNode = new DataNode("[children]");
                            for (int i = 0; i < numChildren; i++)
                            {
                                try
                                {
                                    IASTBuilder b   = new ASTBuilder(false);
                                    string      cmd = GetVariablePath(node) + ".getChildAt(" + i + ")";
                                    ValueExp    exp = b.parse(new java.io.StringReader(cmd));
                                    var         ctx = new ExpressionContext(flashInterface.Session, flashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
                                    var         obj = exp.evaluate(ctx);
                                    if (obj is flash.tools.debugger.concrete.DValue)
                                    {
                                        obj = new flash.tools.debugger.concrete.DVariable("getChildAt(" + i + ")", (flash.tools.debugger.concrete.DValue)obj);
                                    }
                                    DataNode childNode = new DataNode((Variable)obj);
                                    childNode.Text = "child_" + i;
                                    childrenNode.Nodes.Add(childNode);
                                }
                                catch (Exception) { }
                            }
                            node.Nodes.Add(childrenNode);
                        }
                        else if (ch.Equals("flash.events::EventDispatcher"))
                        {
                            Variable list = node.Variable.getValue().getMemberNamed(flashInterface.Session, "listeners");
                            var      omg  = list.getName();

                            /*
                             * double numChildren = ((java.lang.Double)node.Variable.getValue().getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                             * DataNode childrenNode = new DataNode("[children]");
                             * for (int i = 0; i < numChildren; i++)
                             * {
                             *  try
                             *  {
                             *
                             *      IASTBuilder b = new ASTBuilder(false);
                             *      string cmd = GetVariablePath(node) + ".getChildAt(" + i + ")";
                             *      ValueExp exp = b.parse(new java.io.StringReader(cmd));
                             *      var ctx = new ExpressionContext(flashInterface.Session, flashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
                             *      var obj = exp.evaluate(ctx);
                             *      if (obj is flash.tools.debugger.concrete.DValue) obj = new flash.tools.debugger.concrete.DVariable("child_" + i, (flash.tools.debugger.concrete.DValue)obj);
                             *      DataNode childNode = new DataNode((Variable)obj);
                             *      childrenNode.Nodes.Add(childNode);
                             *  }
                             *  catch (Exception) { }
                             * }
                             * node.Nodes.Add(childrenNode);
                             * */
                        }
                    }
                    //test children
                    nodes.Sort();
                    _tree.BeginUpdate();
                    foreach (DataNode item in nodes)
                    {
                        if (0 == tmpLimit--)
                        {
                            break;
                        }
                        node.Nodes.Add(item);
                    }
                    if (tmpLimit == -1)
                    {
                        DataNode moreNode = new DataNode("...");
                        node.Nodes.Add(moreNode);
                    }
                    _tree.EndUpdate();
                }
            }
        }
 /// <summary> The variable interface </summary>
 public virtual String getName()
 {
     return((m_var == null)?m_name:m_var.getName());
 }
 /// <summary> The variable interface </summary>
 public virtual java.lang.String getName()
 {
     return((m_var == null)?m_name:(string)m_var.getName());
 }
Example #14
0
		//
		// Statics for formatting stuff
		//
		
		/// <summary> Formatting function for variable</summary>
		public static void  appendVariable(System.Text.StringBuilder sb, Variable v)
		{
			//sb.append('\'');
			String name = v.getName();
			sb.Append(name);
			//sb.append('\'');
			sb.Append(" = "); //$NON-NLS-1$
			appendVariableValue(sb, v.getValue(), name);
			//appendVariableAttributes(sb, v);
		}