diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-02 07:54:52 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-02 07:54:52 +0200 |
| commit | 8c0f9d6b02eac97b7a45780f82f5683771745cf0 (patch) | |
| tree | 7c638b9ace3bf6b86669eebaa8b4c9638f941f17 /Samples/CrowDebugger/Program.cs | |
| parent | 89a58fbf483a4b08309c640dfd07ddf8a58e8bd1 (diff) | |
DebugLog, event bindings resolutions, enumSelector bitfields, wip
Diffstat (limited to 'Samples/CrowDebugger/Program.cs')
| -rw-r--r-- | Samples/CrowDebugger/Program.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Samples/CrowDebugger/Program.cs b/Samples/CrowDebugger/Program.cs new file mode 100644 index 00000000..b15e3b17 --- /dev/null +++ b/Samples/CrowDebugger/Program.cs @@ -0,0 +1,58 @@ +using System.Threading; +using System; +using System.IO; +using System.Reflection; +using System.Runtime.Loader; + +namespace CrowDebugger +{ + class Program + { + const int BUFF_MAX = 1024; + static void Main(string[] args) + { + AssemblyLoadContext crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext"); + Console.WriteLine("Crow Debugger started."); + char[] buffer = new char[1024]; + int buffPtr = 0; + while (true) + { + if (Console.KeyAvailable) + { + ConsoleKeyInfo key = Console.ReadKey(true); + if (key.Key == ConsoleKey.Enter) { + Span<char> cmd = buffer.AsSpan(0, buffPtr); + Console.WriteLine($"=> {cmd.ToString()}"); + if (cmd[0] == 'q' || cmd.SequenceEqual ("quit")) + break; + + if (cmd.StartsWith("load")) { + using(crowLoadCtx.EnterContextualReflection()) { + string str = cmd.Slice(5).ToString(); + Console.WriteLine($"[msg]:Trying to load crow dll from: '{str}'"); + if (!File.Exists (str)) { + Console.WriteLine ($"[error]:File not found: {str}"); + } else { + Assembly crowAssembly = crowLoadCtx.LoadFromAssemblyPath (str); + if (crowAssembly == null) { + Console.WriteLine($"[error]:Failed to load crow dll from: {str}"); + } else { + Console.WriteLine($"[ok]:Crow Assembly loaded:{crowAssembly.FullName}"); + + } + } + } + } else + Console.WriteLine($"=> {cmd.ToString()}"); + buffPtr = 0; + continue; + } + + buffer[buffPtr++] = key.KeyChar; + } + } + + Console.WriteLine("exited"); + } + } +} |