From be34e259bd34592bb2c885a4555e9fc33fb2dd77 Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Fri, 4 Mar 2011 03:47:08 +0000 Subject: [PATCH] --- .../ASCIIEncodingImpl.cs | 25 +++++++++++++++++++ .../Cosmos.System.Plugs.System.csproj | 2 ++ .../Cosmos.System.Plugs.System/MonitorImpl.cs | 17 +++++++++++++ .../Users/Kudzu/Breakpoints/BreakpointsOS.cs | 2 +- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 source2/Kernel/System/Cosmos.System.Plugs.System/ASCIIEncodingImpl.cs create mode 100644 source2/Kernel/System/Cosmos.System.Plugs.System/MonitorImpl.cs diff --git a/source2/Kernel/System/Cosmos.System.Plugs.System/ASCIIEncodingImpl.cs b/source2/Kernel/System/Cosmos.System.Plugs.System/ASCIIEncodingImpl.cs new file mode 100644 index 000000000..0329359d3 --- /dev/null +++ b/source2/Kernel/System/Cosmos.System.Plugs.System/ASCIIEncodingImpl.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Cosmos.IL2CPU.Plugs; + +namespace Cosmos.System.Plugs.System { + [Plug(Target = typeof(ASCIIEncoding))] + public class ASCIIEncodingImpl { + + // TODO: Plug string.GetStringFromEncoding instead + public static string GetString(byte[] aBytes) { + if (aBytes.Length == 0) { + return string.Empty; + } else { + var xChars = new char[aBytes.Length]; + for (int i = 0; i < aBytes.Length; i++) { + xChars[i] = (char)aBytes[i]; + } + return new string(xChars); + } + } + + } +} diff --git a/source2/Kernel/System/Cosmos.System.Plugs.System/Cosmos.System.Plugs.System.csproj b/source2/Kernel/System/Cosmos.System.Plugs.System/Cosmos.System.Plugs.System.csproj index 8d8dd0092..1129bd5ec 100644 --- a/source2/Kernel/System/Cosmos.System.Plugs.System/Cosmos.System.Plugs.System.csproj +++ b/source2/Kernel/System/Cosmos.System.Plugs.System/Cosmos.System.Plugs.System.csproj @@ -64,9 +64,11 @@ + + diff --git a/source2/Kernel/System/Cosmos.System.Plugs.System/MonitorImpl.cs b/source2/Kernel/System/Cosmos.System.Plugs.System/MonitorImpl.cs new file mode 100644 index 000000000..6f9d50c95 --- /dev/null +++ b/source2/Kernel/System/Cosmos.System.Plugs.System/MonitorImpl.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Cosmos.IL2CPU.Plugs; + +namespace Cosmos.System.Plugs.System { + //TODO: We dont support threading at all, but a lot of .NET calls these + // and therefor intereferes with us using them. Since we don't support threading + // currently we can just ignore them by creating empty plugs. + [Plug(Target = typeof(global::System.Threading.Monitor))] + public class MonitorImpl { + public static void Enter(object aObj) { } + public static void Exit(object aObj) { } + public static void ReliableEnter(object obj, ref bool tookLock) { } + } +} diff --git a/source2/Users/Kudzu/Breakpoints/BreakpointsOS.cs b/source2/Users/Kudzu/Breakpoints/BreakpointsOS.cs index 3ee505a10..2c14a1eb7 100644 --- a/source2/Users/Kudzu/Breakpoints/BreakpointsOS.cs +++ b/source2/Users/Kudzu/Breakpoints/BreakpointsOS.cs @@ -148,7 +148,7 @@ namespace BreakpointsKernel { var xRootStream = new Sys.Filesystem.FAT.FatStream(xRootFile); var xRootData = new byte[xRootFile.Size]; xRootStream.Read(xRootData, 0, (int)xRootFile.Size); - //var xRootText = ASCIIEncoding.ASCII.GetString(xRootData); + //var xRootText = Encoding.ASCII.GetString(xRootData); var xRootText = ASCIIGetString(xRootData); Console.WriteLine(xRootText);