1
1
using System ;
2
2
using flash . tools . debugger ;
3
3
using Double = java . lang . Double ;
4
+ using System . Text ;
4
5
5
6
namespace FlashDebugger . Controls . DataTree
6
7
{
@@ -34,20 +35,18 @@ public override string Value
34
35
string temp = null ;
35
36
if ( type == VariableType_ . MOVIECLIP || type == VariableType_ . OBJECT )
36
37
{
37
- string typeStr = "" ;
38
+ string typeStr = m_Value . getTypeName ( ) . ToString ( ) ;
39
+ // rename vector
40
+ typeStr = typeStr . Replace ( "__AS3__.vec.Vector.<" , "Vector.<" ) ;
38
41
if ( HideFullClasspath )
39
42
{
40
43
// return class type without classpath
41
- string typeName = m_Value . getTypeName ( ) . ToString ( ) ;
42
- if ( typeName . StartsWith ( "__AS3__.vec::Vector.<" ) || typeName . StartsWith ( "Vector.<" ) )
43
- typeStr = "Vector.<" + typeName . AfterLast ( "::" , true ) ;
44
- else
45
- typeStr = typeName . After ( "::" , 0 , true ) . Replace ( "::" , "." ) ;
44
+ typeStr = CleanTypeClassPaths ( typeStr ) ;
46
45
}
47
46
else
48
47
{
49
48
// return class type with classpath
50
- typeStr = m_Value . getTypeName ( ) . ToString ( ) . Replace ( "::" , "." ) ;
49
+ typeStr = typeStr . Replace ( "::" , "." ) ;
51
50
}
52
51
53
52
// show / hide IDs
@@ -59,12 +58,6 @@ public override string Value
59
58
typeStr = typeStr . Replace ( "[]" , "Array" ) ;
60
59
}
61
60
62
- // rename vector
63
- else if ( typeStr . StartsWith ( "__AS3__.vec.Vector.<" ) )
64
- {
65
- typeStr = typeStr . Replace ( "__AS3__.vec.Vector.<" , "Vector.<" ) ;
66
- }
67
-
68
61
return typeStr ;
69
62
}
70
63
else if ( type == VariableType_ . NUMBER )
@@ -206,24 +199,6 @@ public bool IsPrimitive
206
199
}
207
200
}
208
201
209
-
210
- private string Escape ( string text )
211
- {
212
- text = text . Replace ( "\\ " , "\\ \\ " ) ;
213
- text = text . Replace ( "\" " , "\\ \" " ) ;
214
- text = text . Replace ( "\0 " , "\\ 0" ) ;
215
- text = text . Replace ( "\a " , "\\ a" ) ;
216
- text = text . Replace ( "\b " , "\\ b" ) ;
217
- text = text . Replace ( "\f " , "\\ f" ) ;
218
- text = text . Replace ( "\n " , "\\ n" ) ;
219
- text = text . Replace ( "\r " , "\\ r" ) ;
220
- text = text . Replace ( "\t " , "\\ t" ) ;
221
- text = text . Replace ( "\v " , "\\ v" ) ;
222
- if ( text . Length > 65533 )
223
- text = text . Substring ( 0 , 65533 - 5 ) + "[...]" ;
224
- return text ;
225
- }
226
-
227
202
public Value PlayerValue
228
203
{
229
204
get
@@ -274,6 +249,51 @@ public ValueNode(string text, Value value)
274
249
m_Value = value ;
275
250
}
276
251
252
+ private string Escape ( string text )
253
+ {
254
+ text = text . Replace ( "\\ " , "\\ \\ " ) ;
255
+ text = text . Replace ( "\" " , "\\ \" " ) ;
256
+ text = text . Replace ( "\0 " , "\\ 0" ) ;
257
+ text = text . Replace ( "\a " , "\\ a" ) ;
258
+ text = text . Replace ( "\b " , "\\ b" ) ;
259
+ text = text . Replace ( "\f " , "\\ f" ) ;
260
+ text = text . Replace ( "\n " , "\\ n" ) ;
261
+ text = text . Replace ( "\r " , "\\ r" ) ;
262
+ text = text . Replace ( "\t " , "\\ t" ) ;
263
+ text = text . Replace ( "\v " , "\\ v" ) ;
264
+ if ( text . Length > 65533 )
265
+ text = text . Substring ( 0 , 65533 - 5 ) + "[...]" ;
266
+ return text ;
267
+ }
268
+
269
+ private string CleanTypeClassPaths ( string qualifiedName )
270
+ {
271
+ char [ ] delims = { ',' , ' ' , '<' , '>' } ;
272
+ var buffer = new StringBuilder ( ) ;
273
+ bool inPackage = false ;
274
+
275
+ for ( int i = qualifiedName . Length - 1 ; i >= 0 ; i -- )
276
+ {
277
+ char c = qualifiedName [ i ] ;
278
+
279
+ if ( inPackage )
280
+ {
281
+ if ( Array . IndexOf ( delims , c ) < 0 )
282
+ continue ;
283
+
284
+ inPackage = false ;
285
+ }
286
+ else if ( ( c == '.' && qualifiedName [ i + 1 ] != '<' ) || c == ':' )
287
+ {
288
+ inPackage = true ;
289
+ continue ;
290
+ }
291
+
292
+ buffer . Insert ( 0 , c ) ;
293
+ }
294
+
295
+ return buffer . ToString ( ) ;
296
+ }
277
297
}
278
298
279
299
}
0 commit comments