Skip to content

Commit 3af40bf

Browse files
committed
Fixed classpath stripping in Vectors while debugging.
1 parent b3ae602 commit 3af40bf

File tree

1 file changed

+51
-31
lines changed
  • External/Plugins/FlashDebugger/Controls/DataTree

1 file changed

+51
-31
lines changed

External/Plugins/FlashDebugger/Controls/DataTree/ValueNode.cs

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using flash.tools.debugger;
33
using Double = java.lang.Double;
4+
using System.Text;
45

56
namespace FlashDebugger.Controls.DataTree
67
{
@@ -34,20 +35,18 @@ public override string Value
3435
string temp = null;
3536
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
3637
{
37-
string typeStr = "";
38+
string typeStr = m_Value.getTypeName().ToString();
39+
// rename vector
40+
typeStr = typeStr.Replace("__AS3__.vec.Vector.<", "Vector.<");
3841
if (HideFullClasspath)
3942
{
4043
// 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);
4645
}
4746
else
4847
{
4948
// return class type with classpath
50-
typeStr = m_Value.getTypeName().ToString().Replace("::", ".");
49+
typeStr = typeStr.Replace("::", ".");
5150
}
5251

5352
// show / hide IDs
@@ -59,12 +58,6 @@ public override string Value
5958
typeStr = typeStr.Replace("[]", "Array");
6059
}
6160

62-
// rename vector
63-
else if (typeStr.StartsWith("__AS3__.vec.Vector.<"))
64-
{
65-
typeStr = typeStr.Replace("__AS3__.vec.Vector.<", "Vector.<");
66-
}
67-
6861
return typeStr;
6962
}
7063
else if (type == VariableType_.NUMBER)
@@ -206,24 +199,6 @@ public bool IsPrimitive
206199
}
207200
}
208201

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-
227202
public Value PlayerValue
228203
{
229204
get
@@ -274,6 +249,51 @@ public ValueNode(string text, Value value)
274249
m_Value = value;
275250
}
276251

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+
}
277297
}
278298

279299
}

0 commit comments

Comments
 (0)