mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 05:18:38 +00:00
This commit is contained in:
parent
1eeaf43c74
commit
be34e259bd
4 changed files with 45 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -64,9 +64,11 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ASCIIEncodingImpl.cs" />
|
||||
<Compile Include="ConsoleImpl.cs" />
|
||||
<Compile Include="Int32Impl.cs" />
|
||||
<Compile Include="MathImpl.cs" />
|
||||
<Compile Include="MonitorImpl.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TypeImpl.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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) { }
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue