Skip to content

Instantly share code, notes, and snippets.

var matches = Regex.Matches(content, @"<exec cmd=\""(?<command>.+?)\"">(?<label>.+?)</exec>");
int index = 0;
foreach (Match match in matches)
{
paragraph.Inlines.Add(new Run(System.Net.WebUtility.HtmlDecode(content.Substring(index, match.Index - index))));
var hyperLink = new Hyperlink(new Run(match.Groups["label"].Value));
var command = match.Groups["command"].Value;
Dispatcher.InvokeAsync(() => ContentTextBox.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
private class DmlCommand : ICommand
{
private readonly Action _command;
public DmlCommand(Action command)
{
_command = command;
}
public event EventHandler CanExecuteChanged;
private readonly IDbgConsole _console;
public CommandControl(IDbgConsole console, IHistoryManager historyManager, string content)
{
_console = console;
InitializeComponent();
AppendDmlOutput(content);
}
private async Task ExecuteCommand(string command)
{
ContentTextBox.Document.Blocks.Add(new Paragraph(new Run(command)));
ContentTextBox.ScrollToEnd();
var result = await _console.ExecuteCommandAndCaptureOutputAsync(command);
_historyManager.LogCommand(command, result);
AppendDmlOutput(result);
private async void CommandTextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return)
{
var textBox = (TextBox)sender;
if (string.IsNullOrWhiteSpace(textBox.Text))
{
return;
}
[DllExport("compileandrun")]
public static void Script(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
if (!InitApi(client))
{
return;
}
try
{
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Starvation
{
class Program
{
static void Main(string[] args)
{
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Starvation
{
class Program
{
static void Main(string[] args)
{