Browse Source

VariableCollection can handle dot separated variable names

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@405 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
0a7f4b3b06
  1. 27
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  2. 13
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

27
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -197,20 +197,23 @@ namespace ICSharpCode.SharpDevelop.Services @@ -197,20 +197,23 @@ namespace ICSharpCode.SharpDevelop.Services
{
if (debugger == null || debugger.IsRunning) return null;
VariableCollection collection = debugger.LocalVariables;
if (collection == null)
if (collection == null) {
return null;
foreach (Variable v in collection) {
if (v.Name == variableName) {
object val = v.Value;
if (val == null)
return "<null>";
else if (val is string)
return "\"" + val.ToString() + "\"";
else
return val.ToString();
}
}
return null;
object val;
try {
val = collection[variableName].Value;
} catch (DebuggerException) {
return null;
}
if (val == null) {
return "<null>";
} else if (val is string) {
return "\"" + val.ToString() + "\"";
} else {
return val.ToString();
}
}
public void Dispose()

13
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -68,9 +68,16 @@ namespace DebuggerLibrary @@ -68,9 +68,16 @@ namespace DebuggerLibrary
public Variable this[string variableName] {
get {
foreach (Variable v in InnerList) {
if (v.Name == variableName) {
return v;
int index = variableName.IndexOf('.');
if (index != -1) {
string rootVariable = variableName.Substring(0, index);
string subVariable = variableName.Substring(index + 1);
return this[rootVariable].SubVariables[subVariable];
} else {
foreach (Variable v in InnerList) {
if (v.Name == variableName) {
return v;
}
}
}

Loading…
Cancel
Save