mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Add Connected event and default to break state
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
public enum InterpreterCommand : byte
|
||||
{
|
||||
Continue,
|
||||
Break,
|
||||
Continue,
|
||||
Step,
|
||||
}
|
||||
|
||||
@@ -3,15 +3,8 @@ using System;
|
||||
|
||||
namespace Microsoft.Iris.Debug;
|
||||
|
||||
public interface IDebuggerClient
|
||||
public interface IDebuggerClient : IDebuggerState
|
||||
{
|
||||
/// <summary>
|
||||
/// The URI the client is connected to.
|
||||
/// </summary>
|
||||
Uri ConnectionUri { get; }
|
||||
|
||||
InterpreterCommand DebuggerCommand { get; set; }
|
||||
|
||||
event Action<InterpreterCommand> InterpreterStateChanged;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace Microsoft.Iris.Debug;
|
||||
|
||||
internal interface IDebuggerServer
|
||||
internal interface IDebuggerServer : IDebuggerState
|
||||
{
|
||||
InterpreterCommand DebuggerCommand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Logs the context, opcode, and operands of an instruction
|
||||
/// decoded by <c>Microsoft.Iris.Markup.Interpreter</c>.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using Microsoft.Iris.Debug.Data;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Debug;
|
||||
|
||||
public interface IDebuggerState
|
||||
{
|
||||
/// <summary>
|
||||
/// The URI the client is connected to.
|
||||
/// </summary>
|
||||
public Uri ConnectionUri { get; }
|
||||
|
||||
InterpreterCommand DebuggerCommand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a connection is established.
|
||||
/// </summary>
|
||||
public event Action<IDebuggerState, object> Connected;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class NetDebuggerClient : IDebuggerClient, IDisposable
|
||||
private readonly Socket _socket;
|
||||
private readonly ConcurrentQueue<byte[]> _outQueue = new();
|
||||
private readonly IFormatter _formatter;
|
||||
private InterpreterCommand _uibCommand = InterpreterCommand.Continue;
|
||||
private InterpreterCommand _uibCommand;
|
||||
|
||||
public Uri ConnectionUri { get; }
|
||||
|
||||
@@ -31,6 +31,7 @@ public class NetDebuggerClient : IDebuggerClient, IDisposable
|
||||
public event EventHandler<InterpreterEntry> InterpreterExecute;
|
||||
public event Action<string> DispatcherStep;
|
||||
public event Action<InterpreterCommand> InterpreterStateChanged;
|
||||
public event Action<IDebuggerState, object> Connected;
|
||||
|
||||
public NetDebuggerClient(string connectionUri) : this(connectionUri is null ? null : new Uri(connectionUri))
|
||||
{
|
||||
@@ -127,6 +128,8 @@ public class NetDebuggerClient : IDebuggerClient, IDisposable
|
||||
catch { }
|
||||
}
|
||||
|
||||
Connected?.Invoke(this, _socket);
|
||||
|
||||
System.Threading.Thread receiveThread = new(MessageReceiveLoop) { IsBackground = true };
|
||||
System.Threading.Thread sendThread = new(MessageSendLoop) { IsBackground = true };
|
||||
receiveThread.Start();
|
||||
|
||||
@@ -15,7 +15,9 @@ internal class NetDebuggerServer : IDebuggerServer, IDisposable
|
||||
private readonly IFormatter _formatter;
|
||||
private Socket _socket;
|
||||
private bool _disposed = false;
|
||||
private InterpreterCommand _uibCommand = InterpreterCommand.Continue;
|
||||
private InterpreterCommand _uibCommand;
|
||||
|
||||
public event Action<IDebuggerState, object> Connected;
|
||||
|
||||
public Uri ConnectionUri { get; }
|
||||
|
||||
@@ -130,6 +132,7 @@ internal class NetDebuggerServer : IDebuggerServer, IDisposable
|
||||
if (_disposed) return;
|
||||
|
||||
_socket = _listener.AcceptSocket();
|
||||
Connected?.Invoke(this, _socket);
|
||||
|
||||
System.Threading.Thread receiveThread = new(MessageReceiveLoop) { IsBackground = true };
|
||||
System.Threading.Thread sendThread = new(MessageSendLoop) { IsBackground = true };
|
||||
|
||||
Reference in New Issue
Block a user