haxe/src/Sys.cs
// Generated by Haxe 4.3.7 (patched: whitelist-safe Sys)
#pragma warning disable 109, 114, 219, 429, 168, 162
public class Sys : global::haxe.lang.HxObject {
public Sys(global::haxe.lang.EmptyObject empty) {
}
public Sys() {
global::Sys.__hx_ctor__Sys(this);
}
protected static void __hx_ctor__Sys(global::Sys __hx_this) {
}
public static global::Array<string> _args;
private static global::haxe.ds.StringMap<string> _env;
private static string _cwd;
private static global::System.IO.MemoryStream _stdinStream;
private static global::System.IO.MemoryStream _stdoutStream;
private static global::System.IO.MemoryStream _stderrStream;
private static global::cs.io.NativeInput _stdin;
private static global::cs.io.NativeOutput _stdout;
private static global::cs.io.NativeOutput _stderr;
private static void EnsureStreams() {
if (( global::Sys._stdoutStream == null )) {
global::Sys._stdinStream = new global::System.IO.MemoryStream();
global::Sys._stdoutStream = new global::System.IO.MemoryStream();
global::Sys._stderrStream = new global::System.IO.MemoryStream();
global::Sys._stdin = new global::cs.io.NativeInput(((global::System.IO.Stream) (global::Sys._stdinStream) ));
global::Sys._stdout = new global::cs.io.NativeOutput(((global::System.IO.Stream) (global::Sys._stdoutStream) ));
global::Sys._stderr = new global::cs.io.NativeOutput(((global::System.IO.Stream) (global::Sys._stderrStream) ));
}
}
private static void WriteTo(global::System.IO.MemoryStream stream, object v, bool newline) {
string s = global::haxe.lang.Runtime.toString(v);
if (newline) {
s = global::haxe.lang.Runtime.concat(s, "\n");
}
byte[] bytes = global::System.Text.Encoding.UTF8.GetBytes(((string) (s) ));
stream.Write(((byte[]) (bytes) ), ((int) (0) ), ((int) (( bytes as global::System.Array ).Length) ));
}
public static void print(object v) {
global::Sys.EnsureStreams();
global::Sys.WriteTo(global::Sys._stdoutStream, v, false);
}
public static void println(object v) {
global::Sys.EnsureStreams();
global::Sys.WriteTo(global::Sys._stdoutStream, v, true);
}
public static global::Array<string> args() {
if (( global::Sys._args == null )) {
global::Sys._args = new global::Array<string>(new string[]{});
}
return global::Sys._args.copy();
}
public static string getEnv(string s) {
if (( global::Sys._env == null )) {
return null;
}
global::haxe.lang.Null<string> v = ((global::haxe.ds.StringMap<string>) (global::haxe.ds.StringMap<object>.__hx_cast<string>(((global::haxe.ds.StringMap) (((global::haxe.IMap<string, string>) (global::Sys._env) )) ))) ).@get(s);
if ( ! (v.hasValue) ) {
return null;
}
return (v).@value;
}
public static void putEnv(string s, string v) {
if (( global::Sys._env == null )) {
global::Sys._env = new global::haxe.ds.StringMap<string>();
}
global::Sys._env.@set(s, v);
}
public static global::haxe.ds.StringMap<string> environment() {
if (( global::Sys._env == null )) {
return new global::haxe.ds.StringMap<string>();
}
return global::Sys._env.copy();
}
public static void sleep(double seconds) {
unchecked {
if (( seconds <= 0 )) {
return;
}
int ms = ((int) (( seconds * 1000 )) );
if (( ms < 0 )) {
ms = 0;
}
global::System.Threading.Tasks.Task.Delay(((int) (ms) )).Wait();
}
}
public static bool setTimeLocale(string loc) {
return false;
}
public static string getCwd() {
if (( global::Sys._cwd == null )) {
global::Sys._cwd = "/";
}
return global::haxe.io.Path.addTrailingSlash(global::Sys._cwd);
}
public static void setCwd(string s) {
if (( s == null )) {
global::Sys._cwd = "/";
return;
}
string trimmed = global::haxe.io.Path.removeTrailingSlashes(s);
if (( trimmed == "" )) {
trimmed = "/";
}
global::Sys._cwd = trimmed;
}
public static string systemName() {
return "Windows";
}
public static int command(string cmd, global::Array<string> args) {
throw new global::System.NotSupportedException("Sys.command is not supported in whitelist mode.");
}
public static void exit(int code) {
throw new global::System.NotSupportedException("Sys.exit is not supported in whitelist mode.");
}
public static readonly long epochTicks = new global::System.DateTime(((int) (1970) ), ((int) (1) ), ((int) (1) )).Ticks;
public static double time() {
return ( ((double) (((long) (( ((long) (global::System.DateTime.UtcNow.Ticks) ) - ((long) (global::Sys.epochTicks) ) )) )) ) / ((double) (global::System.TimeSpan.TicksPerSecond) ) );
}
public static double cpuTime() {
return global::Sys.time();
}
public static string executablePath() {
return "";
}
public static string programPath() {
return "";
}
public static int getChar(bool echo) {
return -1;
}
public static global::haxe.io.Input stdin() {
global::Sys.EnsureStreams();
return ((global::haxe.io.Input) (global::Sys._stdin) );
}
public static global::haxe.io.Output stdout() {
global::Sys.EnsureStreams();
return ((global::haxe.io.Output) (global::Sys._stdout) );
}
public static global::haxe.io.Output stderr() {
global::Sys.EnsureStreams();
return ((global::haxe.io.Output) (global::Sys._stderr) );
}
}