mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
//#define COSMOSDEBUG
|
|
|
|
using System.Text;
|
|
|
|
using Cosmos.Debug.Kernel;
|
|
|
|
using IL2CPU.API.Attribs;
|
|
|
|
/* This plug is needed only because Cosmos does not support Hashtable :-( */
|
|
namespace Cosmos.System_Plugs.System.Text
|
|
{
|
|
[Plug(Target = typeof(Encoding))]
|
|
public static class EncodingImpl
|
|
{
|
|
private static Debugger mDebugger = new Debugger("System", "Encoding");
|
|
|
|
enum cp {
|
|
CodePageASCII = 20127,
|
|
CodePageUTF7 = 65000,
|
|
CodePageUTF8 = 65001,
|
|
CodePageUnicode = 1200,
|
|
CodePageBigEndian = 1201,
|
|
CodePageUTF32 = 12000,
|
|
CodePageUTF32BE = 12001
|
|
};
|
|
|
|
public static string get_BodyName(Encoding aThis)
|
|
{
|
|
mDebugger.SendInternal($"Get Body name for {aThis.CodePage}");
|
|
|
|
cp cp = (cp) aThis.CodePage;
|
|
switch (cp)
|
|
{
|
|
case cp.CodePageASCII:
|
|
return "us-ascii";
|
|
|
|
case cp.CodePageUTF7:
|
|
return "UTF-7";
|
|
|
|
case cp.CodePageUTF8:
|
|
return "UTF-8";
|
|
|
|
case cp.CodePageUnicode:
|
|
return "utf-16";
|
|
|
|
case cp.CodePageBigEndian:
|
|
return "utf-16BE";
|
|
|
|
case cp.CodePageUTF32:
|
|
return "utf-32";
|
|
|
|
case cp.CodePageUTF32BE:
|
|
return "utf-32BE";
|
|
|
|
default:
|
|
return "null";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|