Skip to content

Commit cc90ec9

Browse files
committed
Support C# arrays of points.
1 parent e6befc8 commit cc90ec9

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

Visual_Studio_2015/GraphicalDebugging/ExpressionLoader.cs

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ private ExpressionLoader(DTE2 dte)
112112
loadersCS = new Loaders();
113113

114114
loadersCS.Add(new CSList());
115+
115116
loadersCS.Add(new CSArray());
116-
// TODO: PointCSArray
117+
loadersCS.Add(new PointCSArray());
118+
117119
loadersCS.Add(new PointContainer("System.Collections.Generic.List"));
118120
}
119121

@@ -2516,8 +2518,74 @@ public override bool ForEachMemoryBlock(MemoryReader mreader, string name, strin
25162518
}
25172519
}
25182520

2519-
// TODO: CSList's of Points MemoryReader doesn't work because of the user of * and & in C#
2520-
// TODO: PointCSArray is not implemented
2521+
class PointCSArray : PointRange<ExpressionDrawer.MultiPoint>
2522+
{
2523+
public class PointKindConstraint : TypeConstraint
2524+
{
2525+
public override bool Ok(Loaders loaders, string name, string type)
2526+
{
2527+
string elementType = CSArray.ElemTypeFromType(type);
2528+
if (elementType != "")
2529+
{
2530+
Loader loader = loaders.FindByType(name + "[0]", elementType);
2531+
if (loader != null)
2532+
return loader.Kind() == ExpressionLoader.Kind.Point;
2533+
}
2534+
return false;
2535+
}
2536+
}
2537+
2538+
public PointCSArray()
2539+
: base(ExpressionLoader.Kind.MultiPoint)
2540+
{ }
2541+
2542+
public override TypeConstraint Constraint() { return new PointKindConstraint(); }
2543+
2544+
public override string Id() { return null; }
2545+
2546+
public override bool MatchType(string type, string id)
2547+
{
2548+
return CSArray.ElemTypeFromType(type) != "";
2549+
}
2550+
2551+
public override void Load(Loaders loaders, MemoryReader mreader,
2552+
Debugger debugger, string name, string type,
2553+
out Geometry.Traits traits,
2554+
out ExpressionDrawer.MultiPoint result)
2555+
{
2556+
traits = null;
2557+
result = null;
2558+
2559+
string pointType = CSArray.ElemTypeFromType(type);
2560+
2561+
ContainerLoader containerLoader = loaders.FindByType(ExpressionLoader.Kind.Container,
2562+
name,
2563+
type) as ContainerLoader;
2564+
if (containerLoader == null)
2565+
return;
2566+
2567+
string pointName = containerLoader.ElementName(name, pointType);
2568+
2569+
PointLoader pointLoader = loaders.FindByType(ExpressionLoader.Kind.Point,
2570+
pointName,
2571+
pointType) as PointLoader;
2572+
if (pointLoader == null)
2573+
return;
2574+
2575+
if (mreader != null)
2576+
{
2577+
result = LoadMemory(mreader, name, type,
2578+
pointType, pointLoader, containerLoader);
2579+
}
2580+
2581+
if (result == null)
2582+
{
2583+
result = LoadParsed(mreader, debugger, name, type,
2584+
pointType, pointLoader, containerLoader);
2585+
}
2586+
}
2587+
}
2588+
25212589

25222590
class UserPoint : PointLoader
25232591
{

0 commit comments

Comments
 (0)