@@ -12,9 +12,15 @@ public int ChildrenShowLimit
12
12
set { m_ChildrenShowLimit = value ; }
13
13
}
14
14
15
+ public bool HideFullClasspath { get ; set ; }
16
+ public bool HideClassId { get ; set ; }
17
+
15
18
protected Value m_Value ;
16
19
private bool m_bEditing = false ;
17
20
21
+ /// <summary>
22
+ /// Get the display value based on user's preferences
23
+ /// </summary>
18
24
public override string Value
19
25
{
20
26
get
@@ -27,7 +33,38 @@ public override string Value
27
33
string temp = null ;
28
34
if ( type == VariableType_ . MOVIECLIP || type == VariableType_ . OBJECT )
29
35
{
30
- return m_Value . getTypeName ( ) ;
36
+ string typeStr = "" ;
37
+ if ( HideFullClasspath )
38
+ {
39
+ // return class type without classpath
40
+ string typeName = m_Value . getTypeName ( ) . ToString ( ) ;
41
+ if ( typeName . StartsWith ( "__AS3__.vec::Vector.<" ) || typeName . StartsWith ( "Vector.<" ) )
42
+ typeStr = "Vector.<" + typeName . AfterLast ( "::" , true ) ;
43
+ else
44
+ typeStr = typeName . After ( "::" , 0 , true ) . Replace ( "::" , "." ) ;
45
+ }
46
+ else
47
+ {
48
+ // return class type with classpath
49
+ typeStr = m_Value . getTypeName ( ) . ToString ( ) . Replace ( "::" , "." ) ;
50
+ }
51
+
52
+ // show / hide IDs
53
+ typeStr = HideClassId ? typeStr . Before ( "@" ) : typeStr . Replace ( "@" , " @" ) ;
54
+
55
+ // rename array
56
+ if ( typeStr . StartsWith ( "[]" ) )
57
+ {
58
+ typeStr = typeStr . Replace ( "[]" , "Array" ) ;
59
+ }
60
+
61
+ // rename vector
62
+ else if ( typeStr . StartsWith ( "__AS3__.vec.Vector.<" ) )
63
+ {
64
+ typeStr = typeStr . Replace ( "__AS3__.vec.Vector.<" , "Vector.<" ) ;
65
+ }
66
+
67
+ return typeStr ;
31
68
}
32
69
else if ( type == VariableType_ . NUMBER )
33
70
{
@@ -56,22 +93,21 @@ public override string Value
56
93
{
57
94
if ( m_Value . getValueAsObject ( ) != null )
58
95
{
59
- return "\" " + escape ( m_Value . ToString ( ) ) + "\" " ;
96
+ return "\" " + Escape ( m_Value . ToString ( ) ) + "\" " ;
60
97
}
61
98
}
62
99
else if ( type == VariableType_ . NULL )
63
100
{
64
101
return "null" ;
65
102
}
66
- /* else if (type == VariableType_.FUNCTION)
103
+ else if ( type == VariableType_ . FUNCTION )
67
104
{
68
- m_Value.ToString();
69
- //return "<setter>";
70
- }*/
105
+ return "Function @" + m_Value . ToString ( ) ;
106
+ }
71
107
temp = m_Value . ToString ( ) ;
72
108
if ( ! m_bEditing )
73
109
{
74
- temp = escape ( temp ) ;
110
+ temp = Escape ( temp ) ;
75
111
}
76
112
return temp ;
77
113
}
@@ -81,7 +117,96 @@ public override string Value
81
117
}
82
118
}
83
119
84
- private string escape ( string text )
120
+ /// <summary>
121
+ /// Get the full classpath of the value, eg: "flash.display.MovieClip"
122
+ /// </summary>
123
+ public string ClassPath
124
+ {
125
+ get
126
+ {
127
+
128
+ if ( m_Value == null )
129
+ {
130
+ return null ;
131
+ }
132
+ int type = m_Value . getType ( ) ;
133
+ if ( type == VariableType_ . MOVIECLIP || type == VariableType_ . OBJECT )
134
+ {
135
+ string typeStr = m_Value . getTypeName ( ) . replaceAll ( "::" , "." ) . ToString ( ) . Before ( "@" ) ;
136
+
137
+ if ( typeStr == "[]" )
138
+ {
139
+ return "Array" ;
140
+ }
141
+ return typeStr ;
142
+
143
+ }
144
+ else if ( type == VariableType_ . NUMBER )
145
+ {
146
+ return "Number" ;
147
+ }
148
+ else if ( type == VariableType_ . BOOLEAN )
149
+ {
150
+ return "Boolean" ;
151
+ }
152
+ else if ( type == VariableType_ . STRING )
153
+ {
154
+ return "String" ;
155
+ }
156
+ else if ( type == VariableType_ . NULL )
157
+ {
158
+ return "null" ;
159
+ }
160
+ else if ( type == VariableType_ . FUNCTION )
161
+ {
162
+ return "Function" ;
163
+ }
164
+ return null ;
165
+ }
166
+ }
167
+
168
+ /// <summary>
169
+ /// Get the object ID with the class name
170
+ /// </summary>
171
+ public string Id
172
+ {
173
+ get
174
+ {
175
+ if ( m_Value != null )
176
+ {
177
+ int type = m_Value . getType ( ) ;
178
+ if ( type == VariableType_ . MOVIECLIP || type == VariableType_ . OBJECT )
179
+ {
180
+ return m_Value . getTypeName ( ) . replaceAll ( "::" , "." ) . replaceAll ( "@" , " - " ) . ToString ( ) ;
181
+ }
182
+ else if ( type == VariableType_ . FUNCTION )
183
+ {
184
+ return "Function - " + m_Value . ToString ( ) ;
185
+ }
186
+ }
187
+ return "" ;
188
+ }
189
+ }
190
+
191
+ /// <summary>
192
+ /// Check if the value is a primitive type (int, Number, String, Boolean)
193
+ /// </summary>
194
+ public bool IsPrimitive
195
+ {
196
+ get
197
+ {
198
+ if ( m_Value == null )
199
+ {
200
+ return false ;
201
+ }
202
+ int type = m_Value . getType ( ) ;
203
+ return type == VariableType_ . NUMBER || type == VariableType_ . BOOLEAN ||
204
+ type == VariableType_ . STRING || type == VariableType_ . NULL ;
205
+ }
206
+ }
207
+
208
+
209
+ private string Escape ( string text )
85
210
{
86
211
text = text . Replace ( "\\ " , "\\ \\ " ) ;
87
212
text = text . Replace ( "\" " , "\\ \" " ) ;
0 commit comments