.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 lines
1.7 KiB

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Threading;
using Debugger;
namespace ILSpy.Debugger.Models.TreeModel
{
public static partial class Utils
{
/// <param name="process">Process on which to track debuggee state</param>
public static void DoEvents(Process process)
{
if (process == null) return;
DebuggeeState oldState = process.DebuggeeState;
WpfDoEvents();
DebuggeeState newState = process.DebuggeeState;
if (oldState != newState) {
//LoggingService.Info("Aborted because debuggee resumed");
throw new AbortedBecauseDebuggeeResumedException();
}
}
public static void WpfDoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => frame.Continue = false));
Dispatcher.PushFrame(frame);
}
}
public class AbortedBecauseDebuggeeResumedException: System.Exception
{
public AbortedBecauseDebuggeeResumedException(): base()
{
}
}
public class PrintTimes: PrintTime
{
public PrintTimes(string text): base(text + " - end")
{
//LoggingService.InfoFormatted("{0} - start", text);
}
}
public class PrintTime: IDisposable
{
string text;
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
public PrintTime(string text)
{
this.text = text;
stopwatch.Start();
}
public void Dispose()
{
stopwatch.Stop();
//LoggingService.InfoFormatted("{0} ({1} ms)", text, stopwatch.ElapsedMilliseconds);
}
}
}