本文整理汇总了C#中Debugger.Value.GetMember方法的典型用法代码示例。如果您正苦于以下问题:C# Value.GetMember方法的具体用法?C# Value.GetMember怎么用?C# Value.GetMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger.Value
的用法示例。
在下文中一共展示了Value.GetMember方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Exception
internal Exception(Thread thread)
{
creationTime = DateTime.Now;
this.process = thread.Process;
this.thread = thread;
corValue = thread.CorThread.CurrentException;
exceptionType = thread.CurrentExceptionType;
Value runtimeValue = new Value(process,
new IExpirable[] {process.PauseSession},
new IMutable[] {},
delegate { return corValue; } );
NamedValue nv = runtimeValue.GetMember("_message");
if (!nv.IsNull)
message = nv.AsString;
else message = runtimeValue.Type.FullName;
if (thread.LastFunctionWithLoadedSymbols != null) {
location = thread.LastFunctionWithLoadedSymbols.NextStatement;
}
callstack = "";
int callstackItems = 0;
if (!nv.IsNull)
foreach(Function function in thread.Callstack) {
if (callstackItems >= 100) {
callstack += "...\n";
break;
}
SourcecodeSegment loc = function.NextStatement;
callstack += function.Name + "()";
if (loc != null) {
callstack += " - " + loc.SourceFullFilename + ":" + loc.StartLine + "," + loc.StartColumn;
}
callstack += "\n";
callstackItems++;
}
type = runtimeValue.Type.FullName;
}
示例2: InjectInterpreter
bool InjectInterpreter()
{
if (!DebuggerService.IsDebuggerLoaded) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorDebuggerNotLoaded"));
return false;
}
WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger;
if (winDebugger == null) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorIncompatibleDebugger"));
return false;
}
if (winDebugger.DebuggedProcess == null) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorNoProgramDebugged"));
return false;
}
process = winDebugger.DebuggedProcess;
process.Expired += delegate { interpreter = null; };
process.LogMessage -= OnDebuggerLogMessage;
process.LogMessage += OnDebuggerLogMessage;
Value assembly;
// Boo.Lang.Interpreter.dll
string path = Path.Combine(Path.GetDirectoryName(typeof(InterpreterContext).Assembly.Location), "Boo.Lang.Interpreter.dll");
assembly = LoadAssembly(path);
// Debugger.BooInterpreter.dll
assembly = LoadAssembly(typeof(DebugeeInteractiveInterpreter).Assembly.Location);
Value interpreterType = Eval.NewString(process, typeof(DebugeeInteractiveInterpreter).FullName);
interpreter = Eval.InvokeMethod(process, typeof(Assembly), "CreateInstance", assembly, new Value[] {interpreterType});
interpreter_localVariable = interpreter.GetMember("localVariable");
RunCommand(
"import System\n" +
"import System.IO\n" +
"import System.Text\n" +
"interpreter.RememberLastValue = true\n" +
"interpreter.Print = def(msg): System.Diagnostics.Debugger.Log(0xB00, \"DebugeeInterpreterContext.PrintLine\", msg)");
return true;
}
示例3: _eoln
private bool _eoln(Value v, string name)
{
if (v.Type.FullName == "PABCSystem.Text")
{
Value sr = v.GetMember("sr");
Value sw = v.GetMember("sw");
if (!sr.IsNull)
{
MethodInfo mi = DebugUtils.GetMethod(sr.Type, "Peek");
int val = (int)mi.Invoke(sr, new Value[0]).PrimitiveValue;
return val == 13;
}
else
if (!sw.IsNull)
throw new CommonEvaluationError(new System.Exception("Функция Eoln не может быть вызвана для текстового файла, открытого на запись"));
else
throw new CommonEvaluationError(new System.Exception(FILE_NOT_OPENED));
}
throw new WrongTypeOfArgument(name);
}
示例4: file_size
private long file_size(Value v, string name)
{
if (v.Type.FullName == "PABCSystem.TypedFile")
{
Value fi = v.GetMember("fi");
Value fs = v.GetMember("fs");
if (fi.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_ASSIGNED));
if (fs.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_OPENED));
return Convert.ToInt64(fs.GetMember("Length").PrimitiveValue) / Convert.ToInt64(v.GetMember("ElementSize").PrimitiveValue);
}
else if (v.Type.FullName == "PABCSystem.BinaryFile")
{
Value fi = v.GetMember("fi");
Value fs = v.GetMember("fs");
if (fi.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_ASSIGNED));
if (fs.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_OPENED));
return Convert.ToInt64(fs.GetMember("Length").PrimitiveValue);
}
throw new WrongTypeOfArgument(name);
}
示例5: _eof
private bool _eof(Value v, string name)
{
if (v.Type.FullName == "PABCSystem.Text")
{
Value sr = v.GetMember("sr");
Value sw = v.GetMember("sw");
if (!sr.IsNull)
return Convert.ToBoolean(sr.GetMember("EndOfStream").PrimitiveValue);
else
if (!sw.IsNull)
throw new CommonEvaluationError(new System.Exception("Функция Eof не может быть вызвана для текстового файла, открытого на запись"));
else
throw new CommonEvaluationError(new System.Exception(FILE_NOT_OPENED));
}
else if (v.Type.FullName == "PABCSystem.BinaryFile" || v.Type.FullName == "PABCSystem.TypedFile")
{
Value fi = v.GetMember("fi");
Value fs = v.GetMember("fs");
if (fi.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_ASSIGNED));
if (fs.IsNull)
throw new CommonEvaluationError(new System.Exception(FILE_NOT_OPENED));
return Convert.ToInt64(fs.GetMember("Position").PrimitiveValue) == Convert.ToInt64(fs.GetMember("Length").PrimitiveValue);
}
throw new WrongTypeOfArgument(name);
}
示例6: MakeViewForCollection
public static string MakeViewForCollection(Value v)
{
object cnt = v.GetMember("Count").PrimitiveValue;
return "Count = " + cnt.ToString();
}
示例7: unbox
public static Value unbox(Value v)
{
return v.GetMember("m_value");
}
示例8: GetEnumValue
public static object GetEnumValue(Value v)
{
Value val = v.GetMember("value__");
if (val != null && val.IsPrimitive)
return val.PrimitiveValue;
return null;
}