Cosmos/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystemInfo.cs
fanoI 299c155f4c Removed a lot of plugs from File: the promise is mantained it uses StreamReader / StreamWriter directly
- CosmosEncoding replacement of Encoding is not needed: Encoding runs perfectly on Cosmos!
- Added tests to BCL for UTF8Encoding
- StreamWriter does not needs a plug anymore, TextWriter is plugged instead but the plug is really the Ctor only
- Commented COSMOSDEBUG
2017-12-01 22:21:15 +01:00

44 lines
1.9 KiB
C#

//#define COSMOSDEBUG
using System.IO;
using Cosmos.IL2CPU.API.Attribs;
using Cosmos.System;
using Cosmos.System.FileSystem.VFS;
/*
* This is is similar to what we have done for FileSystem but they did in a weird and really unclear way this time
* (an abstract class that inherits from an interface? What is the sense? They have not used a class for
* any platform but did "kludges" with partial classes).
* In the end the more simple thing to do is plug things here some it seems only Properties will hit this code
* while methods will call FileSystem directly... what a mess!
*/
namespace Cosmos.System_Plugs.System.IO
{
[Plug(Target = typeof(FileSystemInfo))]
public static class CosmosFileSystemInfo
{
[PlugMethod(Signature = "System_Boolean__System_IO_FileSystemInfo__System_IO_IFileSystemObject_get_Exists")]
public static bool get_Exists(FileSystemInfo aThis)
{
Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.get_Exists : fullPath = {aThis.FullName}");
// TODO we have to find if 'aThis' is a DirectoryInfo or a FileInfo to decide what method to call
return VFSManager.DirectoryExists(aThis.FullName);
}
public static FileAttributes get_Attributes(FileSystemInfo aThis)
{
Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.get_Attributes : fullPath = {aThis.FullName}");
return VFSManager.GetFileAttributes(aThis.FullName);
}
public static void set_Attributes(FileSystemInfo aThis, FileAttributes value)
{
Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.set_Attributes : fullPath = {aThis.FullName} value {(int) value}");
VFSManager.SetFileAttributes(aThis.FullName, value);
}
public static object get_FileSystemObject(object aThis)
{
return aThis;
}
}
}