-
Notifications
You must be signed in to change notification settings - Fork 549
/
FileImpl.cs
49 lines (46 loc) · 1.37 KB
/
FileImpl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//#define COSMOSDEBUG
using System;
using System.Collections.Generic;
using System.IO;
using Cosmos.System;
using Cosmos.Common.Extensions;
using Cosmos.Debug.Kernel;
using IL2CPU.API;
using IL2CPU.API.Attribs;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.VFS;
namespace Cosmos.System_Plugs.System.IO
{
// TODO A lot of these methods should be implemented using StreamReader / StreamWriter
[Plug(Target = typeof(File))]
public static class FileImpl
{
/*
* Plug needed for the usual issue that Array can not be converted in IEnumerable... it is starting
* to become annoying :-(
*/
public static void WriteAllLines(string aFile, string[] contents)
{
if (aFile == null)
{
throw new ArgumentNullException("path");
}
if (contents == null)
{
throw new ArgumentNullException("contents");
}
if (aFile.Length == 0)
{
throw new ArgumentException("Empty", "aFile");
}
Global.mFileSystemDebugger.SendInternal("Writing contents");
using (var xSW = new StreamWriter(aFile))
{
foreach (var current in contents)
{
xSW.WriteLine(current);
}
}
}
}
}