This commit is contained in:
kudzu_cp 2011-03-04 03:47:08 +00:00
parent 1eeaf43c74
commit be34e259bd
4 changed files with 45 additions and 1 deletions

View file

@ -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);
}
}
}
}

View file

@ -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>

View file

@ -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) { }
}
}

View file

@ -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);